Getting offsets of a keyword in documents

I'm new to Elasticsearch. I have created an index named "files". Then I have added a document with fields 'name' & 'content', under the type "text". like below.
curl -XPUT 'localhost:9200/files/text/1?pretty' -H 'Content-Type: application/json' -d'
{
"name" : "Readme",
"content" : "Hi this is a sample document.I created this document to explore the features of elasticsearch"
}'

I want to search in the 'content' field of this document for a keyword [for eg.'this'] and get its offsets. Is it possible ?. Actually my requirement is to get the offsets of a keyword in 'n' documents in an index

Hi, maybe you can look at this : https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-highlighting.html

thanks. I tried it. but it only highlights the occurrences. I want its offsets .

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