Query and return up to n results based on a type field


I have a datamodel with different object types in the same index. These are simply distinguished by a field I have called "type".

I would like to do a "all in one query" within each of these types, giving me the top, lets say 10 most relevant results for each (if as many as 10 exists for any given type).
(My scenario is a composite autocomplete search)

How should I approach this?
I have been thinking of using the multi search api. Would this be the way to go?
Are there other recommended approaches?

So far I have tried to just search without any filtering with multi match, but I often end up with 10 of just the same type, or a few different types, because they happen to be the most relevant.

_msearch would work, just do one for each of your types.

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