Unable to display float value of a number scripted-field

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

  1. I visualise the result from the Discover panel


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).

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.

1 Like

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

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