我有两个索引index1和index2,并且在弹性搜索中都有两个类型type1和type2具有相同的名称.(请假设我们背后有有效的商业原因)
我想搜索index1 - type1和index2 -type2
这是我的查询
POST _search
{
"query": {
"indices": {
"indices": ["index1","index2"],
"query": {
"filtered":{
"query":{
"multi_match": {
"query": "test",
"type": "cross_fields",
"fields": ["_all"]
}
},
"filter":{
"or":{
"filters":[
{
"terms":{
"_index":["index1"], // how can i make this work?
"_type": ["type1"]
}
},
{
"terms":{
"_index":["index2"], // how can i make this work?
"_type": ["type2"]
}
}
]
}
}
}
},
"no_match_query":"none"
}
}
}
Run Code Online (Sandbox Code Playgroud)