# Is percolator better choice in this use case?

**URL:** <https://discuss.elastic.co/t/is-percolator-better-choice-in-this-use-case/40209>\
**Category:** Elasticsearch\
**Created:** [January 27, 2016, 9:40am UTC](https://discuss.elastic.co/t/is-percolator-better-choice-in-this-use-case/40209 "2016-01-27T09:40:24Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pavanraj\_Ramisetty](https://avatars.discourse-cdn.com/v4/letter/p/90ced4/32.png) [@Pavanraj\_Ramisetty](https://discuss.elastic.co/u/Pavanraj_Ramisetty)\
**Post date:** [January 27, 2016, 9:40am UTC](https://discuss.elastic.co/t/is-percolator-better-choice-in-this-use-case/40209/1 "2016-01-27T09:40:24Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![tanguy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tanguy/32/6030_2.png) [@tanguy](https://discuss.elastic.co/u/tanguy)\
**Post date:** [January 27, 2016, 9:54am UTC](https://discuss.elastic.co/t/is-percolator-better-choice-in-this-use-case/40209/2 "2016-01-27T09:54:37Z")

</div>

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](https://www.elastic.co/blog/percolator-redesign-blog-post)

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

Tanguy

---

<div class="post-metadata">

**Author:** ![Pavanraj\_Ramisetty](https://avatars.discourse-cdn.com/v4/letter/p/90ced4/32.png) [@Pavanraj\_Ramisetty](https://discuss.elastic.co/u/Pavanraj_Ramisetty)\
**Post date:** [January 27, 2016, 10:17am UTC](https://discuss.elastic.co/t/is-percolator-better-choice-in-this-use-case/40209/3 "2016-01-27T10:17:48Z")

</div>

i was confused with the answer given at this post

[efficiency-of-the-elasticsearch-percolator-versus-querying](http://stackoverflow.com/questions/32849910/efficiency-of-the-elasticsearch-percolator-versus-querying?rq=1)

Please let me know if it is correct.

---

<div class="post-metadata">

**Author:** ![tanguy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tanguy/32/6030_2.png) [@tanguy](https://discuss.elastic.co/u/tanguy)\
**Post date:** [January 27, 2016, 10:46am UTC](https://discuss.elastic.co/t/is-percolator-better-choice-in-this-use-case/40209/4 "2016-01-27T10:46:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Pavanraj\_Ramisetty](https://avatars.discourse-cdn.com/v4/letter/p/90ced4/32.png) [@Pavanraj\_Ramisetty](https://discuss.elastic.co/u/Pavanraj_Ramisetty)\
**Post date:** [January 27, 2016, 11:38am UTC](https://discuss.elastic.co/t/is-percolator-better-choice-in-this-use-case/40209/5 "2016-01-27T11:38:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tanguy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tanguy/32/6030_2.png) [@tanguy](https://discuss.elastic.co/u/tanguy)\
**Post date:** [January 27, 2016, 12:19pm UTC](https://discuss.elastic.co/t/is-percolator-better-choice-in-this-use-case/40209/6 "2016-01-27T12:19:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![adhamelia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adhamelia/32/7409_2.png) [@adhamelia](https://discuss.elastic.co/u/adhamelia)\
**Post date:** [January 27, 2016, 2:53pm UTC](https://discuss.elastic.co/t/is-percolator-better-choice-in-this-use-case/40209/7 "2016-01-27T14:53:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tanguy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tanguy/32/6030_2.png) [@tanguy](https://discuss.elastic.co/u/tanguy)\
**Post date:** [January 27, 2016, 7:19pm UTC](https://discuss.elastic.co/t/is-percolator-better-choice-in-this-use-case/40209/8 "2016-01-27T19:19:56Z")

</div>

> [@adhamelia](#):
>
> Percolator has some limitations like it does support fully DSL like search query and query string is not allowed etc.

You can register a `query_string` in the percolator.

> [@adhamelia](#):
>
> 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

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

---

<div class="post-metadata">

**Author:** ![adhamelia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adhamelia/32/7409_2.png) [@adhamelia](https://discuss.elastic.co/u/adhamelia)\
**Post date:** [February 5, 2016, 8:18am UTC](https://discuss.elastic.co/t/is-percolator-better-choice-in-this-use-case/40209/9 "2016-02-05T08:18:06Z")

</div>

we tried query\_string and it gives wrong result

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:18pm UTC](https://discuss.elastic.co/t/is-percolator-better-choice-in-this-use-case/40209/10 "2017-07-05T23:18:40Z")

</div>


