# Find grand total of documents of the aggregation response

**URL:** https://discuss.elastic.co/t/find-grand-total-of-documents-of-the-aggregation-response/56428
**Category:** Elasticsearch
**Created:** [July 26, 2016, 5:37pm UTC](https://discuss.elastic.co/t/find-grand-total-of-documents-of-the-aggregation-response/56428 "2016-07-26T17:37:59Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Shashi-GS](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@Shashi-GS](https://discuss.elastic.co/u/Shashi-GS)
#### Post date: [July 26, 2016, 5:37pm UTC](https://discuss.elastic.co/t/find-grand-total-of-documents-of-the-aggregation-response/56428/1 "2016-07-26T17:37:59Z")

</div>

Hi All,

Is there any way I can find the grand total of aggregated response documents, tough it shows only 10 records ?

---

<div class="post-metadata">

### Author: ![DiscussBuster](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/discussbuster/32/11042_2.png) [@DiscussBuster](https://discuss.elastic.co/u/DiscussBuster)
#### Post date: [July 27, 2016, 1:59am UTC](https://discuss.elastic.co/t/find-grand-total-of-documents-of-the-aggregation-response/56428/2 "2016-07-27T01:59:51Z")

</div>

Are you talking about [terms aggregations](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html) ?

Please note the inclusion of `sum_other_doc_count` in the response. If you sum this with the doc\_count from all of the buckets, you will have the sum of the _estimates_ of the counts of the docs.

Alternatively, you could just look at `hits.total` for the total matching documents.

---

<div class="post-metadata">

### Author: ![Shashi-GS](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@Shashi-GS](https://discuss.elastic.co/u/Shashi-GS)
#### Post date: [July 27, 2016, 8:33am UTC](https://discuss.elastic.co/t/find-grand-total-of-documents-of-the-aggregation-response/56428/3 "2016-07-27T08:33:14Z")

</div>

Thank you for the response. You are right. but the sum\_other\_doc\_count will show that is, how many documents are considered to do the aggregation. Is there any way I can find the grand total of bucket size, though I mentioned the size as 100. The result should have all the buckets size which was not showing as part of the result.

i.e., The grand total of buckets response size.

---

<div class="post-metadata">

### Author: ![Shashi-GS](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@Shashi-GS](https://discuss.elastic.co/u/Shashi-GS)
#### Post date: [July 27, 2016, 10:23am UTC](https://discuss.elastic.co/t/find-grand-total-of-documents-of-the-aggregation-response/56428/4 "2016-07-27T10:23:51Z")

</div>

This solution will solve my problem. But I am using ES 2.2 version. is there any work around for this solution ?

> <https://github.com/elastic/elasticsearch/pull/19571>

---

<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:32pm UTC](https://discuss.elastic.co/t/find-grand-total-of-documents-of-the-aggregation-response/56428/5 "2017-07-05T22:32:37Z")

</div>


