Use Json input convert bytes to GB

Hello please i am beginner for elastics

I created metric for sum filesize , but I have count in bytes I need in GB

how should i write json input ?

Soory for my Englisch , thank you

Hi @Jan_Svajcik,

Using JSON Input it would be something like this:

{ "script" : "doc['filesize'].value / 1000 / 1000 / 1000" }

But I think you should better instead configure this filesize field to use bytes formatter. Then this field will be nicely displayed everywhere in Kibana's UI.

To do this:

Management -> Kibana -> Index Patter -> Pick you index pattern -> find filesize field and click edit -> in Format select Bytes and then Save.

Then in your vis it should be nicely formatter as "392Gb" without a need for JSON input

More info about field formatters: https://www.elastic.co/guide/en/kibana/current/field-formatters-numeric.html

Hope this is helpful.

thank you i set
{
"script": " _value / 1048576"}

thanks setting format work excelent !!

1 Like

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