Can't create the correct filter for my elasticsearch query -


i've problem set correct filter. query looks this:

{     "query" : {         "bool" : {             "must" : [                 {                     "query_string" : {                         "query" : "example~",                         "analyzer" : "standard",                         "default_operator" : "or",                         "fuzziness" : "auto"                     }                 },                 {                     "term" : {                         "client" : {                             "value" : "myclient",                             "boost" : 1                         }                     }                 },                 {                     "range" : {                         "datecreate" : {                             "gte" : "2016-01-01t00:00:00+0200",                             "lte" : "2016-12-31t23:59:59+0200"                         }                     }                 },                 {                     "match" : {                         "lang" : "php or java"                     }                 }             ]         }     },     "size" : 10,     "from" : 0,     "sort" : [         {             "_score" : {                 "order" : "desc"             }         }     ] } 

the "lang" field of type text.
expectation documents given query string , want select documents have "php" or "java" in lang field. lang fields contain either "php" or "java" never both strings thought using exact matching can't got work.
result list of 2 documents total_count=2510.

one of documents doesn't match:

{   "id" : "d3295f18-a033-4934-941a-21a8bef901e8",   "client" : "myclient",   "lang" : "php",   "author" : null,   "datecreate" : "2016-03-31t00:00:00+0200",   "title" : "sample document",   "content" : "this short text describing deocument." } 

yes, client field of type text.

client field must either of keyword type use term query or change query client term match:

{     "match" : {         "client" : {             "query" : "myclient",             "boost" : 1         }     } } 

Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -