Elasticsearch: wildcard in query differences : "Alex*" vs "*lex*" -


i have bunch of data indexed using keyword tokenizer.

{     state: open     settings: {         index.number_of_replicas: 0         index.analysis.analyzer.default.type: keyword         index.number_of_shards: 5         index.version.created: 900599     }     mappings: {         evenements: {             properties: {                 prenom: {                     type: string                 }                 nom: {                     type: string                 }                 statut: {                     type: string                 }                 fielddate: {                     format: dateoptionaltime                     type: date                 }             }         }     } } 

when querying

{   "query": {     "bool": {       "must": [         {           "query_string": {             "default_field": "evenements.prenom",             "query": "*lex*"           }         }       ]     }   } } 

i results, when querying

{   "query": {     "bool": {       "must": [         {           "query_string": {             "default_field": "evenements.prenom",             "query": "alex*"           }         }       ]     }   } } 

i no results (a ou instead of first * not change anything).

any explanation ?

thanks. yann

try set lowercase_expanded_terms property of query string false. default property set true , can cause behaviour having.

{   "query": {     "bool": {       "must": [         {           "query_string": {             "lowercase_expanded_terms": false,             "default_field": "evenements.prenom",             "query": "alex*"           }         }       ]     }   } } 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -