jamal

es建议查询

好久不见. 提交于 2020-05-03 15:38:40
  在输入的时候,都会给用户一个建议。 1.es中有三种建议器   Term suggester   Phrase suggester   Completion suggester 2.字段    3.Term suggester   term 词条建议器,对给输⼊的⽂本进⾏分词,为每个分词提供词项建议 POST /nba_lastest/_search { "suggest": { "my-suggester": { "text": "Stev", "term": { "suggest_mode": "missing", "field": "displayNameEn" } } } }   效果: { "took" : 5, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "skipped" : 0, "failed" : 0 }, "hits" : { "total" : { "value" : 0, "relation" : "eq" }, "max_score" : null, "hits" : [ ] }, "suggest" : { "my-suggester" : [ { "text" : "stev", "offset" : 0, "length" : 4, "options" :