# Sum of doc\_count through multiple aggregations

**URL:** <https://discuss.elastic.co/t/sum-of-doc-count-through-multiple-aggregations/88685>\
**Category:** Elasticsearch\
**Created:** [June 8, 2017, 8:32am UTC](https://discuss.elastic.co/t/sum-of-doc-count-through-multiple-aggregations/88685 "2017-06-08T08:32:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidS](https://avatars.discourse-cdn.com/v4/letter/d/65b543/32.png) [@davidS](https://discuss.elastic.co/u/davidS)\
**Post date:** [June 8, 2017, 8:32am UTC](https://discuss.elastic.co/t/sum-of-doc-count-through-multiple-aggregations/88685/1 "2017-06-08T08:32:58Z")

</div>

Hi,

how can I sum all doc\_counts from multiple aggregations in a condition expression like

```
  "condition": {
    "array_compare": {
      "ctx.payload.aggregations.bad_computer.buckets": {
        "path": "doc_count",
        "sum": {
          "gt": {
            "value": 5
          }
       }
      }
    }
  }

```

I am using Elasticsearch 5.4 with XPack

Thanks

David

---

<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 6, 2017, 8:33am UTC](https://discuss.elastic.co/t/sum-of-doc-count-through-multiple-aggregations/88685/2 "2017-07-06T08:33:10Z")

</div>

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