Get top hits aggregation without aggregating on all values


Based on the documentation top aggregations can be used as a sub aggregator.

Maybe I can achieve it in a different way but my use case is:
I have the following structure:

    name: "x"

I basically need to get the top 10 document based on the name field.
The problem is that I have 100M documents, and possible 100K values for the name field.
From what I understand, this is not a good use case for ES, because running an aggregation with more then tens of thousands buckets will not have good performance, and will take a lot in terms of resources from the cluster.

To sum it up. I just need the topX documents based on a field with many possible values.

Is there a "good" way to achieve this?
Is my assumption regards the number of buckets is wrong?


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