Percolator doesn't match the query

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

Can anyone reproduce it?

On Jun 4, 10:32 pm, Andrei Zmievski 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

Hi Andrei

On Thu, Jun 7, 2012 at 10:55 AM, Andrei Zmievski andrei@zmievski.orgwrote:

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 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

--Alexander

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 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