# Are cumulative sums approximate?

**URL:** https://discuss.elastic.co/t/are-cumulative-sums-approximate/66215
**Category:** Elasticsearch
**Created:** [November 16, 2016, 7:43am UTC](https://discuss.elastic.co/t/are-cumulative-sums-approximate/66215 "2016-11-16T07:43:07Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![WoJ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/woj/32/4518_2.png) [@WoJ](https://discuss.elastic.co/u/WoJ)
#### Post date: [November 16, 2016, 7:43am UTC](https://discuss.elastic.co/t/are-cumulative-sums-approximate/66215/1 "2016-11-16T07:43:07Z")

</div>

Hello,

I calculate a cumulative sum via `cumulative_sum`:

```
{
   "size":0,
   "aggs":{
      "vulns_day":{
         "date_histogram":{
            "field":"HOST_START_iso",
            "interval":"day"
         },
         "aggs":{
            "dates_stats":{
               "stats":{
                  "field":"HOST_START_iso"
               }
            },
            "vulns_cumulated":{
               "cumulative_sum":{
                  "buckets_path":"dates_stats.count"
               }
            }
         }
      }
   }
}

```

During the last days there were no new events indexed and despite this the cumulative sum shows progress. As an example (to highlight the scale of the change) on day `n` there were `2,406,013` accumulated events and on `n+1` - `2,411,455`. This is a change of `5,442` events (where the change was supposed to be 0), or about `0.2%`.

**I have seen in the past that some of the information provided by ES was not exact by design, I wonder if this would not be such a case as well?**

(initially asked on [SO](http://stackoverflow.com/questions/40615399/are-cumulative-sums-approximate))

Thank you!

---

<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: [December 14, 2016, 7:43am UTC](https://discuss.elastic.co/t/are-cumulative-sums-approximate/66215/2 "2016-12-14T07:43:40Z")

</div>

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