# How to highlight stopwords only on an exact phrase match?

**URL:** <https://discuss.elastic.co/t/how-to-highlight-stopwords-only-on-an-exact-phrase-match/158835>\
**Category:** Elasticsearch\
**Created:** [November 29, 2018, 10:36pm UTC](https://discuss.elastic.co/t/how-to-highlight-stopwords-only-on-an-exact-phrase-match/158835 "2018-11-29T22:36:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ying\_Wang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ying_wang/32/38268_2.png) [@Ying\_Wang](https://discuss.elastic.co/u/Ying_Wang)\
**Post date:** [November 29, 2018, 10:36pm UTC](https://discuss.elastic.co/t/how-to-highlight-stopwords-only-on-an-exact-phrase-match/158835/1 "2018-11-29T22:36:29Z")

</div>

Is it possible to configure Elasticsearch to highlight stopwords in a phrase, but not to highlight stopwords which occur alone?

For example, I want to highlight "the lord of the rings", "rings", or "lord". But I don't want Elasticsearch to highlight "of" or "the" if they occur alone.

I am using english\_stop analyzer in the index settings, so it does not highlight any stop words. But if I remove the english\_stop analyzer, then it always highlight "of", "the" even when they occur alone.

"settings": {  
"index": {  
"analysis": {  
"analyzer": {  
"english": {  
"filter": [  
"standard",  
"lowercase",  
"english\_stop",

I found this stackoverflow post. I tried to use highlight query, but it did not highlight at all.

> <https://stackoverflow.com/questions/41583196/configure-elasticsearch-to-not-highlight-stopwords>

> The **Lord** of the **Rings** is an epic high-fantasy novel written by English author J. R. R. Tolkien. The story began as a sequel to Tolkien's 1937 fantasy novel The Hobbit, but eventually developed into a much larger work. Written in stages between 1937 and 1949, The **Lord** of the **Rings** is one of the best-selling novels

---

<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:** [December 27, 2018, 10:36pm UTC](https://discuss.elastic.co/t/how-to-highlight-stopwords-only-on-an-exact-phrase-match/158835/2 "2018-12-27T22:36:30Z")

</div>

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