mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 23:27:25 -04:00
[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:
parent
8bbba5f8ff
commit
3d1cb4944d
13 changed files with 1054 additions and 829 deletions
|
@ -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}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
----
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue