Getting ElasticSearch Percolator Queries
Asked Answered
F

1

5

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.

Ferdelance answered 13/11, 2014 at 0:18 Comment(0)
E
8

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.

Elevator answered 29/12, 2014 at 18:54 Comment(2)
Note that this works for pre-5.0 percolator (see elastic.co/guide/en/elasticsearch/reference/5.4/…). For current implementation just use _search on the index where percolator queries are indexedGoddess
Thanks @AlexZakharenko! I updated the answer to reflect the new behavior. Please review it and leave any further feedback you have.Elevator

© 2022 - 2024 — McMap. All rights reserved.