Getting top 1 result for each filter


My problem is very simple.

I have products, each with a lot of attributes including the name and the

I want to get the #1 match for a string query in each category without
doing one query by category.

Unfortunately filters facets only return count, so is there a way to do
something like :

-> Get results for my query (string)
-> For each category, apply a filter on these results and returns the #1

I've been thinking about using facets filters but it would force me to put
a term facet for each category, which seems to be the same thing as
querying separately for each cat.

Thank you for your help,

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit