Be explicit about the fact backslashes need to be escaped. (#22257)

Relates #22255
This commit is contained in:
Adrien Grand 2016-12-19 14:21:21 +01:00 committed by GitHub
parent b857b316b6
commit b2e93d2870
1 changed files with 18 additions and 1 deletions

View File

@ -197,7 +197,24 @@ GET /_search
Another option is to provide the wildcard fields search in the query Another option is to provide the wildcard fields search in the query
string itself (properly escaping the `*` sign), for example: 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 When running the `query_string` query against multiple fields, the
following additional parameters are allowed: following additional parameters are allowed: