Conditionally Filtering

I’m trying to return a subset of our index based on a few fields.

I’m using the Configure component with the filter prop to control my returned hits

Each object has the following properties:

stage
type
countryCode

I need to show all results that have a certain stage e.g. stage ‘live’

But I need to exclude results of a certain ‘type’ that aren’t of a provided ‘countryCode’

e.g. exclude all type ‘watches’ not in ‘AU’ countryCode. One problem as I see it is that if the example

type:watches
countryCode:AU

had the stage of live it would still be a returned hit which I need to prevent.

To complicate matters further I need a mechanism to remove the exclusion of of these hits should the user wish to see the full returned results free of the exclusion.

1 Like

The typical approach here would be to separate out stages into their own indices: