Help with aggregation

suppose we have documents that only have a single entry (uid in form of a
string like "12345678"). Now we can make an aggegation on terms to see how
many of these occur. That is ok. And from that, we would like to know the
distribution of counts of that uid

So the entries are:
... "uid": "1234"
... "uid": "5612"
... "uid": "1234"
... "uid": "9999"
... "uid": "5612"

if we make the aggregation we get:
"1234": 2
"5612": 2
"9999": 1

And the final step is that we would like numbers like:
2: 2 (there are 2 groups with count 2 - "1234" and "5612")
1: 1 (there is 1 group with count 1 - "9999")

How is that possible please?
Thank you!


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
To view this discussion on the web visit
For more options, visit