# How to do highlight on percolation

**URL:** <https://discuss.elastic.co/t/how-to-do-highlight-on-percolation/56518>\
**Category:** Elasticsearch\
**Created:** [July 27, 2016, 12:35pm UTC](https://discuss.elastic.co/t/how-to-do-highlight-on-percolation/56518 "2016-07-27T12:35:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nisar\_Adappadathil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nisar_adappadathil/32/13224_2.png) [@Nisar\_Adappadathil](https://discuss.elastic.co/u/Nisar_Adappadathil)\
**Post date:** [July 27, 2016, 12:35pm UTC](https://discuss.elastic.co/t/how-to-do-highlight-on-percolation/56518/1 "2016-07-27T12:35:53Z")

</div>

How to do a highlight on percolation of existing document.

I have indexed a document. In this index,type and Id --\>\>  
POST [http://127.0.0.1:9200/sp/res/12](http://127.0.0.1:9200/sp/res/12)

Now i have to do percolation on this GET [http://127.0.0.1:9200/sp/res/12/\_percolate](http://127.0.0.1:9200/sp/res/12/_percolate)  
and i have to highlight the matches.

How can I do this for multipercolate also?

Please reply me with one example.

I found this link for percolating document. Bu this not for existing indexed document.

> <https://github.com/elastic/elasticsearch/issues/3574>

---

<div class="post-metadata">

**Author:** ![Nisar\_Adappadathil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nisar_adappadathil/32/13224_2.png) [@Nisar\_Adappadathil](https://discuss.elastic.co/u/Nisar_Adappadathil)\
**Post date:** [July 28, 2016, 6:58am UTC](https://discuss.elastic.co/t/how-to-do-highlight-on-percolation/56518/2 "2016-07-28T06:58:13Z")

</div>

Please reply on this...  
Blocked on this..help required.

Thanks  
Nisar

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 28, 2016, 7:48am UTC](https://discuss.elastic.co/t/how-to-do-highlight-on-percolation/56518/3 "2016-07-28T07:48:16Z")

</div>

Please read [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21)

Especially the `Also be patient...` part.

You can read this: [https://www.elastic.co/guide/en/elasticsearch/reference/2.3/search-percolate.html#\_percolating\_an\_existing\_document](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/search-percolate.html#_percolating_an_existing_document)

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [July 28, 2016, 8:10am UTC](https://discuss.elastic.co/t/how-to-do-highlight-on-percolation/56518/4 "2016-07-28T08:10:50Z")

</div>

Using Highlighting in the percolate api is the same as in the search api. Just refer to a field that is in the document you would like to percolate.

```auto
curl -XGET "http://localhost:9200/sp/res/12/_percolate" -d'
{
  "highlight": {
    "fields": {
      "your_field" : {}
    }
  }
}'

```

---

<div class="post-metadata">

**Author:** ![Nisar\_Adappadathil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nisar_adappadathil/32/13224_2.png) [@Nisar\_Adappadathil](https://discuss.elastic.co/u/Nisar_Adappadathil)\
**Post date:** [July 28, 2016, 1:12pm UTC](https://discuss.elastic.co/t/how-to-do-highlight-on-percolation/56518/5 "2016-07-28T13:12:07Z")

</div>

Thanks this works.

But for multipercolate how should I do? How can I highlight  
Below is my query:

POST [http://localhost:9200/sp/rs/\_mpercolate](http://localhost:9200/sp/rs/_mpercolate)  
{"percolate" : {"index" : "sp", "type" : "rs", "id" : "AVYnWUgDva7zbOd2yZQa" } }  
{}  
{"percolate" : {"index" : "sp", "type" : "rs", "id" : "AVYnWYK\_va7zbOd2yZQe" } }  
{}

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [July 29, 2016, 9:26am UTC](https://discuss.elastic.co/t/how-to-do-highlight-on-percolation/56518/6 "2016-07-29T09:26:40Z")

</div>

In the mpercolate api each request consists out of two lines the head and body.  
The body is empty in your case and you should add highlighting there:

```auto
POST http://localhost:9200/sp/rs/_mpercolate
{"percolate" : {"index" : "sp", "type" : "rs", "id" : "AVYnWUgDva7zbOd2yZQa" } }
{"highlight" : { "fields" : { "your_field" : {} } } }
{"percolate" : {"index" : "sp", "type" : "rs", "id" : "AVYnWYK_va7zbOd2yZQe" } }
{"highlight" : { "fields" : { "your_field" : {} } } }

```

The request header and body must each be specified as a single line (the newline at the last line is required). Otherwise the mpercolate api fails.

From what programming language are you using ES? Maybe take a look at the official supported clients as they make integrating with the APIs easier.

---

<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:** [July 5, 2017, 10:31pm UTC](https://discuss.elastic.co/t/how-to-do-highlight-on-percolation/56518/7 "2017-07-05T22:31:50Z")

</div>


