07.suggester简述
文章目錄
Suggesters
就是提示詞功能,根據(jù)提供的內(nèi)容朝招相似的
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.
一次請(qǐng)求可以有多個(gè)suggest
下面的返回體重包括 my-suggest-1 and my-suggest-2, 每個(gè)都有自己獨(dú)立的結(jié)果
返回
每個(gè)options數(shù)組都包含一個(gè)option對(duì)象,該option對(duì)象包含建議文本,其文檔頻率和與suggest輸入文本相比的得分。分?jǐn)?shù)的含義取決于所使用的suggester。term suggester的得分是基于編輯距離的。
可以在使用多個(gè)suggest的時(shí)候把suggest text單獨(dú)拿出來(lái)
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.
總結(jié)
以上是生活随笔為你收集整理的07.suggester简述的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 06.search_shard_api操
- 下一篇: 08.suggester02term_s