# Basic math on numbers in elastic search

**URL:** <https://discuss.elastic.co/t/basic-math-on-numbers-in-elastic-search/40795>\
**Category:** Kibana\
**Created:** [February 2, 2016, 10:57pm UTC](https://discuss.elastic.co/t/basic-math-on-numbers-in-elastic-search/40795 "2016-02-02T22:57:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric\_odell](https://avatars.discourse-cdn.com/v4/letter/e/9d8465/32.png) [@eric\_odell](https://discuss.elastic.co/u/eric_odell)\
**Post date:** [February 2, 2016, 10:57pm UTC](https://discuss.elastic.co/t/basic-math-on-numbers-in-elastic-search/40795/1 "2016-02-02T22:57:33Z")

</div>

Would like to do simple math on aggregations of documents, eg collectd disk plugin has free and used integer values and would like to calculate:

% disk free: free/(used+free)  
derivitive of disk usage to predict when a disk will run out of space: -(free)/d(free)/dt

similarly interface plugin in collectd is a total of bytes tx and rx and need to calculate derivative of rx and tx to see bytes/time

This is easy to do in graphite which has many useful functions, eg "most deviant" which pulls out the top 5 metrics based on standard deviation.  
would rather have everything in elastic than to split numeric time series into graphite

---

<div class="post-metadata">

**Author:** ![tbragin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tbragin/32/45166_2.png) [@tbragin](https://discuss.elastic.co/u/tbragin)\
**Post date:** [February 8, 2016, 7:25pm UTC](https://discuss.elastic.co/t/basic-math-on-numbers-in-elastic-search/40795/2 "2016-02-08T19:25:32Z")

</div>

Have you tried using an experimental Kibana plugin called Timelion? It was developed to deal with exactly this kind of time-series oriented operations on metric data: [https://www.elastic.co/blog/timelion-timeline](https://www.elastic.co/blog/timelion-timeline)

---

<div class="post-metadata">

**Author:** ![pittoch](https://avatars.discourse-cdn.com/v4/letter/p/df788c/32.png) [@pittoch](https://discuss.elastic.co/u/pittoch)\
**Post date:** [February 10, 2016, 5:45pm UTC](https://discuss.elastic.co/t/basic-math-on-numbers-in-elastic-search/40795/3 "2016-02-10T17:45:48Z")

</div>

Hi Tanya,

I need to predict data points for 3 next month, I use this command:  
.es(index\_stoz\_baie\_srdfbusy\_histo, timefield=@timestamp),.es(metric='avg:BUSY').lines().label(BUSY).movingaverage(1)

In the help command, it show that .movingaverage need 2 arguments : window=number, position=string|null.  
position=right, center, or left.  
But, how I can predict data for the next 3 months ? I don't understand...

Regards.

---

<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, 2:02pm UTC](https://discuss.elastic.co/t/basic-math-on-numbers-in-elastic-search/40795/4 "2017-07-06T14:02:38Z")

</div>


