0
我想做一个布尔查询与多个必须/应该在另一个布尔查询内获得嵌套的AND/OR查询字符串,如下面的查询。在elasticsearch的另一个布尔查询中执行嵌套布尔查询
{
"query": {
"bool": {
"should": [
**// SHOULD BLOCK 1**
{
<should_query_1>
},
**// SHOULD BLOCK 2**
{
<should_query_2>
},
**// SHOULD BLOCK 3**
{
"bool": {
"must": [
<should_level_2_MUST_query_1>,
<should_level_2_MUST_query_2>,
{
"bool": {
"must": [
<should_level_3_MUST_query_1>,
<should_level_3_MUST_query_2>,
]
}
}
]
}
},
**// SHOULD BLOCK 4**
{
"bool": {
"must": [
<should_MUST_query_1>,
<should_MUST_query_2>
]
}
}
]
}
},
"size": 25,
"from": 0,
"fields": []
}
预期的行为是,我想应该块1,2,3,4“或运算和内‘应该阻止3’我希望‘Should_level_2_MUST_queries’是” AND后。
但在现实中,当我使用这个语法应块3 & 4“的第一级相与本身并保存执行结果的块1 & 2.请帮我重新整理/重写此查询为我实现预期的行为。
在此先感谢
谢谢你今天会试试 – Baaju