Elasticsearch already offers a lot of aggregations and metrics. In rare cases, those are not enough. We can leverage an advanced feature of Elasticsearch and Kibana Vega/Vega Lite to calculate and render special metrics. We'll go through an example which should offer an overview on how to write a scripted metric aggregation. Finally we'll visualize the metrics on Kibana.