# Aggregation sum for all keys within field

**URL:** <https://discuss.elastic.co/t/aggregation-sum-for-all-keys-within-field/204345>\
**Category:** Elasticsearch\
**Created:** [October 20, 2019, 9:53am UTC](https://discuss.elastic.co/t/aggregation-sum-for-all-keys-within-field/204345 "2019-10-20T09:53:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hammad\_Ali\_Khan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hammad_ali_khan/32/46028_2.png) [@Hammad\_Ali\_Khan](https://discuss.elastic.co/u/Hammad_Ali_Khan)\
**Post date:** [October 20, 2019, 9:53am UTC](https://discuss.elastic.co/t/aggregation-sum-for-all-keys-within-field/204345/1 "2019-10-20T09:53:39Z")

</div>

Hi there,  
Just curious if there is a better way for aggregation sum for a structure like this  
{  
"combiner\_energy" : {  
"INV1-CB1-kWh" : 121.15685325833331,  
"INV1-CB2-kWh" : 126.64289340000002,  
"INV1-CB3-kWh" : 111.27520979999998,  
"INV1-CB4-kWh" : 132.4517806833333,  
"INV1-CB5-kWh" : 117.02035440000002,  
"INV1-CB6-kWh" : 123.05989681666667,  
"INV1-CB7-kWh" : 136.42486723333332,  
"INV1-CB8-kWh" : 136.6777630916667,  
"INV1-CB9-kWh" : 136.75962334166667,  
"INV1-CB10-kWh" : 144.97650903333337,  
"INV1-CB11-kWh" : 137.694382,  
"INV1-CB12-kWh" : 134.7759178,  
"INV1-CB13-kWh" : 138.66672996666668,  
"INV2-CB1-kWh" : 125.82239708333331,  
"INV2-CB2-kWh" : 127.39988920000002,  
"INV2-CB3-kWh" : 129.13103844166667,  
"INV2-CB4-kWh" : 126.11102471666669,  
"INV2-CB5-kWh" : 140.03385219999998,  
"INV2-CB6-kWh" : 138.45272966666664,  
"INV2-CB7-kWh" : 137.82996075,  
"INV2-CB8-kWh" : 139.30458291666662,  
"INV2-CB9-kWh" : 140.020130675,  
"INV2-CB10-kWh" : 139.25729654166668,  
"INV2-CB11-kWh" : 137.86343339166666,  
"INV2-CB12-kWh" : 139.310226225,  
"INV2-CB13-kWh" : 139.090109125,  
"INV3-CB1-kWh" : 124.85468185833334,  
"INV3-CB2-kWh" : 126.35251884166665,  
"INV3-CB3-kWh" : 127.67246848333335,  
"INV3-CB4-kWh" : 129.89190989166664,  
"INV3-CB5-kWh" : 138.981457025,  
"INV3-CB6-kWh" : 139.6878376916667,  
"INV3-CB7-kWh" : 138.35166519166668,  
"INV3-CB8-kWh" : 136.26964551666669,  
"INV3-CB9-kWh" : 135.394168625,  
"INV3-CB10-kWh" : 137.10886825,  
"INV3-CB11-kWh" : 139.28429440833335,  
"INV3-CB12-kWh" : 135.23420513333335,  
"INV3-CB13-kWh" : 138.04020316666666,  
"INV4-CB1-kWh" : 127.15191640833334,  
"INV4-CB2-kWh" : 126.92121530833332,  
"INV4-CB3-kWh" : 128.9567184916667,  
"INV4-CB4-kWh" : 125.50774203333333,  
"INV4-CB5-kWh" : 128.52938363333337,  
"INV4-CB6-kWh" : 137.34080834166667,  
"INV4-CB7-kWh" : 137.76071120833333,  
"INV4-CB8-kWh" : 127.63264563333334,  
"INV4-CB9-kWh" : 140.13754835833333,  
"INV4-CB10-kWh" : 139.50317408333336,  
"INV4-CB11-kWh" : 139.16241495,  
"INV4-CB12-kWh" : 138.22675353333335,  
"INV4-CB13-kWh" : 139.07060725,  
"INV5-CB1-kWh" : 125.39768312500001,  
"INV5-CB2-kWh" : 127.10724958333333,  
"INV5-CB3-kWh" : 129.63362292499997,  
"INV5-CB4-kWh" : 127.25602985000002,  
"INV5-CB5-kWh" : 138.61481985,  
"INV5-CB6-kWh" : 136.37210059166665,  
"INV5-CB7-kWh" : 136.29143923333334,  
"INV5-CB8-kWh" : 139.68023161666667,  
"INV5-CB9-kWh" : 140.83114246666668,  
"INV5-CB10-kWh" : 140.3429429583333,  
"INV5-CB11-kWh" : 139.33480370833334,  
"INV5-CB12-kWh" : 137.23492912499998,  
"INV5-CB13-kWh" : 140.73961813333335  
}}  
rather than I define all key for aggregation is there a way something like this  
"aggs": {  
"NAME": {  
"sum": {"field": "combiner\_box.\*"}  
}  
}  
Regards,  
HAK

---

<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:** [November 17, 2019, 9:53am UTC](https://discuss.elastic.co/t/aggregation-sum-for-all-keys-within-field/204345/2 "2019-11-17T09:53:41Z")

</div>

Closed on November 17, 2019, 9:53am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
