Incorrect prefix query results

prefix query is not returning the correct results..
in ISO Country data.. my query was

{"query":{"bool":{"must":[{"prefix":{"country.name":"in"}}],"must_not":[],"should":[]}},"from":0,"size":50,"sort":[],"facets":{}}
and the returned result is:
{ took: 3 timed_out: false _shards: { total: 5 successful: 5 failed: 0 }
hits: { total: 3 max_score: 1 hits: [ { _index: restdb _type: country _id:
sX3-aNGBQaOjo-L7zNj7qQ _score: 1_source: { id: 519fcbce820ea8950373612b code
: ID name: INDONESIA } }{ _index: restdb _type: country _id:
YMXpIxaPRzmkMZqaKQ36pw _score: 1_source: { id: 519fcbce820ea895037360e4 code
: IO name: BRITISH INDIAN OCEAN TERRITORY }}{ _index: restdb _type:
country _id: Ok9MHCr4RLqjH6oFLX92EA _score: 1_source: { id:
519fcbce820ea8950373612a code: IN name: INDIA }}
] } }

As, you can see, red coloured data, is not matching prefix query..
Am i correct i need to do something else.., if not please help me to find
out correct way to do so, else, give me go ahead, to post this as bug.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Because your field is analyzed and broken into token.
So, country.name is indexed as: british,indian,ocean,territory

indian match the PrefixQuery in.

If you set this field to not_analyzed then, you will have to search for IN (uppercase).

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 28 mai 2013 à 11:48, abhishek.pandey@greenclouds.in a écrit :

prefix query is not returning the correct results..
in ISO Country data.. my query was

{"query":{"bool":{"must":[{"prefix":{"country.name":"in"}}],"must_not":[],"should":[]}},"from":0,"size":50,"sort":[],"facets":{}}

and the returned result is:
{ took: 3 timed_out: false _shards: { total: 5 successful: 5 failed: 0 } hits: { total: 3 max_score: 1 hits: [ { _index: restdb _type: country _id: sX3-aNGBQaOjo-L7zNj7qQ _score: 1_source: { id: 519fcbce820ea8950373612b code: ID name: INDONESIA } }{ _index: restdb _type: country _id: YMXpIxaPRzmkMZqaKQ36pw _score: 1_source: { id: 519fcbce820ea895037360e4 code: IO name: BRITISH INDIAN OCEAN TERRITORY }}{ _index: restdb _type: country _id: Ok9MHCr4RLqjH6oFLX92EA _score: 1_source: { id: 519fcbce820ea8950373612a code: IN name: INDIA }}
] } }

As, you can see, red coloured data, is not matching prefix query..
Am i correct i need to do something else.., if not please help me to find out correct way to do so, else, give me go ahead, to post this as bug.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.