I'm trying to filter by an array that must be either empty or contain the item 1.
{
"query": {
"bool": {
"filter": {
"bool": {
"must": [
{
"terms": {
"memberOrganizationFamilyIds": [
1
]
}
}
],
"must_not": [
{
"exists": {
"field": "memberOrganizationFamilyIds"
}
}
]
}
}
}
}
}
According to the docs this is how it should be but it isn't working.
If we apply the first filter it works.
{
"query": {
"bool": {
"filter": {
"bool": {
"must": [
{
"terms": {
"memberOrganizationFamilyIds": [
1
]
}
}
]
}
}
}
}
}
If we apply the second filter it also works.
{
"query": {
"bool": {
"filter": {
"bool": {
"must_not": [
{
"exists": {
"field": "memberOrganizationFamilyIds"
}
}
]
}
}
}
}
}
But not together.