Highlighting doesn't work with Query String Query.
After upgrading from ES 1.7.1 to 2.1, highlighting stopped working with Query String Query.
does work
sample query:
All fields are stored in the mapping and source is stored as well
curl -XPOST '192.168.56.101:9201/_search?pretty' -d '{
"from" : 0,
"size" : 1,
"timeout" : 120000,
"query" : {
"query_string" : {
"query" : "alex"
}
},
"highlight" : {
"fields" : {
"*" : { }
}
}
}'
You are querying the _all field and highlighting every field in your documents. In general it would be much better to highlight the same fields that you are querying against, but in this case you can't because the _all field is not stored. You need to set require_field_match to false for that to work, see #10627 .
Appreciate the super fast response, I don't know how are you doing this!
Works now!
Most helpful comment
You are querying the
_allfield and highlighting every field in your documents. In general it would be much better to highlight the same fields that you are querying against, but in this case you can't because the_allfield is not stored. You need to setrequire_field_matchtofalsefor that to work, see #10627 .