How to fetch the offset of the highlighted word in the Elastic search result

(Harish Alwala) #1

I have indexed a book contents to Elastic search. Now from the search results I need to navigate to the page of the book. I am looking to fetch the offset of the search word in the results and map to the offset in the book to get the page number.

I have seen similar question in this forum, but they have no solution in it. I know it is easy to get it in LUCENE. I tried with TermVector in mapping, but it does not give me the offset in the query result.

I have spend good time in elastic search documentation and other forums to get the offsets of the highlighted search results, but I didnot get the solution.

Any suggestions please.

(David Pilato) #2

The first approach I'd try is based on the fact you are searching for terms in pages and not for terms in books.

It means to me that you should try to index pages and not books.

Would this work?

(system) #3