Returning text snippet containing highlighted hits


(Robert Gründler) #1

Hi,

we're indexing tables from a relational database where some fields have a
rather large amount of text. What i'm trying to implement is some sort of
"snippet preview" to show part of the text which contains the highlighted
match.

Is there some way to retrieve this kind of result directly from
elasticsearch?

regards

-robert


(Mauricio Alarcon) #2

Hi Robert

just use the highlight option, it has neat options like the tags to
use, the size of the fragment and the number of fragments to return

http://www.elasticsearch.org/guide/reference/api/search/highlighting.html

~M

On Nov 14, 7:28 am, Robert Gründler r.gruend...@gmail.com wrote:

Hi,

we're indexing tables from a relational database where some fields have a
rather large amount of text. What i'm trying to implement is some sort of
"snippet preview" to show part of the text which contains the highlighted
match.

Is there some way to retrieve this kind of result directly from
elasticsearch?

regards

-robert


(system) #3