# Aggregation of sums instead of sum of aggregation

**URL:** <https://discuss.elastic.co/t/aggregation-of-sums-instead-of-sum-of-aggregation/323751>\
**Category:** Elasticsearch\
**Created:** [January 23, 2023, 5:04pm UTC](https://discuss.elastic.co/t/aggregation-of-sums-instead-of-sum-of-aggregation/323751 "2023-01-23T17:04:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rxtx](https://avatars.discourse-cdn.com/v4/letter/r/ecb155/32.png) [@rxtx](https://discuss.elastic.co/u/rxtx)\
**Post date:** [January 23, 2023, 5:04pm UTC](https://discuss.elastic.co/t/aggregation-of-sums-instead-of-sum-of-aggregation/323751/1 "2023-01-23T17:04:46Z")

</div>

I'm trying to figure out if I can aggregate something by the sum of a `value` field rather than the number of `value` fields.

I have an `events` index The `events` has the following fields: `property_id`, `name`, `value`, `timestamp`

I'm trying to get an aggregation of the top ten sum of the `value` fields by `property_id`.

It's easy enough to get a terms aggregation of `events` by the `property_id` for a given event `name` and then use a child aggregation to sum the `value` in each bucket.

BUT, if a certain property\_id has 100 "repair" events each with a `value` of 1 and another property\_id has 1 "repair" event with a `value` of 1000, I'd want this property to be the top bucket. Since I can get at most 50 buckets, the property\_id with the single "repair" event may not even make the bucket list.

Is it possible to do this?

---

<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:** [February 20, 2023, 5:05pm UTC](https://discuss.elastic.co/t/aggregation-of-sums-instead-of-sum-of-aggregation/323751/2 "2023-02-20T17:05:42Z")

</div>

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