0
是否可以合併兩個不同的bool
過濾器?例如,給定下列文件:將多個應該查詢和必須查詢作爲子查詢
| Name | Location |
|=====================|==========|
| Bordeaux Red Wine | France |
| Bordeaux Red Wine | France |
| Bordeaux White Wine | France |
| Niagara Red Wine | Canada |
| Niagara White Wine | Canada |
| Naples Red Wine | Italy |
| Naples White Wine | Italy |
下面的查詢返回具有更強的重量紅葡萄酒的法國紅葡萄酒:
{
"bool": {
"must": [
{ "term": { "name" : "red" } }
],
"should": [
{ "term": { "location": "France" }},
],
}
}
下面的查詢返回的白葡萄酒具有更強的權重加拿大白葡萄酒:
{
"bool": {
"must": [
{ "term": { "name" : "white" } }
],
"should": [
{ "term": { "location": "Canada" }},
],
}
}
是否有可能交織結果而不運行多個查詢?我期待找到一個將法國白葡萄酒和加拿大紅葡萄酒評分爲1.0,其他法國和加拿大葡萄酒評分爲0.5,意大利葡萄酒評分爲0.0的查詢。