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

vue.js - Create hooks for automated testing -

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

serial port - hub4com OVERRUN Error -