# How can I aggregation by \_count

**URL:** <https://discuss.elastic.co/t/how-can-i-aggregation-by-count/142314>\
**Category:** Elasticsearch\
**Created:** [July 31, 2018, 8:56am UTC](https://discuss.elastic.co/t/how-can-i-aggregation-by-count/142314 "2018-07-31T08:56:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![RubinX](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@RubinX](https://discuss.elastic.co/u/RubinX)\
**Post date:** [July 31, 2018, 8:56am UTC](https://discuss.elastic.co/t/how-can-i-aggregation-by-count/142314/1 "2018-07-31T08:56:54Z")

</div>

I have some data like these:  
UID ---------------------- other terms i don not care  
1001---------------------- ...  
1001---------------------- ...  
1001---------------------- ...  
1002---------------------- ...  
1002---------------------- ...  
1003 ---------------------- ...

then I aggregation by UID,so i get this:  
uid ------------------------------------------Count  
1001--------------------------------------------3  
1002--------------------------------------------2  
1003--------------------------------------------1

How can i get this:  
count range----------------------uid count  
0\<count\<=2----------------------2  
3\<count\<5 ----------------------1

---

<div class="post-metadata">

**Author:** ![RubinX](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@RubinX](https://discuss.elastic.co/u/RubinX)\
**Post date:** [August 1, 2018, 6:09am UTC](https://discuss.elastic.co/t/how-can-i-aggregation-by-count/142314/2 "2018-08-01T06:09:08Z")

</div>

Elastic don not surpport this ?

---

<div class="post-metadata">

**Author:** ![RubinX](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@RubinX](https://discuss.elastic.co/u/RubinX)\
**Post date:** [August 2, 2018, 7:25am UTC](https://discuss.elastic.co/t/how-can-i-aggregation-by-count/142314/3 "2018-08-02T07:25:59Z")

</div>

> <https://github.com/elastic/elasticsearch/issues/17590>

---

<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:** [August 30, 2018, 7:26am UTC](https://discuss.elastic.co/t/how-can-i-aggregation-by-count/142314/4 "2018-08-30T07:26:07Z")

</div>

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