【发布时间】:2018-09-06 07:25:18
【问题描述】:
我正在尝试了解弹性文档中的解释 API 评分: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html
当我无法通过仅包含几个文档的简单索引来计算时,我尝试在上述文档页面上重现计算。
在示例中,它显示的“值”为 1.3862944,描述为:“idf,计算为 log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5))”。在“详细信息”下,它为字段提供以下值: docFreq: 1.0, docCount: 5.0
使用提供的 docFreq 和 docCount 值,我计算为:log(1 + (5.0 - 1.0 + 0.5) / (1.0 + 0.5)) = 0.602,这与示例中的 1.3862944 不同。
我找不到任何匹配的值。
我是不是看错了?
以下是全文
GET /twitter/_doc/0/_explain
{
"query" : {
"match" : { "message" : "elasticsearch" }
}
}
这将产生以下结果:
{
"_index": "twitter",
"_type": "_doc",
"_id": "0",
"matched": true,
"explanation": {
"value": 1.6943599,
"description": "weight(message:elasticsearch in 0) [PerFieldSimilarity], result of:",
"details": [
{
"value": 1.6943599,
"description": "score(doc=0,freq=1.0 = termFreq=1.0\n), product of:",
"details": [
{
"value": 1.3862944, <== This is the one I am trying
"description": "idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from:",
"details": [
{
"value": 1.0,
"description": "docFreq",
"details": []
},
{
"value": 5.0,
"description": "docCount",
"details": []
}
]
},
{
"value": 1.2222223,
"description": "tfNorm, computed as (freq * (k1 + 1)) / (freq + k1 * (1 - b + b * fieldLength / avgFieldLength)) from:",
"details": [
{
"value": 1.0,
"description": "termFreq=1.0",
"details": []
},
{
"value": 1.2,
"description": "parameter k1",
"details": []
},
{
"value": 0.75,
"description": "parameter b",
"details": []
},
{
"value": 5.4,
"description": "avgFieldLength",
"details": []
},
{
"value": 3.0,
"description": "fieldLength",
"details": []
}
]
}
]
}
]
}
}
【问题讨论】:
标签: elasticsearch explain