Finding out offsets of query matches in indexed text

Hi!

I need to find out where exactly search queries I run match in the
indexed documents, in order to highlight these positions; like, if I
search for "squirrel", i'd like to highlight that term in the search
results. I can do this with basic string search for term queries, but
I'd be curious if ElasticSearch offers anything to faciliate doing
this with span near queries etc., having to duplicate ElasticSearch's
pattern matching would be rather cumbersome.

Thanks!

Felix

1 Like