# Highlighting on \`match\_phrase\` with \`index\_phrases\` enabled does not seem to work

**URL:** <https://discuss.elastic.co/t/highlighting-on-match-phrase-with-index-phrases-enabled-does-not-seem-to-work/171552>\
**Category:** Elasticsearch\
**Created:** [March 8, 2019, 8:14pm UTC](https://discuss.elastic.co/t/highlighting-on-match-phrase-with-index-phrases-enabled-does-not-seem-to-work/171552 "2019-03-08T20:14:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![loren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/loren/32/44942_2.png) [@loren](https://discuss.elastic.co/u/loren)\
**Post date:** [March 8, 2019, 8:14pm UTC](https://discuss.elastic.co/t/highlighting-on-match-phrase-with-index-phrases-enabled-does-not-seem-to-work/171552/1 "2019-03-08T20:14:13Z")

</div>

I'm experimenting with the [`index_phrases`](https://www.elastic.co/guide/en/elasticsearch/reference/6.7/index-phrases.html) functionality [introduced in 6.4.0](https://www.elastic.co/guide/en/elasticsearch/reference/6.7/release-highlights-6.4.0.html#_analysis). When I use a [`match_phrase`](https://www.elastic.co/guide/en/elasticsearch/reference/6.6/query-dsl-match-query-phrase.html) query and try to highlight the result, no highlights are returned. If I use `match`, I get highlights. Example:

```auto
DELETE test
PUT test
{
  "mappings": {
    "_doc": {
      "properties": {
        "voter": {
          "type": "text",
          "index_phrases": true
        }
      }
    }
  }
}

PUT test/_doc/1?refresh
{
  "voter": "John Paul Jones"
}

POST test/_search
{
  "query": {
    "match_phrase": {
      "voter": "Paul Jones"
    }
  },
  "highlight": {
    "fields": {
      "voter": {}
    }
  }
}

POST test/_search
{
  "query": {
    "match": {
      "voter": "Paul Jones"
    }
  },
  "highlight": {
    "fields": {
      "voter": {}
    }
  }
}

```

If I define the mapping without `index_phrases`, highlighting works as expected for `match_phrase`.

Is this a bug or an expected side-effect of `index_phrases`?

---

<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:** [April 5, 2019, 8:14pm UTC](https://discuss.elastic.co/t/highlighting-on-match-phrase-with-index-phrases-enabled-does-not-seem-to-work/171552/2 "2019-04-05T20:14:24Z")

</div>

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