Highlight query to match exact word

Hi,

I am using highlight query like this

 {
      "_source": false, 
      "query": {
        "bool": {
          "must": [
            {
              "terms": {
                "_id": [
                  "AVy-uHOZTMHOTjUDPQSr"
                ]
              }
            }
          ],
          "should": {
            "match": {
              "attachment.content": "incorporated"
            }
          }
        }
      },
      "highlight": {
        "fields": {
          "attachment.content": {
            "number_of_fragments": 0
          }
        }
      }
    }

Here I am searching for a word "incorporate"
In the highlight result I am getting matches for following words :
incorporation and incorporate

I want the query to return occurrence of only the exact word "incorporate"
Is this possible?
Thanks in advance

It depends on the analyzer used for field attachment.content.

Try this analyzer with the _analyze API and you will understand why it actually matches (and highlights).

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