示例查询:
{
"from": 0,
"query": {
"filtered": {
"query": {
"bool": {
"should": [{
"multi_match": {
"fields": ["title", "categories.Name"],
"query": "chinese",
"tie_breaker": 1,
"type": "most_fields"
}
}]
}
}
}
},
"size": 5
}
查询说明:
此查询在字段
title
上执行 multi_match和 categories.Name
.它返回一个分数。
我想要的是:
我想看看分数明细。例如
理想情况下:
{
"_score": 0.3,
"_scoreBreakdown": {
"title": 0.1,
"categories.Name": 0.2
}
}
解释设置的问题
将 explain 设置为 true 的问题是,输出不是机器可读的
"_explanation": {
"value": 1.5284284,
"description": "product of:",
"details": [
{
"value": 4.585285,
"description": "sum of:",
"details": [
{
"value": 4.585285,
"description": "weight(categories.Name:Pizza in 238) [PerFieldSimilarity], result of:",
"details": [
{
"value": 4.585285,
"description": "score(doc=238,freq=1.0), product of:",
"details": [
{
"value": 0.7233293,
"description": "queryWeight, product of:",
"details": [
{
"value": 6.3391395,
"description": "idf(docFreq=2, maxDocs=625)"
},
{
"value": 0.114105284,
"description": "queryNorm"
}
]
},
{
"value": 6.3391395,
"description": "fieldWeight in 238, product of:",
"details": [
{
"value": 1,
"description": "tf(freq=1.0), with freq of:",
"details": [
{
"value": 1,
"description": "termFreq=1.0"
}
]
},
{
"value": 6.3391395,
"description": "idf(docFreq=2, maxDocs=625)"
},
{
"value": 1,
"description": "fieldNorm(doc=238)"
}
]
}
]
}
]
}
]
},
{
"value": 0.33333334,
"description": "coord(1/3)"
}
]
}
所以上面的内容很难分析和分配权重。是否有更机器可读的解释格式?
最佳答案
您可以使用explain API得到这个
关于elasticsearch - 在 Elasticsearch 中的 multi_match 查询中获取分数分割,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38733408/