Can Elasticsearch return position of the text within document

I have created index with the attributes <Filename,pageno, content>, where the contents are the page content of the document.
When I search for the particular query, it returns the appropriate Filename, Pageno. But to be more precise, I want the position of the search result within the document.
Is there any method for getting the same.

Hi @Dinesh_Zende .

I understand that if you search for "mathematics" and the answer is the document "mathematics class" you want a field with the value 0 due to the position of the term "mathematics" in the text "mathematics class".
Is there any impediment to carrying out this logic in your application?

Thanks @RabBit_BR for your quick reply.
Actually I want to highlight that part of the text in PDF file, returned by the search results. (if possible the whole related paragraph)

Maybe if you give more details of your data, some example for a simulation.

I believe you need the highlighting.


Appreciate it @RabBit_BR
I will try to implement it.
Actually, I have PDF Repositories and then I have spllited it in pages and added as a document in the index.
So will this help to highight the PDF (though I have not read it properly)

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.