# Help with aggregation

**URL:** <https://discuss.elastic.co/t/help-with-aggregation/22450>\
**Category:** Elasticsearch\
**Created:** [February 28, 2015, 11:25am UTC](https://discuss.elastic.co/t/help-with-aggregation/22450 "2015-02-28T11:25:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomas\_mozes](https://avatars.discourse-cdn.com/v4/letter/t/f19dbf/32.png) [@tomas\_mozes](https://discuss.elastic.co/u/tomas_mozes)\
**Post date:** [February 28, 2015, 11:25am UTC](https://discuss.elastic.co/t/help-with-aggregation/22450/1 "2015-02-28T11:25:12Z")

</div>

Hello,  
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!

Tomas

--  
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 [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a25ca9cb-54f9-47c1-ab02-0b17a95a89f0%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a25ca9cb-54f9-47c1-ab02-0b17a95a89f0%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:29am UTC](https://discuss.elastic.co/t/help-with-aggregation/22450/2 "2017-07-06T00:29:16Z")

</div>


