Get Total Sum Bucket without Including All Buckets

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.

You can you the response filtering feature to limit what is sent back to the client, although this won't save any network traffic between the shards and the coordinating node.

1 Like

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