Elasticsearch: Highlighter doesn't work with String Query

Created on 4 Dec 2015  路  2Comments  路  Source: elastic/elasticsearch

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" : {
"*" : { }
}
}
}'

Most helpful comment

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 .

All 2 comments

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!

Was this page helpful?
0 / 5 - 0 ratings