# Customizing Metrics in kibana

**URL:** https://discuss.elastic.co/t/customizing-metrics-in-kibana/117224
**Category:** Kibana
**Created:** [January 26, 2018, 4:06pm UTC](https://discuss.elastic.co/t/customizing-metrics-in-kibana/117224 "2018-01-26T16:06:39Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![GregoryB-T](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregoryb-t/32/28564_2.png) [@GregoryB-T](https://discuss.elastic.co/u/GregoryB-T)
#### Post date: [January 26, 2018, 4:06pm UTC](https://discuss.elastic.co/t/customizing-metrics-in-kibana/117224/1 "2018-01-26T16:06:39Z")

</div>

Hi ,

During the development of my kibana plugin : [https://github.com/GregBoero/kbn\_vis\_multiple\_graph](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

---

<div class="post-metadata">

### Author: ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)
#### Post date: [January 26, 2018, 8:20pm UTC](https://discuss.elastic.co/t/customizing-metrics-in-kibana/117224/2 "2018-01-26T20:20:26Z")

</div>

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](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](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](https://github.com/elastic/kibana/issues/4707).

---

<div class="post-metadata">

### Author: ![GregoryB-T](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregoryb-t/32/28564_2.png) [@GregoryB-T](https://discuss.elastic.co/u/GregoryB-T)
#### Post date: [January 29, 2018, 10:40am UTC](https://discuss.elastic.co/t/customizing-metrics-in-kibana/117224/3 "2018-01-29T10:40:32Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/a/7abdc09ba5494246d3a8bebda1bf16999478d509.png)

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [February 26, 2018, 10:41am UTC](https://discuss.elastic.co/t/customizing-metrics-in-kibana/117224/4 "2018-02-26T10:41:14Z")

</div>

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