Support "any" filters at top level
See original GitHub issueUse case: Searching for “parks” which are in “California” OR are “World Heritage Sites”
This is currently not possible. The following actions:
addFilter("states", "California", "any")
addFilter("states", "Alaska", "any")
addFilter("world_heritage_site", "true", "any")
Would result in the query:
"filters": {
"all": [
{
"any": [
{ "states": "California" },
{ "states": "Alaska" }
]
},
{
"any": [
{ "world_heritage_site": "true" }
]
}
]
}
Currently, the “any” parameter affects the relation of a filter to other filters on the same field, NOT the relation to other fields, which is that top level “all”.
We could provide a second parameter to choose “all” or “any” at the top level:
addFilter("states", "California", "any", "any")
addFilter("states", "Alaska", "any", "any")
addFilter("world_heritage_site", "true", "any")
"filters": {
"any": [
{
"any": [
{ "states": "California" },
{ "states": "Alaska" }
]
},
{
"any": [
{ "world_heritage_site": "true" }
]
}
]
}
A real world use case for this:
Like while checking package delivery availability one person might want to see if the delivery is available at Office Address OR Home Address
There could be other solutions for this, but this is my current proposal.
In the meantime, users can work around this bye programatically changing the outbound API request: https://github.com/elastic/search-ui/blob/master/ADVANCED.md#api-config
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:17 (12 by maintainers)
Hey! Would love to help you out, not sure how soon we can get to this, unfortunately.
As mentioned above, How can we work on it by programatically changing the outbound API request to support or fileter (https://github.com/elastic/search-ui/blob/master/ADVANCED.md#api-config)? I am desperate for this feature, can somebody save my world?