How do I compute bucket size distribution?

I'd like to group documents by a field (cluster_id) and find the distribution of group sizes
Ex:
200 groups have size 1
150 have size 2
...
50 have size 30
I tried with

{
"size": 0,
"aggs" : {
"clusters": { "terms" : { "field": "selection.cluster_id", "size": 1000 } },
"stats_cluster": {
"stats_bucket": { "buckets_path": "clusters>_count" }
}
}
}

but selection.cluster_id cardinality is 3M, and don't need the huge bucket list in the result

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