日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

07.suggester简述

發布時間:2024/2/28 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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

POST _search {"suggest": {"my-suggest-1" : {"text" : "tring out Elasticsearch","term" : {"field" : "message"}},"my-suggest-2" : {"text" : "kmichy","term" : {"field" : "user"}}} }

下面的返回體重包括 my-suggest-1 and my-suggest-2, 每個都有自己獨立的結果
返回

{"_shards": ..."hits": ..."took": 2,"timed_out": false,"suggest": {"my-suggest-1": [ {"text": "tring","offset": 0,"length": 5,"options": [ {"text": "trying", "score": 0.8, "freq": 1 } ]}, {"text": "out","offset": 6,"length": 3,"options": []}, {"text": "elasticsearch","offset": 10,"length": 13,"options": []} ],"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简述的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。