[DOCS] Overhaul search template docs (#72583)

Changes:

* Adds a tutorial for search templates.
* Adds reference docs for the render search template API.
* Improves parameter documentation for the multi search template API.
* Removes duplicate examples from the search template API, multi search API, and create stored script API docs.
* Splits the source files for the search template API and the multi search template API docs.
This commit is contained in:
James Rodewig 2021-06-30 16:03:49 -04:00 committed by GitHub
parent 8bbba5f8ff
commit 3d1cb4944d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 1054 additions and 829 deletions

View file

@ -82,34 +82,14 @@ Contains the script or search template, its parameters, and its language.
`source`::
(Required, string or object)
Script or search template.
For scripts, a string containing the script.
+
For search templates, an object containing the search template. The object
supports the same parameters as the <<search-search,search API>>'s request body.
Also supports https://mustache.github.io/[Mustache] variables. See
<<search-template>>.
`params`::
(Optional, object)
Parameters for the script or search template.
====
[[create-stored-script-api-example]]
==== {api-examples-title}
The following request stores a search template. Search templates must use a
`lang` of `mustache`.
[source,console]
----
PUT _scripts/my-search-template
{
"script": {
"lang": "mustache",
"source": {
"from": "{{from}}{{^from}}0{{/from}}",
"size": "{{size}}{{^size}}10{{/size}}",
"query": {
"match": {
"content": "{{query_string}}"
}
}
}
}
}
----