# Derivatives with "missing docs"

**URL:** <https://discuss.elastic.co/t/derivatives-with-missing-docs/336705>\
**Category:** Elasticsearch\
**Created:** [June 22, 2023, 2:25pm UTC](https://discuss.elastic.co/t/derivatives-with-missing-docs/336705 "2023-06-22T14:25:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pieter\_Agenbag](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pieter_agenbag/32/4562_2.png) [@Pieter\_Agenbag](https://discuss.elastic.co/u/Pieter_Agenbag)\
**Post date:** [June 22, 2023, 2:25pm UTC](https://discuss.elastic.co/t/derivatives-with-missing-docs/336705/1 "2023-06-22T14:25:46Z")

</div>

Hi, I have a problem where I need to calculate the derivative on a sequence of documents that are Not at a specific interval.

As a simplified example , imagine a series "login" event inserted into an index with a timestamp and (lets say) the timestamp as an epoch value.  
I want to a derivative on the epochs (and subsequent bucket\_selector) to only return buckets with a "duration" less than x.

However both the derivative and serial\_differencing aggregation requires the parent histogram to have min\_doc\_count:0 - which prevents me from just getting the derivative between arbitrary sequential documents... or am I missing something ?

P.S. Am on ES 7.16 (Unfortunately cant upgrade -right now- to a newer version)

---

<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 20, 2023, 2:26pm UTC](https://discuss.elastic.co/t/derivatives-with-missing-docs/336705/2 "2023-07-20T14:26:17Z")

</div>

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