diff options
author | Martijn van Groningen <martijn.v.groningen@gmail.com> | 2017-05-10 12:18:19 +0200 |
---|---|---|
committer | Martijn van Groningen <martijn.v.groningen@gmail.com> | 2017-05-11 14:56:45 +0200 |
commit | 840da4aebf3eba2df856aea75ae2a93ff371796c (patch) | |
tree | 054ac51a07153ed76b4879cc4a8a4de256f29638 /docs/reference/query-dsl | |
parent | e49ebd04fd2522b4695a023fe2adc8de8b05c10a (diff) |
Removed deprecated template query.
Relates to #19390
Diffstat (limited to 'docs/reference/query-dsl')
-rw-r--r-- | docs/reference/query-dsl/special-queries.asciidoc | 8 | ||||
-rw-r--r-- | docs/reference/query-dsl/template-query.asciidoc | 127 |
2 files changed, 0 insertions, 135 deletions
diff --git a/docs/reference/query-dsl/special-queries.asciidoc b/docs/reference/query-dsl/special-queries.asciidoc index b705f01c6f..3e3c140d6f 100644 --- a/docs/reference/query-dsl/special-queries.asciidoc +++ b/docs/reference/query-dsl/special-queries.asciidoc @@ -9,12 +9,6 @@ This group contains queries which do not fit into the other groups: This query finds documents which are similar to the specified text, document, or collection of documents. -<<query-dsl-template-query,`template` query>>:: - -The `template` query accepts a Mustache template (either inline, indexed, or -from a file), and a map of parameters, and combines the two to generate the -final query to execute. - <<query-dsl-script-query,`script` query>>:: This query allows a script to act as a filter. Also see the @@ -27,8 +21,6 @@ the specified document. include::mlt-query.asciidoc[] -include::template-query.asciidoc[] - include::script-query.asciidoc[] include::percolate-query.asciidoc[] diff --git a/docs/reference/query-dsl/template-query.asciidoc b/docs/reference/query-dsl/template-query.asciidoc deleted file mode 100644 index 2d3b5724d4..0000000000 --- a/docs/reference/query-dsl/template-query.asciidoc +++ /dev/null @@ -1,127 +0,0 @@ -[[query-dsl-template-query]] -=== Template Query - -deprecated[5.0.0, Use the <<search-template>> API] - -A query that accepts a query template and a map of key/value pairs to fill in -template parameters. Templating is based on Mustache. For simple token substitution all you provide -is a query containing some variable that you want to substitute and the actual -values: - -[source,js] ------------------------------------------- -GET /_search -{ - "query": { - "template": { - "inline": { "match": { "text": "{{query_string}}" }}, - "params" : { - "query_string" : "all about search" - } - } - } -} ------------------------------------------- -// CONSOLE -// TEST[warning:[template] query is deprecated, use search template api instead] - -The above request is translated into: - -[source,js] ------------------------------------------- -GET /_search -{ - "query": { - "match": { - "text": "all about search" - } - } -} ------------------------------------------- -// CONSOLE - -Alternatively passing the template as an escaped string works as well: - -[source,js] ------------------------------------------- -GET /_search -{ - "query": { - "template": { - "inline": "{ \"match\": { \"text\": \"{{query_string}}\" }}", <1> - "params" : { - "query_string" : "all about search" - } - } - } -} ------------------------------------------- -// CONSOLE -// TEST[warning:[template] query is deprecated, use search template api instead] - -<1> New line characters (`\n`) should be escaped as `\\n` or removed, - and quotes (`"`) should be escaped as `\\"`. - -==== Stored templates - -You can register a template by storing it in the `config/scripts` directory, in a file using the `.mustache` extension. -In order to execute the stored template, reference it by name in the `file` -parameter: - - -[source,js] ------------------------------------------- -GET /_search -{ - "query": { - "template": { - "file": "my_template", <1> - "params" : { - "query_string" : "all about search" - } - } - } -} ------------------------------------------- -// CONSOLE -// TEST[warning:[template] query is deprecated, use search template api instead] - -<1> Name of the query template in `config/scripts/`, i.e., `my_template.mustache`. - -Alternatively, you can register a query template in the cluster state with: - -[source,js] ------------------------------------------- -PUT /_search/template/my_template -{ - "template": { "match": { "text": "{{query_string}}" }} -} ------------------------------------------- -// CONSOLE - -and refer to it in the `template` query with the `id` parameter: - - -[source,js] ------------------------------------------- -GET /_search -{ - "query": { - "template": { - "stored": "my_template", <1> - "params" : { - "query_string" : "all about search" - } - } - } -} ------------------------------------------- -// CONSOLE -// TEST[continued] -// TEST[warning:[template] query is deprecated, use search template api instead] - -<1> Name of the query template in `config/scripts/`, i.e., `my_template.mustache`. - - -There is also a dedicated `template` endpoint, allows you to template an entire search request. -Please see <<search-template>> for more details. |