【发布时间】:2023-04-07 18:12:01
【问题描述】:
为了简化:
PUT /test/vendors/1
{
"type": "doctor",
"name": "Ron",
"place": "Boston"
}
PUT /test/vendors/2
{
"type": "doctor",
"name": "Tom",
"place": "Boston"
}
PUT /test/vendors/3
{
"type": "doctor",
"name": "Jack",
"place": "San Fran"
}
然后搜索:
GET /test/_search
{
"query": {
"multi_match" : {
"query": "doctor in Boston",
"fields": [ "type", "place" ]
}
}
}
我明白为什么我会找到在旧金山工作的Jack——因为他也是doctor。但是,我不明白为什么比赛得分对他来说是一样的。另外两个也与place 匹配,不是吗?为什么Ron 和Tom 得分不高?
{
"took": 11,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 3,
"max_score": 0.9245277,
"hits": [
{
"_index": "test",
"_type": "vendors",
"_id": "2",
"_score": 0.9245277,
"_source": {
"type": "doctor",
"name": "Tom",
"place": "Boston"
}
},
{
"_index": "test",
"_type": "vendors",
"_id": "1",
"_score": 0.9245277,
"_source": {
"type": "doctor",
"name": "Ron",
"place": "Boston"
}
},
{
"_index": "test",
"_type": "vendors",
"_id": "3",
"_score": 0.9245277,
"_source": {
"type": "doctor",
"name": "Jack",
"place": "San Fran"
}
}
]
}
}
当找到较少的搜索关键字时,有没有办法强制它得分较低?另外,如果我在这种搜索方面走错了路,并且有更好的模式/方式来做这件事——我很高兴能指出正确的方向。
【问题讨论】:
标签: elasticsearch kibana