Percolator issue?


(asanderson) #1

Greetings!

I just started evaluating ElasticSearch 0.16.2 as a possible Solr
replacement, so I'm a newbie.

I tried the percolator example and it worked, but then I tried a
slightly modified example and got no matches.

My slightly modified example was the following:

curl -XPUT localhost:9200/test
{"ok":true,"acknowledged":true}

curl -XPUT localhost:9200/_percolator/test/surname -d '{"query":
{"term":{"surname":"Smith"}}}'
{"ok":true,"_index":"_percolator","_type":"test","_id":"surname","_version":
1}

curl -XGET localhost:9200/test/person/_percolate -d '{"doc":
{"surname":"Smith"}}'
{"ok":true,"matches":[]}

java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)

uname -a
Linux ubuntu-tcs4 2.6.35-22-generic #35-Ubuntu SMP Sat Oct 16 20:45:36
UTC 2010 x86_64 GNU/Linux

I must be doing something wrong or misunderstand how it works.

Please advise.

Thanks!

Steve


(Igor Motov) #2

Steve,

The term "Smith" is not analyzed in your percolator query but
it's analyzed in your document (converted to smith). Therefore
your percolator query doesn't match your document. The simplest way to fix
it is by changing your query to analyzed version (basically use text instead
of term):

curl -XPUT localhost:9200/_percolator/test/surname -d '{"query":
{"text":{"surname":"Smith"}}}'

Igor

On Fri, Jun 10, 2011 at 11:01 AM, asanderson a.steven.anderson@gmail.comwrote:

Greetings!

I just started evaluating ElasticSearch 0.16.2 as a possible Solr
replacement, so I'm a newbie.

I tried the percolator example and it worked, but then I tried a
slightly modified example and got no matches.

My slightly modified example was the following:

curl -XPUT localhost:9200/test
{"ok":true,"acknowledged":true}

curl -XPUT localhost:9200/_percolator/test/surname -d '{"query":
{"term":{"surname":"Smith"}}}'

{"ok":true,"_index":"_percolator","_type":"test","_id":"surname","_version":
1}

curl -XGET localhost:9200/test/person/_percolate -d '{"doc":
{"surname":"Smith"}}'
{"ok":true,"matches":[]}

java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)

uname -a
Linux ubuntu-tcs4 2.6.35-22-generic #35-Ubuntu SMP Sat Oct 16 20:45:36
UTC 2010 x86_64 GNU/Linux

I must be doing something wrong or misunderstand how it works.

Please advise.

Thanks!

Steve


(asanderson) #3

The term "Smith" is not analyzed in your percolator query but
it's analyzed in your document (converted to smith). Therefore
your percolator query doesn't match your document. The simplest way to fix
it is by changing your query to analyzed version (basically use text instead
of term):

curl -XPUT localhost:9200/_percolator/test/surname -d '{"query":
{"text":{"surname":"Smith"}}}'

Ahhh...I knew there had to be something simple that I was missing.

Thanks!

Steve


(system) #4