【发布时间】:2021-03-04 22:35:17
【问题描述】:
我的目标:为 index1 返回 15 个结果,为其他索引返回 10 个结果
我的问题:由于“hotel_name”是最重要的字段,并且它只存在于第一个索引中,因此根据查询,响应只有来自 index1 的数据
请求 URL: "/index1,index2,index3/_search?size=25"
{
"query": {
"multi_match": {
"query": "hotel",
"type": "phrase_prefix",
"fields": [
"hotel_name^9",
"country^8",
"city^7",
"destination^6",
"state^5",
"zone^4",
"title^3",
"description_short^2",
"description^1"
]
}
}
}
编辑: @llermaly 回答后解决:
发帖请求:http://127.0.0.1:9200/_msearch
请求负载:
{"index":"index_1"}
{"size":30,"query":{"multi_match":{"query":"hotel","type":"phrase_prefix","fields":["hotel_name^8","country^7","city^6","destination^5","state^4","zone^3","description_short^2","description^1"]}}}
{"index":"index_2,index_2,index_3"}
{"size":10,"query":{"multi_match":{"query":"hotel","type":"phrase_prefix","fields":["country^8","city^7","destination^6","state^5","zone^4","title^3","description_short^2","description^1"]}}}
【问题讨论】:
标签: elasticsearch