# Cumulative Sum Regardless of Time Interval - ES

**URL:** <https://discuss.elastic.co/t/cumulative-sum-regardless-of-time-interval-es/100237>\
**Category:** Elasticsearch\
**Created:** [September 12, 2017, 3:27pm UTC](https://discuss.elastic.co/t/cumulative-sum-regardless-of-time-interval-es/100237 "2017-09-12T15:27:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Stone](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chris_stone/32/21026_2.png) [@Chris\_Stone](https://discuss.elastic.co/u/Chris_Stone)\
**Post date:** [September 12, 2017, 3:27pm UTC](https://discuss.elastic.co/t/cumulative-sum-regardless-of-time-interval-es/100237/1 "2017-09-12T15:27:57Z")

</div>

Hi, I posted the following in the Kibana category, and it was suggest that it might belong here in Elasticsearch:

> [@Cumulative Sum regardless of time interval](https://discuss.elastic.co/t/cumulative-sum-regardless-of-time-interval/96677):
>
> I've created a line chart that plots the cumulative sum of unique terms over time. I'd like this to work with a daily time interval. What I expect is for the sum to be calculated from the values at the beginning of the line to its end, disregarding the daily time interval. Instead, I get the sum of terms unique only within each interval. Is there a way to get the behavior I'm expecting? Thanks, --Chris

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [September 12, 2017, 3:33pm UTC](https://discuss.elastic.co/t/cumulative-sum-regardless-of-time-interval-es/100237/2 "2017-09-12T15:33:52Z")

</div>

How many unique terms are we talking about here?

Using the `terms` aggregation and the `min` aggregation on a date would be one way of getting the raw data but scale is a potential issue using aggs and a single request.

---

<div class="post-metadata">

**Author:** ![Chris\_Stone](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chris_stone/32/21026_2.png) [@Chris\_Stone](https://discuss.elastic.co/u/Chris_Stone)\
**Post date:** [September 12, 2017, 3:38pm UTC](https://discuss.elastic.co/t/cumulative-sum-regardless-of-time-interval-es/100237/3 "2017-09-12T15:38:44Z")

</div>

In the scale I'd typically want to view (hours to weeks) , we're talking about 100s I'd say, but could be in the 10,000s at longer time periods (months and greater).

Thanks,

--Chris

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [September 13, 2017, 8:49am UTC](https://discuss.elastic.co/t/cumulative-sum-regardless-of-time-interval-es/100237/4 "2017-09-13T08:49:18Z")

</div>

As far as I can see there's no configuration of existing aggregations that would give you the minimal set of data you are looking for (a count per time period).  
The closest we can probably get is a list of all unique terms and for each the first date they appeared in the index. It would be up to your client code to organise these pairs into the required date buckets, counting the number of terms that fall into the same bucket. That could be a lot of data.

---

<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:** [October 11, 2017, 8:49am UTC](https://discuss.elastic.co/t/cumulative-sum-regardless-of-time-interval-es/100237/5 "2017-10-11T08:49:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [June 24, 2019, 11:33pm UTC](https://discuss.elastic.co/t/cumulative-sum-regardless-of-time-interval-es/100237/6 "2019-06-24T23:33:45Z")

</div>

I filed this Elasticsearch issue (Kibana would also need a change);

> <https://github.com/elastic/elasticsearch/issues/43550>
