# How to sub aggregate with 1 depth term aggs's doc\_count?

**URL:** https://discuss.elastic.co/t/how-to-sub-aggregate-with-1-depth-term-aggss-doc-count/21791
**Category:** Elasticsearch
**Created:** [January 23, 2015, 2:07am UTC](https://discuss.elastic.co/t/how-to-sub-aggregate-with-1-depth-term-aggss-doc-count/21791 "2015-01-23T02:07:30Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![no\_jihun](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/no_jihun/32/64028_2.png) [@no\_jihun](https://discuss.elastic.co/u/no_jihun)
#### Post date: [January 23, 2015, 2:07am UTC](https://discuss.elastic.co/t/how-to-sub-aggregate-with-1-depth-term-aggss-doc-count/21791/1 "2015-01-23T02:07:30Z")

</div>

hi.

I have no idea it is possible or not that sub aggregate with parent terms  
aggregation's doc\_count result?

I mean....

there are user visit logs in my index.  
and I wanna know how sum of visiting count distributed.

consider this rows.  
...................  
kim  
kim  
kim  
jane  
jane  
michael  
michael  
...................

in this case my expected result is  
....................  
3:1 \<--- 1 user visited 3 times  
2:2 \<--- 2 user visited 2 times

any advice will appreciate.

thanks in advance 🙂

--  
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/a69541c0-5142-48d4-ad3e-fe5eff1058cc%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a69541c0-5142-48d4-ad3e-fe5eff1058cc%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:37am UTC](https://discuss.elastic.co/t/how-to-sub-aggregate-with-1-depth-term-aggss-doc-count/21791/2 "2017-07-06T00:37:08Z")

</div>


