# Scale numeric values - Kibana

**URL:** <https://discuss.elastic.co/t/scale-numeric-values-kibana/97547>\
**Category:** Kibana\
**Created:** [August 18, 2017, 9:29am UTC](https://discuss.elastic.co/t/scale-numeric-values-kibana/97547 "2017-08-18T09:29:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eran\_H](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eran_h/32/46227_2.png) [@Eran\_H](https://discuss.elastic.co/u/Eran_H)\
**Post date:** [August 18, 2017, 9:29am UTC](https://discuss.elastic.co/t/scale-numeric-values-kibana/97547/1 "2017-08-18T09:29:49Z")

</div>

As described [here](https://en.wikipedia.org/wiki/Feature_scaling), I want to implement the "rescaling" method in Kibana.  
I have a numeric field, which is always \>= 0 .  
I want it to scale to the range of [0, 1].

It seems:

- Timelion doesn't support extracting the Maximum bucket / Overall max. Similar to [this](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-max-bucket-aggregation.html)
- Kibana Time Series does support Overall Max, but when using a calculation aggregation, I can't use the Overall max aggregation.

Is that correct? If yes, are there any suggested workarounds?  
Thanks

---

<div class="post-metadata">

**Author:** ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)\
**Post date:** [August 18, 2017, 11:32pm UTC](https://discuss.elastic.co/t/scale-numeric-values-kibana/97547/2 "2017-08-18T23:32:29Z")

</div>

> [@Eran\_H](#):
>
> Kibana Time Series does support Overall Max, but when using a calculation aggregation, I can’t use the Overall max aggregation.

I am using Kibana 5.5.2, and I am able to get an Overall Max when using a Calculation aggregation:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/1/113d39153e8a0efc1627ff9909c8fc0eee196b34.png)

Also, just to point out, the Wikipedia article you linked to seems to suggest calculating the scale in a pre-processing step, so it probably wouldn't hurt to originally index the data with a scaled field. 🙂

---

<div class="post-metadata">

**Author:** ![Eran\_H](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eran_h/32/46227_2.png) [@Eran\_H](https://discuss.elastic.co/u/Eran_H)\
**Post date:** [August 19, 2017, 1:29pm UTC](https://discuss.elastic.co/t/scale-numeric-values-kibana/97547/3 "2017-08-19T13:29:50Z")

</div>

Actually, I intend to use the Overall Max metric in the Calculation and not the other way around.

Calculating it pre-index time won't work as I need.  
That is because the calculation depends on the Overall Max and Overall Min, which depend on the time range you are using.  
If I want to be able to easily change the time range I need it calculated every time.

Thanks!

---

<div class="post-metadata">

**Author:** ![simianhacker](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simianhacker/32/3383_2.png) [@simianhacker](https://discuss.elastic.co/u/simianhacker)\
**Post date:** [August 21, 2017, 5:53pm UTC](https://discuss.elastic.co/t/scale-numeric-values-kibana/97547/4 "2017-08-21T17:53:59Z")

</div>

@Eran_H Unfortunately Time Series Visual Builder is limited to the functionality that Elasticsearch provides for the `bucket_script` (which is what powers the calculation agg in TSVB). We are unable to use sibling aggregations (which is what the overall max aggregation is) in buckets scripts because how of the calculations are processed during the reduce phase.

---

<div class="post-metadata">

**Author:** ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)\
**Post date:** [August 21, 2017, 6:21pm UTC](https://discuss.elastic.co/t/scale-numeric-values-kibana/97547/5 "2017-08-21T18:21:51Z")

</div>

Thanks Chris. BTW here is a link to a documented issue in the Kibana Github on this: [https://github.com/elastic/kibana/issues/12709](https://github.com/elastic/kibana/issues/12709)

---

<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:** [September 18, 2017, 6:22pm UTC](https://discuss.elastic.co/t/scale-numeric-values-kibana/97547/6 "2017-09-18T18:22:04Z")

</div>

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