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.
Please reply on this...
Blocked on this..help required.
Thanks
Nisar
dadoonet
(David Pilato)
July 28, 2016, 7:48am
3
mvg
(Martijn Van Groningen)
July 28, 2016, 8:10am
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" : {}
}
}
}'
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" } }
{}
mvg
(Martijn Van Groningen)
July 29, 2016, 9:26am
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.