I have a document field that gives me a result in kBit/s, but I would like to convert it to MBit/s (by dividing by 1,000). This should only be done during visualization; there is no need to create a runtime field or scripted field.
For the new, lens-based visualizations, I can easily create a formula for the selected field:
But for the aggregation-based visualizations, how do I accomplish the same thing? I thought this would be simple, but the "JSON input" field is … uhm, not very intuitive. I thought I could adapt some scripts I found online, but this does not work, saying that the statistic_values field is missing in the mapping.
On a related note, if the data you ingest uses bytes instead of kilobytes, you can use the Field Formatters in Kibana to easily convert the number into human readable versions (like KB, MB or GB).
I don't really understand this though. Can I explicitly set the formatting as "Bytes"? If so, where? Or does this have to be specified as a type for a field when creating the index mapping?
You enable the Field Formatting for a field by going to "Stack management" -> "Data Views"/"Index Patterns" depending on what version of Kibana you're on -> select the Index pattern you're interested in -> search for the field that you want to apply a field formatter to -> there is a small crayon on the last column of the field table that allows you to edit that field and set a format.
That said, it's not a direct solution for my problem, because the data ingested uses KBit/s as a unit, and I have to convert to MBit/s – so the default "Bytes" assumption does not work here.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.