# Highlighting with single set of pre and post tags for multi-word phrase search

**URL:** <https://discuss.elastic.co/t/highlighting-with-single-set-of-pre-and-post-tags-for-multi-word-phrase-search/104771>\
**Category:** Elasticsearch\
**Created:** [October 21, 2017, 6:07pm UTC](https://discuss.elastic.co/t/highlighting-with-single-set-of-pre-and-post-tags-for-multi-word-phrase-search/104771 "2017-10-21T18:07:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Swapnil\_Nawale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swapnil_nawale/32/23260_2.png) [@Swapnil\_Nawale](https://discuss.elastic.co/u/Swapnil_Nawale)\
**Post date:** [October 21, 2017, 6:07pm UTC](https://discuss.elastic.co/t/highlighting-with-single-set-of-pre-and-post-tags-for-multi-word-phrase-search/104771/1 "2017-10-21T18:07:03Z")

</div>

I am trying to run an elasticsearch `match_phrase` query along with the plain highlighter. I need to search for the multi-word phrases. The issue is that the `pre` and `post` tags get appended for each word in the multi-word phrase. Is there a way to output only one set of `pre` and `post` tags around the complete phrase?

e.g. Searching for "lorem ipsum", currently gives me:

```
<em>lorem</em> <em>ipsum</em>

```

And I want to get following highlighting:

```
<em>lorem ipsum</em>
```

---

<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:** [November 18, 2017, 6:07pm UTC](https://discuss.elastic.co/t/highlighting-with-single-set-of-pre-and-post-tags-for-multi-word-phrase-search/104771/2 "2017-11-18T18:07:03Z")

</div>

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