Highlighting in Elasticsearch for Exact phrase

down vote
I am trying to do exact phrase search in Elasticsearch , but I am facing a issue in obtaining the complete document. My doc has a field

   "bkgcontent" :[ "qucik brown fox",
                   "quick brown fox jumped high",
                   "not related text"]

I am doing a phrase search and using query

              GET /_search
               "query" : {
"match_phrase": { "bkgcontent": "qucik brown fox" }
 "highlight" : {
 "pre_tags" : [ "<span style='font-weight: bold;'>" ],
 "post_tags" : [ "</span>" ],
 "number_of_fragments" : 0,
 "fields" : {
  "bkgdcontent" : { }

The result I get has

"highlight": {
"bkgcontent" :[ "<span style='font-weight: bold;'>qucik brown fox</span>",
               "<span style='font-weight: bold;'>quick brown fox jumped high</span>"]

The issue is I am missing the third value which is not related text. Is there any way I can obtain the third value in in the highlight segment only rather than doing a manual look up.

After going through lots of documentation figured out that I can use "no_match_size": to get the data snippets which is not having any match.I have tried using that but it was of no use. Confused now !!!!
Any help will be great .

I don't believe what you are looking for is supported. no_match_size is for returning a snippet at the start of some text when there isn't a match in that section.

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