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 | |
parent | e49ebd04fd2522b4695a023fe2adc8de8b05c10a (diff) |
Removed deprecated template query.
Relates to #19390
Diffstat (limited to 'docs')
4 files changed, 4 insertions, 137 deletions
diff --git a/docs/reference/migration/migrate_6_0/search.asciidoc b/docs/reference/migration/migrate_6_0/search.asciidoc index 80d67eae72..82c2ba8f71 100644 --- a/docs/reference/migration/migrate_6_0/search.asciidoc +++ b/docs/reference/migration/migrate_6_0/search.asciidoc @@ -51,6 +51,8 @@ * The `disable_coord` parameter of the `bool` and `common_terms` queries has been removed. If provided, it will be ignored and issue a deprecation warning. +* The `template` query has been removed. This query was deprecated since 5.0 + ==== Search shards API The search shards API no longer accepts the `type` url parameter, which didn't 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. diff --git a/docs/reference/search/suggesters/phrase-suggest.asciidoc b/docs/reference/search/suggesters/phrase-suggest.asciidoc index f4d4f46e3a..53c0c9be4e 100644 --- a/docs/reference/search/suggesters/phrase-suggest.asciidoc +++ b/docs/reference/search/suggesters/phrase-suggest.asciidoc @@ -213,8 +213,8 @@ The response contains suggestions scored by the most likely spell correction fir Checks each suggestion against the specified `query` to prune suggestions for which no matching docs exist in the index. The collate query for a suggestion is run only on the local shard from which the suggestion has - been generated from. The `query` must be specified, and it is run as - a <<query-dsl-template-query,`template` query>>. + been generated from. The `query` must be specified and it can be templated, + see <<search-template,search templates>> for more information. The current suggestion is automatically made available as the `{{suggestion}}` variable, which should be used in your query. You can still specify your own template `params` -- the `suggestion` value will be added to the |