# Elasticsearch Transform API - Trying to Script a Moving Average

**URL:** <https://discuss.elastic.co/t/elasticsearch-transform-api-trying-to-script-a-moving-average/330115>\
**Category:** Elasticsearch\
**Created:** [April 17, 2023, 10:43am UTC](https://discuss.elastic.co/t/elasticsearch-transform-api-trying-to-script-a-moving-average/330115 "2023-04-17T10:43:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Silver137](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@Silver137](https://discuss.elastic.co/u/Silver137)\
**Post date:** [April 17, 2023, 10:43am UTC](https://discuss.elastic.co/t/elasticsearch-transform-api-trying-to-script-a-moving-average/330115/1 "2023-04-17T10:43:09Z")

</div>

My use case requieres keeping the moving average over hours withing a windows of the last 12 hours, every time the transofrm is executed.  
It's possible to use the "pivot" "group by" to program a transform that keeps track of the moving average?

My other option is think in logstash using http input, elasticsearcher as input, or filter and making the agregation every hour.

---

<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:** [May 15, 2023, 10:43am UTC](https://discuss.elastic.co/t/elasticsearch-transform-api-trying-to-script-a-moving-average/330115/2 "2023-05-15T10:43:12Z")

</div>

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