Suggester(翻译成建议器有点绰,不过很好理解),suggest的特性通过使用建议器suggester推荐给用户正在查找的术语提供基于文本的相似术语term
,当前版本的推荐术语的功能还在开发中,并不是齐全的。其实简单的说就是各个搜索引擎提供的自动补全的功能,在搜索框中输入部分搜索词时,下面就有相关推荐的搜索词,上述推荐搜索的动作就是Suggester的工作,类似于利用百度搜索时输入搜索词下方会有相关词的提示:
suggets请求的一部分是伴随着_search
请求一同定义的。如:
curl -X POST "localhost:9200/twitter/_search" -H 'Content-Type: application/json' -d'
{
"query" : {
"match": {
"message": "tring out Elasticsearch"
}
},
"suggest" : {
"my-suggestion" : {
"text" : "trying out Elasticsearch",
"term" : {
"field" : "message"
}
}
}
}
'
// 结果
{
"took": 22,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 5,
"max_score": 0.5753642,
"hits": [
{
"_index": "twitter",
"_type": "_doc",
"_id": "5",
"_score": 0.5753642,
"_source": {
"user": "kimchy,5",
"likes"