Database 组合2个弹性搜索查询
我有两个Database 组合2个弹性搜索查询,database,elasticsearch,lucene,Database,elasticsearch,Lucene,我有两个功能评分查询 第一个,我运行的景点类型 { "query": { "function_score": { "query": { "nested": { "path": "translations", "query": { "multi_match": { "query": "Text to search", "type": "be
功能评分查询
第一个,我运行的景点
类型
{
"query": {
"function_score": {
"query": {
"nested": {
"path": "translations",
"query": {
"multi_match": {
"query": "Text to search",
"type": "best_fields",
"fields": [
"title^3",
"description"
]
}
}
}
},
"functions": [
{
"filter": {
"term": {
"cityId": 3
}
},
"weight": 100
}
],
"score_mode": "multiply"
}
}
}
{
"query": {
"function_score": {
"query": {
"multi_match": {
"query": "Text to search",
"type": "best_fields",
"fields": [
"name^3",
"description"
]
}
},
"functions": [
{
"filter": {
"term": {
"cityId": 1
}
},
"weight": 100
}
],
"score_mode": "multiply"
}
}
}
还有第二个,我在比萨店经营
{
"query": {
"function_score": {
"query": {
"nested": {
"path": "translations",
"query": {
"multi_match": {
"query": "Text to search",
"type": "best_fields",
"fields": [
"title^3",
"description"
]
}
}
}
},
"functions": [
{
"filter": {
"term": {
"cityId": 3
}
},
"weight": 100
}
],
"score_mode": "multiply"
}
}
}
{
"query": {
"function_score": {
"query": {
"multi_match": {
"query": "Text to search",
"type": "best_fields",
"fields": [
"name^3",
"description"
]
}
},
"functions": [
{
"filter": {
"term": {
"cityId": 1
}
},
"weight": 100
}
],
"score_mode": "multiply"
}
}
}
它们都很好用。我知道我想用一个查询搜索这两种类型,但我不知道如何“合并”这两个查询
我想这样做是因为我想让2类型中的元素按相同的分数排序
这可能吗?我该怎么做 您可以使用多搜索API将查询合并为一个查询:
这不是我想要的。我想搜索2个索引,并得到按分数排序的结果。