# Aggregating doc\_count

**URL:** https://discuss.elastic.co/t/aggregating-doc-count/21790
**Category:** Elasticsearch
**Created:** [January 23, 2015, 12:22am UTC](https://discuss.elastic.co/t/aggregating-doc-count/21790 "2015-01-23T00:22:58Z")
**Posts on this page:** 4
**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, 12:22am UTC](https://discuss.elastic.co/t/aggregating-doc-count/21790/1 "2015-01-23T00:22:58Z")

</div>

hi.

is it possible 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

it seems not easy..

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/6f62f12f-4823-41cc-89f9-3b54c9b4f923%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6f62f12f-4823-41cc-89f9-3b54c9b4f923%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![panda2004](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/panda2004/32/19473_2.png) [@panda2004](https://discuss.elastic.co/u/panda2004)
#### Post date: [May 6, 2017, 1:16am UTC](https://discuss.elastic.co/t/aggregating-doc-count/21790/2 "2017-05-06T01:16:06Z")

</div>

I have a similar problem. Do you have any insights so far?

---

<div class="post-metadata">

### Author: ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)
#### Post date: [May 6, 2017, 4:29pm UTC](https://discuss.elastic.co/t/aggregating-doc-count/21790/3 "2017-05-06T16:29:58Z")

</div>

These sorts of person-behaviour questions on event-centric indexes are killers. See the reasons why and the entity-centric index solution here: [https://youtu.be/yBf7oeJKH2Y](https://youtu.be/yBf7oeJKH2Y)

---

<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 5, 2017, 10:00pm UTC](https://discuss.elastic.co/t/aggregating-doc-count/21790/4 "2017-07-05T22:00:31Z")

</div>


