elasticsearch/elasticsearch — Issue #1459: Add support for field excerpt when no highlighting is possible
Author: ahfeel
Created: 2011-11-14 00:12:32+00:00
State: open

The majority of search frontends usually display the highlighted chunks below the hit title. The problem is that on non highlighting queries, such as a numerical range, no highlighting chunk will be brought back in the search. If you don't want your display to look bad, you usually display an excerpt of the beginning of the file, or of the first contiguous paragraph, etc... The easy way to do that is to always ask for the full field content in your ES query, but this is a very costly solution in any case (unnecessary memory and bandwidth).

I would like to suggest an enhancement to ElasticSearch to add the possibility to get back a excerpt of the highlighted field in case the query doesn't highlight. The syntax would be:

"highlight" : {
"fields" : {
"content" : {
"fragment_size" : 150,
"number_of_fragments" : 3,
"fallback" : "excerpt_basic" // or "excerpt_firstparagraph" or any other more advanced impl to come
}
}
}

Jérémie