07.suggester简述
文章目錄
Suggesters
就是提示詞功能,根據提供的內容朝招相似的
The suggest feature suggests similar looking terms based on a provided text by using a suggester. Parts of the suggest feature are still under development.
The suggest request part is defined alongside the query part in a _search request. If the query part is left out, only suggestions are returned.
_suggest endpoint has been deprecated in favour of using suggest via _search endpoint. In 5.0, the _search endpoint has been optimized for suggest only search requests.
POST twitter/_search {"query" : {"match": {"message": "tring out Elasticsearch"}},"suggest" : {"my-suggestion" : {"text" : "tring out Elasticsearch","term" : {"field" : "message"}}} }Several suggestions can be specified per request. Each suggestion is identified with an arbitrary name. In the example below two suggestions are requested. Both my-suggest-1 and my-suggest-2 suggestions use the term suggester, but have a different text.
一次請求可以有多個suggest
下面的返回體重包括 my-suggest-1 and my-suggest-2, 每個都有自己獨立的結果
返回
每個options數組都包含一個option對象,該option對象包含建議文本,其文檔頻率和與suggest輸入文本相比的得分。分數的含義取決于所使用的suggester。term suggester的得分是基于編輯距離的。
可以在使用多個suggest的時候把suggest text單獨拿出來
POST _search {"suggest": {"text" : "tring out Elasticsearch","my-suggest-1" : {"term" : {"field" : "message"}},"my-suggest-2" : {"term" : {"field" : "user"}}} }The suggest text can in the above example also be specified as suggestion specific option. The suggest text specified on suggestion level override the suggest text on the global level.
總結
以上是生活随笔為你收集整理的07.suggester简述的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 06.search_shard_api操
- 下一篇: 08.suggester02term_s