Customizing Metrics in kibana

Hi ,

During the development of my kibana plugin : https://github.com/GregBoero/kbn_vis_multiple_graph
something hit me about metric.

is it possible to customize a metrics, by example, is it possible to create a conditional count / sum / unique count... ?

I saw that the metrics are stored in kibana\src\ui\public\agg_types\metrics but i don't understand it , there is a documentation or anything on the subject

Thanks and Regards

hi @GregoryB-T,

the short answer is no.

Kibana doesn't have anything right now that allows an end-user to create a conditional expression, and doesn't have any documented public developer APIs to introduce this functionality through a plugin.

The folder you are pointing to contains the implementation of all metrics. Each of these maps to a metric in Elasticsearch https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics.html.

For conditional metrics, I think you would need something like a bucket script (https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-script-aggregation.html). It allows you to compute a per-bucket value, with custom scripts in painless. There is no support for this yet in Kibana, although it's been requested https://github.com/elastic/kibana/issues/4707.

Hi @thomasneirynck,

thanks for your answer and the links,
the Bucket Script Aggregation in Kibana will be a major step-father in kibana data manipulation, but I don't think it's fit to my use case,
let take an example :

In this visualization my bucket (X-Axis) is not conditional, but I may want that my second Y-Axis is a unique count of the field named project where the field named action contain the string Creation

Maybe I will dig into the Control visualization to see how you have customized the Metric part of the visualization and handle the index-pattern link it may help me to find a way of doing that

Thanks and Regards

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