# Phrase Highlighter

**URL:** <https://discuss.elastic.co/t/phrase-highlighter/131026>\
**Category:** Elasticsearch\
**Created:** [May 8, 2018, 2:41pm UTC](https://discuss.elastic.co/t/phrase-highlighter/131026 "2018-05-08T14:41:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![keremcan](https://avatars.discourse-cdn.com/v4/letter/k/97f17d/32.png) [@keremcan](https://discuss.elastic.co/u/keremcan)\
**Post date:** [May 8, 2018, 2:41pm UTC](https://discuss.elastic.co/t/phrase-highlighter/131026/1 "2018-05-08T14:41:12Z")

</div>

Hi there, I'm trying to highlight a phrase not a word. When trying this, ES searching everyword in my query, and tags with `<em>`. I want to tag them as phrase not every single word. Here is an example:

```
curl -X GET "localhost:9200/my-index/_search" -H 'Content-Type: application/json' -d'
{
    "query" : {
        "percolate" : {
            "field": "query",
            "document" : {
                "title" : "A new bonsai tree in the office and jungle. The enojen tree in a kerojen."
            }
        }
    },
    "highlight": {
      "fields": {
        "title": {}
      }
    }
}
'

```

output:

```
{  
   "took":12,
   "timed_out":false,
   "_shards":{  
      "total":5,
      "successful":5,
      "skipped":0,
      "failed":0
   },
   "hits":{  
      "total":45,
      "max_score":2.1576157,
      "hits":[  
         {  
            "_index":"my-index",
            "_type":"_doc",
            "_id":"2",
            "_score":2.1576157,
            "_source":{  
               "query":{  
                  "match":{  
                     "title":"the enojen tree in a kerojen"
                  }
               }
            },
            "fields":{  
               "_percolator_document_slot":[  
                  0
               ]
            },
            "highlight":{  
               "title":[  
                  "<em>A</em> new bonsai <em>tree</em> <em>in</em> <em>the</em> office and jungle. <em>The</em> <em>enojen</em> <em>tree</em> <em>in</em> <em>a</em> <em>kerojen</em>."
               ]
            }
         },
         {  
            "_index":"my-index",
            "_type":"_doc",
            "_id":"1",
            "_score":2.1576157,
            "_source":{  
               "query":{  
                  "match":{  
                     "title":"the bonsai tree in a jungle"
                  }
               }
            },
            "fields":{  
               "_percolator_document_slot":[  
                  0
               ]
            },
            "highlight":{  
               "title":[  
                  "<em>A</em> new <em>bonsai</em> <em>tree</em> <em>in</em> <em>the</em> office and <em>jungle</em>. <em>The</em> enojen <em>tree</em> <em>in</em> <em>a</em> kerojen."
               ]
            }
         }
      ]
   }
}

```

I want highlighted words to combine like `<em>The enojen tree in a kerojen</em>`  
Any suggestion would be appreciated!

---

<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:** [June 5, 2018, 2:41pm UTC](https://discuss.elastic.co/t/phrase-highlighter/131026/2 "2018-06-05T14:41:13Z")

</div>

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