17.explain_api
文章目錄
explain api非常有用,一般情況下業(yè)務(wù)人員如果反饋排序?yàn)槭裁床皇穷A(yù)期的樣子,如果你使用了es來(lái)做排序的話,那么就需要使用它的explain功能來(lái)做深度問(wèn)題排查了
這個(gè)explain會(huì)給出打分的具體原因,當(dāng)然,你要稍微熟悉一下es的默認(rèn)的打分算法BM25
使用
GET /twitter/_explain/0 {"query" : {"match" : { "message" : "elasticsearch" }} }返回樣例
{"_index":"twitter","_type":"_doc","_id":"0","matched":true,"explanation":{"value":1.6943597,"description":"weight(message:elasticsearch in 0) [PerFieldSimilarity], result of:","details":[{"value":1.6943597,"description":"score(freq=1.0), product of:","details":[{"value":2.2,"description":"boost","details":[]},{"value":1.3862944,"description":"idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:","details":[{"value":1,"description":"n, number of documents containing term","details":[]},{"value":5,"description":"N, total number of documents with field","details":[]}]},{"value":0.5555555,"description":"tf, computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:","details":[{"value":1.0,"description":"freq, occurrences of term within document","details":[]},{"value":1.2,"description":"k1, term saturation parameter","details":[]},{"value":0.75,"description":"b, length normalization parameter","details":[]},{"value":3.0,"description":"dl, length of field","details":[]},{"value":5.4,"description":"avgdl, average length of field","details":[]}]}]}]} }可以帶的參數(shù)
_source
設(shè)置為true以返回文檔的_source。您還可以使用_source_includes和_source_excludes來(lái)檢索文檔的一部分(有關(guān)更多詳細(xì)信息,請(qǐng)參見(jiàn)獲取API)
stored_fields
返回哪些stored_fields
routing
如果在索引編制過(guò)程中使用了路由,則控制路由。
parent
與設(shè)置路由參數(shù)相同。
preference
控制對(duì)解釋執(zhí)行的分片。
source
允許將請(qǐng)求的數(shù)據(jù)放入url的查詢字符串中。
q
查詢字符串(映射到query_string查詢)。
df
在查詢中未定義任何字段前綴時(shí)使用的默認(rèn)字段。
analyzer
分析查詢字符串時(shí)要使用的分析器名稱(chēng)。默認(rèn)為默認(rèn)搜索分析器。
analytics_wildcard
是否應(yīng)分析通配符和前綴查詢。默認(rèn)為false。
lenient
如果設(shè)置為true,將導(dǎo)致忽略基于格式的錯(cuò)誤(例如,向數(shù)字字段提供文本)。默認(rèn)為false。
default_operator
要使用的默認(rèn)運(yùn)算符可以是AND或OR。默認(rèn)為OR。
總結(jié)
以上是生活随笔為你收集整理的17.explain_api的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 16.validate_api
- 下一篇: 18.fields_capabiliti