Wildcard Search Issue

Hi ,

A wild card query to return the records matching country is as below :

{
"query":{
"filtered":{
"filter":{
"bool":{
"must":[ {"wildcard":{"Party.country" : "j*"}} ]
} } } }}

This returns Australia and also "United Arab Emirates".
This should only return Australia. Why is it considering Arab has a separate token even though the country field is not_analyzed. Am i doing something wrong?

Pasted the wrong query . The query is :

{
"query":{
"filtered":{
"filter":{
"bool":{
"must":[ {"wildcard":{"Party.country" : "a*"}} ]
} } } }}

Appreciate any help on the same.

Any suggestions?

I suspect it depends on your mapping. The field you are querying is probably analyzed and tokenized on whitespaces, while you may want to use the keyword tokenizer instead but still lowercase it (as a token filter). You can do this using the put mapping api or specify a mapping as part of the create index call if you have one.