I want the matched results to be highlighted. This works for me if I
mention the field name and it returns the highlighted text, however if
I give the field as "_all", it is not returning any value. This works
for me:
curl -XGET "http://localhost:9200/my_index/my_type/_search?
q=stackoverflow&size=999" -d '{
"highlight":{
"fields":{
"my_field":{}
}
}
}'
This returns the expected value as follows: [highlight] => stdClass
Object ( [my_field] => Array ( [0] => stackoverflow is the best
website for techies ) )
The _all field is a special field, which includes all the other fields. If
you want to be able to highlight it, you need to store it specifically
(which will add to the index size). Specific fields can be extracted from
the "_source" document stored.
I want the matched results to be highlighted. This works for me if I
mention the field name and it returns the highlighted text, however if
I give the field as "_all", it is not returning any value. This works
for me:
curl -XGET "http://localhost:9200/my_index/my_type/_search?
q=stackoverflow&size=999" -d '{
"highlight":{
"fields":{
"my_field":{}
}
}
}'
This returns the expected value as follows: [highlight] => stdClass
Object ( [my_field] => Array ( [0] => stackoverflow is the best
website for techies ) )
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.