es query of suggest in elasticsearch 5.0.1 -


i have question want search result use suggest. type schema this

` {     "name": {         "input": [             "uers1"         ]     },     "usertype": 1 }{     "name": {         "input": [             "uers2"         ]     },     "usertype": 2 }`   

i want search data suggest, query these

`{     "suggest": {         "person_suggest": {             "text": "us",             "completion": {                 "field": "name"             }         }     } }`   

and result these

`{     "_shards": {         "total": 1,         "successful": 1,         "failed": 0     },     "person_suggest": [         {             "text": "word",             "offset": 0,             "length": 4,             "options": [                 {                     "name": "user1",                     "usertype": 1,                     "score": 1                 },                 {                     "text": "user2",                     "usertype": 2,                     "score": 1                 }             ]         }     ] } ` 

but want result usertype = 1, add condition in mysql. body can me ?i want dsl query.thx lot.

you can'nt filter in completion suggest queries. solution problem make different completion fields each usertype or use standard queries ngram analyzers.


Comments

Popular posts from this blog

service - Android MediaPlayer calls onCompletion before it already finished -

javascript - Training Neural Network to play flappy bird with genetic algorithm - Why can't it learn? -

javascript - Create a stacked percentage column -