How to do highlight on percolation


(Nisar Adappadathil) #1

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

Now i have to do percolation on this GET 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.


(Nisar Adappadathil) #2

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

Thanks
Nisar


(David Pilato) #3

Please read About the Elasticsearch category

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


(Martijn Van Groningen) #4

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.

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

(Nisar Adappadathil) #5

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
{"percolate" : {"index" : "sp", "type" : "rs", "id" : "AVYnWUgDva7zbOd2yZQa" } }
{}
{"percolate" : {"index" : "sp", "type" : "rs", "id" : "AVYnWYK_va7zbOd2yZQe" } }
{}


(Martijn Van Groningen) #6

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:

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.


(system) closed #7