亲,只收二进制

多个should并列的查询ElasticSearch怎么写

匿名 | 发布于2020年09月01日 | 阅读数:3922

有a,b,c,d四个参数,每个参数对应一个条件,a条件和b条件是or的关系,c条件和d条件是or的关系,但是(a,b)和(c,d)之间是and的关系,如(a = 1 or b > 1) and (c = 1 or d > 1) 这种,哪位大佬支支招
已邀请:

brukfeng

赞同来自:

{
"query": {
"bool": {
"must": [
{
"bool": {
"should": [
{
a = 1
},
{
b>1
}
]
}
},
{
"bool": {
"should": [
{
c = 1
},
{
d>1
}
]
}
}
]
}
}
}

Dramecj

赞同来自:

a,b用一个bool,之间用should,c和d用一个bool,之间用shoud。
外层用一个bool,must连接上面两个结果集

要回复问题请先登录注册