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.

JDP10101
  • 81
  • 9

1 Answers1

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.

Jeff Gandt
  • 377
  • 2
  • 12
  • Note that this works for pre-5.0 percolator (see https://www.elastic.co/guide/en/elasticsearch/reference/5.4/breaking_50_percolator.html). For current implementation just use _search on the index where percolator queries are indexed – Alex Z Sep 13 '18 at 22:05
  • Thanks @AlexZakharenko! I updated the answer to reflect the new behavior. Please review it and leave any further feedback you have. – Jeff Gandt Sep 17 '18 at 13:17