# Unable to display float value of a number scripted-field

**URL:** <https://discuss.elastic.co/t/unable-to-display-float-value-of-a-number-scripted-field/130629>\
**Category:** Kibana\
**Created:** [May 4, 2018, 12:34pm UTC](https://discuss.elastic.co/t/unable-to-display-float-value-of-a-number-scripted-field/130629 "2018-05-04T12:34:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dighan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dighan/32/30807_2.png) [@dighan](https://discuss.elastic.co/u/dighan)\
**Post date:** [May 4, 2018, 12:34pm UTC](https://discuss.elastic.co/t/unable-to-display-float-value-of-a-number-scripted-field/130629/1 "2018-05-04T12:34:09Z")

</div>

Hey. I'm playing with scripted-field in Kibana 5.6.6. It's super powerful ! I'm just facing a little issue about formatting:

1. I create a scripted-field returning a `float` from a ratio

 ![scripted-field](https://us1.discourse-cdn.com/elastic/original/3X/a/3/a37ef110f2eaccf07c375327ac83d7780702a6df.png)

1. I visualise the result from the Discover panel

![results](https://us1.discourse-cdn.com/elastic/original/3X/a/5/a526772fdf2c362bf52e8c5c05e680f53ab08f27.png)

Even if I change `Format` field to `0.[000]` the result is always the same: The decimal part is never displayed properly. And the result remains unchanged when I use some of my fields (`e.g` `doc['*'].value / doc['*'].value`).

---

<div class="post-metadata">

**Author:** ![christophilus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christophilus/32/42991_2.png) [@christophilus](https://discuss.elastic.co/u/christophilus)\
**Post date:** [May 4, 2018, 7:36pm UTC](https://discuss.elastic.co/t/unable-to-display-float-value-of-a-number-scripted-field/130629/2 "2018-05-04T19:36:09Z")

</div>

If you change your values to `4 / 2`, you'll see that it works.

The problem is that you are dividing integers, and `1 / 2` will produce an integer value of 0. If you want floating points, you can do `1.0 / 2.0` and you should see `0.5`.

The value is computed in Elasticsearch and then sent to Kibana to visualize (using the format field), so the format field won't actually change the fact that Elasticsearch is giving a value of 0 for `1 / 2`.

---

<div class="post-metadata">

**Author:** ![dighan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dighan/32/30807_2.png) [@dighan](https://discuss.elastic.co/u/dighan)\
**Post date:** [May 7, 2018, 9:07am UTC](https://discuss.elastic.co/t/unable-to-display-float-value-of-a-number-scripted-field/130629/3 "2018-05-07T09:07:41Z")

</div>

Got it ! I'm now able to get `float` when using `floating` fields or static values. Thanks a lot !

---

<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:** [June 4, 2018, 9:07am UTC](https://discuss.elastic.co/t/unable-to-display-float-value-of-a-number-scripted-field/130629/4 "2018-06-04T09:07:48Z")

</div>

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