I have a problem using wildcard in query_string in elasticsearch.I can not find documentation for the "escape" property in query_string when the value is "true" I got some results but when it is "false" the result is zero.
{
"query_string": {
"query": "*Serial\\+*",
"fields": [
"info.name^1.0"
],
"type": "best_fields",
"allow_leading_wildcard": true,
"analyze_wildcard": true,
"escape": true,
"auto_generate_synonyms_phrase_query": true,
"fuzzy_transpositions": true,
"boost": 1.0
}
}
can anybody explain the "escape" property?
Weird that its not documented, but looking at the source code we can see:
Es query string source code
If "escape" is "true", the code calls org.apache.lucene.queryparser.classic.QueryParser.escape
On the query string, the function itself is documented as
Returns a String where those characters that QueryParser expects to be escaped are escaped by a preceding \.
So looks like this flag is just used to automatically escape characters for you, so you don't have to manually escape them
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With