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的查询。