Is percolator better choice in this use case?

We have ads and alerts, we are supposed to find matching alerts when a new ad is posted and notify them of the ad posted.

  1. One way is
    Convert alert to a query and store it in the percolator.
    When a new ad is posted identify which alerts to be notified.

  2. Second way
    Store all the alerts in a index.
    When a new ad is posted convert ad into a query which can be executed
    on the alerts index and fetch the matching alerts.

Which is the better way and why ?

Hi,

You should use the Percolator feature for that. For what I understand of your use case, an alert should match on keywords (and/or maybe time range) and the Query DSL will allow you to write powerful and precise queries for alerts. An ad is just a content that must be analyzed, so it should be a document.

Also, the percolator scales well and you might find this blog post interesting https://www.elastic.co/blog/percolator-redesign-blog-post

You may also have a look at Watcher (see https://www.elastic.co/products/watcher) which is designed for alerting.

Tanguy

i was confused with the answer given at this post

efficiency-of-the-elasticsearch-percolator-versus-querying

Please let me know if it is correct.

Percolating queries as well as normal search queries are executed in parallel on multiple nodes as long as the target indices have multiple shards distributed on multiple nodes. So scaling and performance should not be an issue.

Thanks tanguy for answering with patience.
if it is same both the ways why something called percolator was introduced.
What exactly are the times it yields us the best results.

I'm not saying this is the same thing, I'm saying that you may expect similar performance.

You usually index documents and execute search queries on them to retrieve matching documents. Percolator is about indexing search queries and retrieves the search queries a given document match. This is not the same thing. And in the 1st case search queries are short-live objects and documents are long-live objects (persisted). Using percolator, search queries are long-life objects (persisted) and documents are short-live objects.

Percolator has some limitations like it does support fully DSL like search query and query string is not allowed etc.

if you have limited things to match then Percolator would be the best.

in our case,Percolator did not help much.. we have a complex query to search that's why

again it depends upon use cases

You can register a query_string in the percolator.

I agree it might depends of use cases, but I find your assertions a bit vague.

we tried query_string and it gives wrong result