From b2e93d28707521667a4fd9dd9cea2e73fa604c8e Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Mon, 19 Dec 2016 14:21:21 +0100 Subject: [PATCH] Be explicit about the fact backslashes need to be escaped. (#22257) Relates #22255 --- .../query-dsl/query-string-query.asciidoc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/reference/query-dsl/query-string-query.asciidoc b/docs/reference/query-dsl/query-string-query.asciidoc index 2dcfcde1ca0..cc8ac5068c4 100644 --- a/docs/reference/query-dsl/query-string-query.asciidoc +++ b/docs/reference/query-dsl/query-string-query.asciidoc @@ -197,7 +197,24 @@ GET /_search Another option is to provide the wildcard fields search in the query string itself (properly escaping the `*` sign), for example: -`city.\*:something`. +`city.\*:something`: + +[source,js] +-------------------------------------------------- +GET /_search +{ + "query": { + "query_string" : { + "query" : "city.\\*:(this AND that OR thus)", + "use_dis_max" : true + } + } +} +-------------------------------------------------- +// CONSOLE + +NOTE: Since `\` (backslash) is a special character in json strings, it needs to +be escaped, hence the two backslashes in the above `query_string`. When running the `query_string` query against multiple fields, the following additional parameters are allowed: