Getting ElasticSearch Percolator Queries

2.2k Views Asked by At

I'm trying to query ElasticSearch for all the percolator queries that are currently stored on the system. My first thought was to do a match_all with a type filter but from my testing they don't seem to be returned if I do a match_all query. I haven't for the life of me been able to find the proper way to query them or any documentation on it so any help is greatly appreciated.

Also any other information on how stored percolator queries are treated differently from other types is appreciated.

1

There are 1 best solutions below

2
On

For versions 5.x and later

Percolator documents should be returned in a query as with any other document.

Documentation of this new behavior can be found here.

Please note that with the removal of mapping types in 6.x it is unclear what will happen with the percolator index type. The reader may assume that it will be removed and that percolators will/should be stored in separate indices. Separating percolators into isolated indices is usually suggested regardless. Also please note that this 6.x type removal should not affect the answer to this question.

For versions before 5.0

This will return all percolator documents stored in your elasticsearch cluster:

POST _all/.percolator/_search

This searches _all indexes (every index you have registered) for documents of the .percolator type.

It basically does what you describe above: "a match_all with a type filter". Yet it accomplishes it in a slightly different way.

I have not played around with this much more than this, but I assume this would actually allow you to perform a query/filter on percolators if you are looking for a percolator of a particular type.