Facets and doing some filtering based on facets

I have a question about facets and doing some filtering based on facets.
i know this is a repeated question but i am unable find the answer.

i would like to know how can i implement the same functionality in elastic search.

lets asume that I have an index about cars and some facets -- eg. model and
color.

color

red (10)

blue (5)

green (2)

model

bmw (4)

vw (5)

ford (8)

if I select a model I would like to get only color facets for that model,
but I still would like to get facets for all models. eg:

color

red (2)

blue (2)

green (1)

model

bmw (4)

vw (5)

ford (8)

I have searched I did not find an example about this use-case. Is this
possible and if yes, how do I filter a query to get these results?

Kind regards

Hey,

this means a more complex query for your aggregations. Basically you need to keep your query the same (to return the documents for Vw as model`), but the aggregation for model cannot have such a filter, where the aggregation for color has to to have that one. Basically each aggregation needs a different filter, which excludes its own filter (for the model agg, you cannot filter by model, but by all other criterias).

hope this helps!

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.