# Saved scripted metric aggregation in Elasticsearch and Kibana 4

**URL:** <https://discuss.elastic.co/t/saved-scripted-metric-aggregation-in-elasticsearch-and-kibana-4/20951>\
**Category:** Elasticsearch\
**Created:** [November 26, 2014, 1:19pm UTC](https://discuss.elastic.co/t/saved-scripted-metric-aggregation-in-elasticsearch-and-kibana-4/20951 "2014-11-26T13:19:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ann4beyer](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@ann4beyer](https://discuss.elastic.co/u/ann4beyer)\
**Post date:** [November 26, 2014, 1:19pm UTC](https://discuss.elastic.co/t/saved-scripted-metric-aggregation-in-elasticsearch-and-kibana-4/20951/1 "2014-11-26T13:19:14Z")

</div>

Hi all,

I was wondering if it is possible to save a scripted metric aggregation in  
Elasticsearch and to use it in Kibana 4 as a metric in a Data Table.

Thanks in advance!

Anna

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b802fec5-6953-4c1d-a6a7-4987869d4a7f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b802fec5-6953-4c1d-a6a7-4987869d4a7f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Hendrik\_Jander](https://avatars.discourse-cdn.com/v4/letter/h/f4b2a3/32.png) [@Hendrik\_Jander](https://discuss.elastic.co/u/Hendrik_Jander)\
**Post date:** [November 26, 2014, 2:31pm UTC](https://discuss.elastic.co/t/saved-scripted-metric-aggregation-in-elasticsearch-and-kibana-4/20951/2 "2014-11-26T14:31:19Z")

</div>

Hi Anna,

can you please elaborate a bit ?

Hendrik

On Wednesday, November 26, 2014 2:19:14 PM UTC+1, Anna wrote:

> Hi all,
> 
> I was wondering if it is possible to save a scripted metric aggregation in  
> Elasticsearch and to use it in Kibana 4 as a metric in a Data Table.
> 
> Thanks in advance!
> 
> Anna

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/becce34b-220c-4666-8dba-f827b168ee24%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/becce34b-220c-4666-8dba-f827b168ee24%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![ann4beyer](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@ann4beyer](https://discuss.elastic.co/u/ann4beyer)\
**Post date:** [November 26, 2014, 4:33pm UTC](https://discuss.elastic.co/t/saved-scripted-metric-aggregation-in-elasticsearch-and-kibana-4/20951/3 "2014-11-26T16:33:07Z")

</div>

Hi Hendrik,

thanks for your interest.

I would like to approach the following use case:  
In Kibana 4, I would like to create data table containing a column with a  
metric. Instead of a predefined metric (e.g., min, max, or average), I  
would like to use a custom metric (i.e, a scripted metric) for computing a  
value over sets of documents (i.e., buckets).

From my point of view, there are two options to do this:  
(1) In Kibana's Data Table Visualization Menu, an option for copying the  
code of the scripted metric could be included. This option might raise  
security issues.  
(2) The custom metric could be saved in Elasticsearch and in Kibana's Data  
Table Visualization Menu an option for selecting this metric is included.

Currently, these options seem not to be supported. Maybe I have missed an  
option.

Anna

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a82b2e02-4d5a-4a92-9f32-60be42b17f2e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a82b2e02-4d5a-4a92-9f32-60be42b17f2e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Krzysztof\_Zarzycki](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krzysztof_zarzycki/32/822_2.png) [@Krzysztof\_Zarzycki](https://discuss.elastic.co/u/Krzysztof_Zarzycki)\
**Post date:** [March 20, 2015, 7:10pm UTC](https://discuss.elastic.co/t/saved-scripted-metric-aggregation-in-elasticsearch-and-kibana-4/20951/4 "2015-03-20T19:10:18Z")

</div>

Hi, I'm also very interested in answer of Anna's question.  
I'll be grateful if anyone can help!

W dniu środa, 26 listopada 2014 17:33:07 UTC+1 użytkownik Anna napisał:

> Hi Hendrik,
> 
> thanks for your interest.
> 
> I would like to approach the following use case:  
> In Kibana 4, I would like to create data table containing a column with a  
> metric. Instead of a predefined metric (e.g., min, max, or average), I  
> would like to use a custom metric (i.e, a scripted metric) for computing a  
> value over sets of documents (i.e., buckets).
> 
> From my point of view, there are two options to do this:  
> (1) In Kibana's Data Table Visualization Menu, an option for copying the  
> code of the scripted metric could be included. This option might raise  
> security issues.  
> (2) The custom metric could be saved in Elasticsearch and in Kibana's Data  
> Table Visualization Menu an option for selecting this metric is included.
> 
> Currently, these options seem not to be supported. Maybe I have missed an  
> option.
> 
> Anna

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/98ef56b5-6524-4f9e-b028-917f789cccb4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/98ef56b5-6524-4f9e-b028-917f789cccb4%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 12:25am UTC](https://discuss.elastic.co/t/saved-scripted-metric-aggregation-in-elasticsearch-and-kibana-4/20951/5 "2017-07-06T00:25:19Z")

</div>


