multi_match 搜索两个字段,交换两个字段值新建一条数据,大家帮忙分析一下为什么评分相差不少
Elasticsearch | 作者 licheng351 | 发布于2021年11月10日 | 阅读数:952
今天又新建了一个索引加两条测试数据,发现评分一致,不知道问题出在哪里了
// 准备数据
// 数据1
PUT /test2021-11-10/_doc/1
{
"name": "测试",
"content": "需要创建知识库"
}
// 数据2
PUT /test2021-11-10/_doc/2
{
"name": "需要创建知识库",
"content": "测试"
}
// 搜索
GET /test2021-11-10/_search/
{
"query": {
"bool": {
"must": {
"multi_match": {
"query": "创建知识",
"fields": [
"name",
"content"
]
}
}
}
}
}
// 搜索结果
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 2,
"relation" : "eq"
},
"max_score" : 2.8597674,
"hits" : [
{
"_index" : "test2021-11-10",
"_type" : "_doc",
"_id" : "1",
"_score" : 2.8597674,
"_source" : {
"name" : "测试",
"content" : "需要创建知识库"
}
},
{
"_index" : "test2021-11-10",
"_type" : "_doc",
"_id" : "2",
"_score" : 1.6669147,
"_source" : {
"name" : "需要创建知识库",
"content" : "测试"
}
}
]
}
}
预期评分应该一样或者接近,为什么差了不少,请大家帮忙分析一下
2 个回复
w_b
赞同来自:
kin122
赞同来自:
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 2,
"relation" : "eq"
},
"max_score" : 1.0892314,
"hits" : [
{
"_index" : "test2021-11-10",
"_type" : "_doc",
"_id" : "1",
"_score" : 1.0892314,
"_source" : {
"name" : "测试",
"content" : "需要创建知识库"
}
},
{
"_index" : "test2021-11-10",
"_type" : "_doc",
"_id" : "2",
"_score" : 1.0892314,
"_source" : {
"name" : "需要创建知识库",
"content" : "测试"
}
}
]
}