# Get Total Sum Bucket without Including All Buckets

**URL:** https://discuss.elastic.co/t/get-total-sum-bucket-without-including-all-buckets/47356
**Category:** Elasticsearch
**Created:** [April 14, 2016, 8:05am UTC](https://discuss.elastic.co/t/get-total-sum-bucket-without-including-all-buckets/47356 "2016-04-14T08:05:55Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Ahmad\_Hayam](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@Ahmad\_Hayam](https://discuss.elastic.co/u/Ahmad_Hayam)
#### Post date: [April 14, 2016, 8:05am UTC](https://discuss.elastic.co/t/get-total-sum-bucket-without-including-all-buckets/47356/1 "2016-04-14T08:05:55Z")

</div>

Can we get sum of original bucket (all aggregation result) data from elasticsearch aggregation without showing all bucket result? I'm using elasticsearch 2.2.

Ex: this is the original result of original query (just to make it simple)  
`{ "bucket": [{ "key": "a", "val": 10 }, { "key": "b", "val": 10 }, { "key": "c", "val": 10 }], "sum_of_val": 30 }`  
And this is what I want  
`{ "bucket": [], "sum_of_val": 50 }`  
Given that the bucket not showing all the results bucket, but sum\_bucket gives the actual sum of result bucket.

I can get the sum of all aggregation, but I need to include all the buckets. This will take a long time to transfer the result, because the result is too big and since my data also big.

---

<div class="post-metadata">

### Author: ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)
#### Post date: [April 14, 2016, 8:46am UTC](https://discuss.elastic.co/t/get-total-sum-bucket-without-including-all-buckets/47356/2 "2016-04-14T08:46:48Z")

</div>

You can you the [response filtering feature](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/common-options.html#_response_filtering) to limit what is sent back to the client, although this won't save any network traffic between the shards and the coordinating node.

---

<div class="post-metadata">

### Author: ![Ahmad\_Hayam](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@Ahmad\_Hayam](https://discuss.elastic.co/u/Ahmad_Hayam)
#### Post date: [April 14, 2016, 3:16pm UTC](https://discuss.elastic.co/t/get-total-sum-bucket-without-including-all-buckets/47356/3 "2016-04-14T15:16:04Z")

</div>

Thanks, that was really helpful, since for now I'm just using single node.

---

<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:59pm UTC](https://discuss.elastic.co/t/get-total-sum-bucket-without-including-all-buckets/47356/4 "2017-07-05T22:59:03Z")

</div>


