Highlighted Results

Hi guys,

I'm having some issues with highlight queries. Not all the criteria are
highlighted.

...
"highlight": {
"fields": {
"body": {
"type": "plain"
}
},
"fragment_size": 500,
"highlight_query": {
"span_near": {
"clauses": [
{
"span_term": {
"body": "apple"
}
},
{
"span_term": {
"body": "iphone"
}
}
],
"in_order": false,
"slop": 5
}
},
"number_of_fragments": 5,
"require_field_match": true
},
...

When i ran the above query, it returned the correct documents; all the
results contain apple and iphone within 5 words apart. Some of the
highlight looks correct, but i saw a few highlights where snippets that it
return are like ....
"iphone (some additional text here...) " where it doesn't
container the word "apple". When i check the doc itself, i see that the
word "apple" appears right before "iphone". So why is elasticsearch not
centering the highlighted snippets around the matched terms?

Is there anything i can do to center the matches terms?

Thanks,
Guang

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/d0e0c34a-cdfe-42ee-9f02-088be660086c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.