我正在尝试按必须为空或包含项1
的数组进行过滤。
{
"query": {
"bool": {
"filter": {
"bool": {
"must": [
{
"terms": {
"memberOrganizationFamilyIds": [
1
]
}
}
],"must_not": [
{
"exists": {
"field": "memberOrganizationFamilyIds"
}
}
]
}
}
}
}
}
根据文档,这应该是应该的,但它不起作用。
如果我们应用第一个过滤器,它将起作用。
{
"query": {
"bool": {
"filter": {
"bool": {
"must": [
{
"terms": {
"memberOrganizationFamilyIds": [
1
]
}
}
]
}
}
}
}
}
如果我们应用第二个过滤器,它也将起作用。
{
"query": {
"bool": {
"filter": {
"bool": {
"must_not": [
{
"exists": {
"field": "memberOrganizationFamilyIds"
}
}
]
}
}
}
}
}
但不能在一起。