# Elasticsearching \*Highlighting\* feature breaks highlights by words, not phrases

**URL:** <https://discuss.elastic.co/t/elasticsearching-highlighting-feature-breaks-highlights-by-words-not-phrases/214337>\
**Category:** Elasticsearch\
**Created:** [January 9, 2020, 2:45am UTC](https://discuss.elastic.co/t/elasticsearching-highlighting-feature-breaks-highlights-by-words-not-phrases/214337 "2020-01-09T02:45:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Noctis17](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/noctis17/32/41656_2.png) [@Noctis17](https://discuss.elastic.co/u/Noctis17)\
**Post date:** [January 9, 2020, 2:45am UTC](https://discuss.elastic.co/t/elasticsearching-highlighting-feature-breaks-highlights-by-words-not-phrases/214337/1 "2020-01-09T02:45:48Z")

</div>

ElasticSearch v7.5

Hello and good day!

I'm using ElasticSearch's feature called **Highlighting**. ES is able to emphasize the _keywords_ I'm using in my `query_string` query, sample query:

```auto
GET socialmedia/_search
{
  "size": 5,
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "fields": ["title" , "content"],
            "query": "World War III"
          }
        }
      ]
    }
  },
  "highlight": {
    "fields": {
      "content" : {
        "type" : "unified"
      }
    }
  }
}

```

**RESPONSE (omitted some of irrelevant fields for this question's purpose)**

```auto
"highlight" : {
      "content" : [
        "<em>World</em> <em>War</em> <em>III</em>"
      ]
}

```

As you can see, the output breaks the HTML tags by words, and not by the whole **PHRASE**. My desired output should look like this:

```auto
<em> World War III </em>

```

Am I missing anything in this Highlighting feature?

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [January 9, 2020, 11:08am UTC](https://discuss.elastic.co/t/elasticsearching-highlighting-feature-breaks-highlights-by-words-not-phrases/214337/2 "2020-01-09T11:08:00Z")

</div>

Technically, your search is for `World` OR `War` OR `III` not a phrase query.

That said, there's an [open issue](https://github.com/elastic/elasticsearch/issues/29561) tracking phrase highlighting

---

<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:** [February 6, 2020, 11:08am UTC](https://discuss.elastic.co/t/elasticsearching-highlighting-feature-breaks-highlights-by-words-not-phrases/214337/3 "2020-02-06T11:08:14Z")

</div>

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