Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting ElasticSearch Percolator Queries

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.

like image 495
JDP10101 Avatar asked Nov 13 '14 00:11

JDP10101


People also ask

What is percolate query?

🔗 Percolate queries can be simply thought of as an inverse search. Instead of sending a query to an index and getting the matching documents, you send a document to an index and get the matching queries. This is exactly what most alerting systems need.

What is Elasticsearch percolator?

Percolator is another feature that will be part of upcoming elasticsearch 0.15. The percolator allows you to register queries against an index, and then send percolate requests which include a doc, and getting back the queries that match on that doc out of the set of registered queries.

Does Elasticsearch support term queries?

Elasticsearch supports two types of queries when you search for data: term-level queries and full-text queries. Term-level queries answer which documents match a query.

How fast is Elasticsearch query?

Elasticsearch is fast. Because Elasticsearch is built on top of Lucene, it excels at full-text search. Elasticsearch is also a near real-time search platform, meaning the latency from the time a document is indexed until it becomes searchable is very short — typically one second.


1 Answers

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.

like image 113
Jeff Gandt Avatar answered Oct 01 '22 12:10

Jeff Gandt