【发布时间】:2017-09-22 19:47:51
【问题描述】:
我正在尝试弄清楚 ElasticSearch 在按分数对结果进行排名时使用的逻辑。
我总共有 4 个索引。我正在查询一个术语的所有索引。我正在使用的查询如下-
GET /_all/static/_search
{
"query": {
"match": {
"name": "chinese"
}
}
}
我得到的(部分)响应如下-
{
"took": 17,
"timed_out": false,
"_shards": {
"total": 40,
"successful": 40,
"failed": 0
},
"hits": {
"total": 6,
"max_score": 2.96844,
"hits": [
{
"_shard": 1,
"_node": "Hz9L2DZ-ShSajaNvoyU8Eg",
"_index": "restaurant",
"_type": "static",
"_id": "XecLkyYNQWihuR2atFc5JQ",
"_score": 2.96844,
"_source": {
"name": "Just Chinese"
},
"_explanation": {
"value": 2.96844,
"description": "weight(name:chinese in 1) [PerFieldSimilarity], result of:",
"details": [
{
"value": 2.96844,
"description": "fieldWeight in 1, product of:",
"details": [
{
"value": 1,
"description": "tf(freq=1.0), with freq of:",
"details": [
{
"value": 1,
"description": "termFreq=1.0"
}
]
},
{
"value": 4.749504,
"description": "idf(docFreq=3, maxDocs=170)"
},
{
"value": 0.625,
"description": "fieldNorm(doc=1)"
}
]
}
]
}
},
{
"_shard": 1,
"_node": "Hz9L2DZ-ShSajaNvoyU8Eg",
"_index": "restaurant",
"_type": "static",
"_id": "IAUpkC55ReySjvl9Xr5MVw",
"_score": 2.96844,
"_source": {
"name": "The Chinese Hut"
},
"_explanation": {
"value": 2.96844,
"description": "weight(name:chinese in 5) [PerFieldSimilarity], result of:",
"details": [
{
"value": 2.96844,
"description": "fieldWeight in 5, product of:",
"details": [
{
"value": 1,
"description": "tf(freq=1.0), with freq of:",
"details": [
{
"value": 1,
"description": "termFreq=1.0"
}
]
},
{
"value": 4.749504,
"description": "idf(docFreq=3, maxDocs=170)"
},
{
"value": 0.625,
"description": "fieldNorm(doc=5)"
}
]
}
]
}
},
{
"_shard": 2,
"_node": "Hz9L2DZ-ShSajaNvoyU8Eg",
"_index": "cuisine",
"_type": "static",
"_id": "6",
"_score": 2.7047482,
"_source": {
"name": "Chinese"
},
"_explanation": {
"value": 2.7047482,
"description": "weight(name:chinese in 1) [PerFieldSimilarity], result of:",
"details": [
{
"value": 2.7047482,
"description": "fieldWeight in 1, product of:",
"details": [
{
"value": 1,
"description": "tf(freq=1.0), with freq of:",
"details": [
{
"value": 1,
"description": "termFreq=1.0"
}
]
},
{
"value": 2.7047482,
"description": "idf(docFreq=1, maxDocs=11)"
},
{
"value": 1,
"description": "fieldNorm(doc=1)"
}
]
}
]
}
},
我的问题是-我知道 elasticsearch 以更高的分数处理较小的值,那么为什么餐厅索引中的“Just Chinese”和“The Chinese Hut”之类的结果排名高于预期的最佳匹配“chinese”从美食指数?据我所知,在将这些文档插入索引时,我没有使用任何特殊的分析器或任何东西。一切都是默认的。
我缺少什么以及如何获得预期的结果?
【问题讨论】:
标签: elasticsearch indexing nosql