What i would like to get is:
(sum of disk usage) / (sum of disk size).
This seem to be fairly basic requirement but i cant figure out how to do it in Kibana.
Is there any way of doing so?
If you want to do a calculation against the results of aggregations, you need pipeline aggregations, which unfortunately are not supported in Kibana yet. You can track the progress of that implementation here: https://github.com/elastic/kibana/issues/4584
You have a couple options before pipeline aggregations are implemented in Kibana.
You can run the pipeline query in a script and index the result as an ordinary series that Kibana can read, then graph that
You can experiment with the Timelion plugin if your data is time-based and use the functions it provides. I think that would only work if your data is a time-series though. Full disclosure, I don't have a lot of experience with Timelion
thanks for the reply, i will look into the pipeline aggregation, and definitely follow the status of the implementation as i think this is a very required feature.
i thought about doing so with scripted field, and created a scripted field with the following script for each document:
doc['SizeTB'].value > 0 ? (doc['UsageTB'].value/doc['SizeTB'].value) : 0
this provides the required data for a single document, but when aggregating them all together, it is mathematically wrong, and gives the wrong numbers.
Did you have something else in mind?
You can create a scripted field that does this as well.
Really? You can certainly create a scripted field that calculates the ratio in question for each document, but how would you meaningfully aggregate that?
This is the problem. Scripted field wont help here as it will be correct per document, but will lose its meaning once all documents will be aggregated.
This is a very basic need for most dashboards and my company is considering dumping Kibana because of this Is this feature on the Kibana roadmap for the near future?
I have deloped custom visualizations, and one of those (kbn_percent_nice_vis) actually takes a Metric (Count) and divides this count by an Aggregated field (for instance a Filter) count.
It then rounds up the value into 0-100, 10 by 10 intervals in order to show an image (a different image for each %).
Anyway, it's a couple of lines of code away from what you are requesting.
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.