Hello! I've been losing my mind trying to figure out how to use multiple filters on a query using the Ruby gem for App Search (elastic-enterprise-search).
Reading the docs here:
I'm not seeing any examples using multiple filters.
So let's head here:
Great! Now, I need to do is something like this (JSON):
"filters": {
"all": [
{ "states": ["Washington", "Idaho"] },
{ "world_heritage_site": ["true"] }
]
}
And then convert it to Ruby:
filters: {
all: [
{ state: ['Washington', 'Idaho'] },
{ world_heritage_site: ['true'] }
]
}
But I keep running into an error:
"Filters contains an invalid set of keys for object inside of field: all; can only have clauses or a single field name"
I've tried other variations of the syntax as well:
filters: {
all: {
state: ['Washington', 'Idaho'],
world_heritage_site: ['true']
}
}
No dice. I can just remove either one of the OR's and it'll work:
filters: {
all: {
state: ['Washington', 'Idaho'],
}
}
Or with the other syntax will also work:
filters: {
all: [
{ world_heritage_site: ['true'] }
]
}
But I'll keep getting the above error if I add more than one OR.
I feel like I'm missing something super obvious here and any pointers would be greatly appreciated. Thank you!