# Percolator doesn't match the query

**URL:** https://discuss.elastic.co/t/percolator-doesnt-match-the-query/7974
**Category:** Elasticsearch
**Created:** [June 5, 2012, 5:32am UTC](https://discuss.elastic.co/t/percolator-doesnt-match-the-query/7974 "2012-06-05T05:32:35Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Andrei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei/32/2856_2.png) [@Andrei](https://discuss.elastic.co/u/Andrei)
#### Post date: [June 5, 2012, 5:32am UTC](https://discuss.elastic.co/t/percolator-doesnt-match-the-query/7974/1 "2012-06-05T05:32:35Z")

</div>

Just installed 0.19.4 and tried my test that worked in 0.19.0RC3. To  
illustrate:

curl -XPUT localhost:9200/shop -d'{ index : { number\_of\_shards : 1,  
number\_of\_replicas : 0 } }';

curl -XPUT localhost:9200/\_percolator/shop/andrei -d '{  
"query" : {  
"filtered" : {  
"query" : {  
"term" : { "type" : "camera" }  
},  
"filter" : {  
"range" : {  
"price" : { "from": 1, "to" : 200 }  
}  
}  
}  
}  
}'

curl localhost:9200/shop/products/\_percolate -d '{  
"doc" : {  
"type" : "camera",  
"brand": "Nikon",  
"price": 150  
}  
}'

{"ok":true,"matches":[]}

I expected it to match the 'andrei' query. If I PUT the exact same  
query into the index again (incrementing the version to 2), it starts  
matching. Anyone else see this?

Andrei

---

<div class="post-metadata">

### Author: ![Andrei](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrei/32/2856_2.png) [@Andrei](https://discuss.elastic.co/u/Andrei)
#### Post date: [June 7, 2012, 8:55am UTC](https://discuss.elastic.co/t/percolator-doesnt-match-the-query/7974/2 "2012-06-07T08:55:10Z")

</div>

Can anyone reproduce it?

On Jun 4, 10:32 pm, Andrei Zmievski [and...@zmievski.org](mailto:and...@zmievski.org) wrote:

> Just installed 0.19.4 and tried my test that worked in 0.19.0RC3. To  
> illustrate:
> 
> curl -XPUT localhost:9200/shop -d'{ index : { number\_of\_shards : 1,  
> number\_of\_replicas : 0 } }';
> 
> curl -XPUT localhost:9200/\_percolator/shop/andrei -d '{  
> "query" : {  
> "filtered" : {  
> "query" : {  
> "term" : { "type" : "camera" }  
> },  
> "filter" : {  
> "range" : {  
> "price" : { "from": 1, "to" : 200 }  
> }  
> }  
> }  
> }
> 
> }'
> 
> curl localhost:9200/shop/products/\_percolate -d '{  
> "doc" : {  
> "type" : "camera",  
> "brand": "Nikon",  
> "price": 150  
> }
> 
> }'
> 
> {"ok":true,"matches":}
> 
> I expected it to match the 'andrei' query. If I PUT the exact same  
> query into the index again (incrementing the version to 2), it starts  
> matching. Anyone else see this?
> 
> Andrei

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [June 7, 2012, 10:32am UTC](https://discuss.elastic.co/t/percolator-doesnt-match-the-query/7974/3 "2012-06-07T10:32:42Z")

</div>

Hi Andrei

On Thu, Jun 7, 2012 at 10:55 AM, Andrei Zmievski [andrei@zmievski.org](mailto:andrei@zmievski.org)wrote:

> Can anyone reproduce it?

No, it does not seem to work at all for me on 0.19.x, not even on second  
indexing. Percolation as described on  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/percolate.html) seems to  
work though.

The example I put in my presentation (which worked with 0.18.x also seems  
broken now)  
[http://spinscale.github.com/elasticsearch/2012-03-jugm.html#/26](http://spinscale.github.com/elasticsearch/2012-03-jugm.html#/26)

--Alexander

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [June 7, 2012, 10:33am UTC](https://discuss.elastic.co/t/percolator-doesnt-match-the-query/7974/4 "2012-06-07T10:33:00Z")

</div>

Hey,

In 0.19.4 we fixed several bugs relating to wrong parsing of percolated  
queries which caused the problem you see now. What happens is that the  
query is indexed before actual types are derived for the specific docs  
(specifically, the fact that price is numeric), so a simple term range  
filter is created for it. This will not match the numeric value. Once a doc  
is percolated, the "price" field type is set to numeric automatically, and  
then when you register the query again, it properly creates the special  
numeric range filter.

We should simplify and handle this case, but at least the above is the  
reasoning for why it happens. You can introduce the mappings when creating  
the index as a workaround.

On Tue, Jun 5, 2012 at 7:32 AM, Andrei Zmievski [andrei@zmievski.org](mailto:andrei@zmievski.org) wrote:

> Just installed 0.19.4 and tried my test that worked in 0.19.0RC3. To  
> illustrate:
> 
> curl -XPUT localhost:9200/shop -d'{ index : { number\_of\_shards : 1,  
> number\_of\_replicas : 0 } }';
> 
> curl -XPUT localhost:9200/\_percolator/shop/andrei -d '{  
> "query" : {  
> "filtered" : {  
> "query" : {  
> "term" : { "type" : "camera" }  
> },  
> "filter" : {  
> "range" : {  
> "price" : { "from": 1, "to" : 200 }  
> }  
> }  
> }  
> }  
> }'
> 
> curl localhost:9200/shop/products/\_percolate -d '{  
> "doc" : {  
> "type" : "camera",  
> "brand": "Nikon",  
> "price": 150  
> }  
> }'
> 
> {"ok":true,"matches":}
> 
> I expected it to match the 'andrei' query. If I PUT the exact same  
> query into the index again (incrementing the version to 2), it starts  
> matching. Anyone else see this?
> 
> Andrei

---

<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 6, 2017, 3:25am UTC](https://discuss.elastic.co/t/percolator-doesnt-match-the-query/7974/5 "2017-07-06T03:25:24Z")

</div>


