Percolate already indexed documents in bulk

We would like to perform percolate on documents which are already indexed in elastic.

Ofcourse it is possible to do this as document here -
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-percolate-query.html#_percolating_an_existing_document

My first question is can I perform the same in bulk, not just a single document.

Further extending that question, can I request percolation on all documents within an index ?

a percolate query is applied at search time within the search API.

the documents parameter helps you to pass a list of documents instead of a single doc with document
Also you can use _msearch if you wish but I suspect the previous option will be faster.

Sure I'm exploring msearch as well.

Going back to the percolate search, are you saying that its possible to pass "documents" parameter in the context of already indexed document ?

Please note in my case both the search query and the actual document that contains the data are indexed within elastic as 2 separate indices.

As per - https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-percolate-query.html#_parameters_10

the following are the only parameters (with few more optional which I'm not mentioning here)
index - The index the document resides in. This is a required parameter.
type - The type of the document to fetch. This is a required parameter.
id - The id of the document to fetch. This is a required parameter.

Am I missing something ?

I think you can. But @mvg can probably tell more.

Thanks David.

Hi @mvg , I came across this in the documentation -
https://www.elastic.co/guide/en/elasticsearch/reference/6.2/breaking_60_percolator_changes.html#_deprecated_percolator_and_mpercolate_apis_have_been_removed

msearch replacing mpercolate. I'm trying to get my head around how msearch works with percolate.

Could you pls point to any simple example ?

I got it working. My bad ! It was the way with which I structured the query in Kibana.

Thanks @dadoonet for responding. I'll take @mvg help for something interesting later.

For the benefit of someone looking for something similar at a later point., here is an example of msearch with percolate ...

GET _msearch
{ "index" : "segmentation_filter"}
{"query" : { "percolate" : {"field": "criteria", "index" : "account", "type" : "default", "id" : 1 } } }
{ "index" : "segmentation_filter"}
{"query" : { "percolate" : {"field": "criteria", "index" : "account", "type" : "default", "id" : 2 } } }
{ "index" : "segmentation_filter"}
{"query" : { "percolate" : {"field": "criteria", "index" : "account", "type" : "default", "id" : 3 } } }
1 Like

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