# Highlight query to match exact word

**URL:** <https://discuss.elastic.co/t/highlight-query-to-match-exact-word/89889>\
**Category:** Elasticsearch\
**Created:** [June 19, 2017, 6:50am UTC](https://discuss.elastic.co/t/highlight-query-to-match-exact-word/89889 "2017-06-19T06:50:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jshraddha](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@jshraddha](https://discuss.elastic.co/u/jshraddha)\
**Post date:** [June 19, 2017, 6:50am UTC](https://discuss.elastic.co/t/highlight-query-to-match-exact-word/89889/1 "2017-06-19T06:50:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 19, 2017, 7:26am UTC](https://discuss.elastic.co/t/highlight-query-to-match-exact-word/89889/2 "2017-06-19T07:26:11Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 17, 2017, 7:36am UTC](https://discuss.elastic.co/t/highlight-query-to-match-exact-word/89889/3 "2017-07-17T07:36:38Z")

</div>

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