-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Scripted Metrics Aggregation #2646
Comments
Would be a great enhancement. I'd love to see a better script debugger in Kibana to complement this. |
Should be simple to implement considered that it is somewhat similar to scripted fields (at least in terms of interface). |
Would also like to see this a lot! |
This comment has been minimized.
This comment has been minimized.
This would be huge. I just got the scripted metric aggregation working in Sense (yay!) and I'd love to be able to hook it up in Kibana for the win. |
This comment has been minimized.
This comment has been minimized.
1 similar comment
+1 |
Unfortunately, due to the Groovy issues, we don't really have a secure way to accomplish this until we have a safe language that has loops and such |
I need this. Note that with many other similar products (NewRelic, Librato), you can submit a metric along with a "count" of how many samples that metric covers, and then the tool can do proper averages over a bucket of those items. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
+1 |
This comment has been minimized.
This comment has been minimized.
+1 Maybe the introduction of a new "Metrics" aggregation which is a "Ratio" of two current aggregations that have been processed by ES? Or could be two new specified aggregations (field and aggregation type) that we would aggregate in ES behind the scenes and then surface the ratio metric. |
@rashidkpc Regarding the groovy security issues: |
This comment has been minimized.
This comment has been minimized.
4 similar comments
+1 |
+1 |
+1 |
+1 |
Can anyone give instructions how to implement this? My expectation would be that you can save scripted aggs in the objects list and use them from the dropdown in the visualize function. |
This comment has been minimized.
This comment has been minimized.
2 similar comments
+1 |
+1 |
I started here with a very basic implementation of scripted_metric in the visualize editor, hope that helps: |
This comment has been minimized.
This comment has been minimized.
@timroes . You are absolutely right. Formula works on the output dataset given by ES and is computed "within" Kibana. |
@lfroment-datasweet It seems we have forgotten to backport that entry. I am now backporting it to 6.x and 6.3, so it will appear on the list of known plugins from 6.3 onwards. |
You're right @timroes, datasweet-formula brings feature way more similar to bucket script aggregation. |
@lfroment-datasweet happy to some more progress. I noticed an issue with visualizations created in datasweet when displayed in Also are there any plans to support more chart types like region maps or pie charts through your plugin? This might be a current limitation of Kibana that does not allow multiple metrics to be defined for these kind of charts but I might be mistaken. |
+1 If I'm correct, this should be the same request to _msearch than agregating by terms, with the term field optional when we have a script inside the "JSON Input" Field. The terms aggregration generate something like:
Which doesn't work (and should not work)
In that case the request to _msearch works. As this is not supported yet, did someone have alternative (plugin ? manual edition of Vizualisation?) for this? |
Today, there are 2 alternatives :
|
This look like both plugins works with the result provide by ES, when what I need is to agregate based on the result of my script. Let say I have a Person Document, with First Name and Last Name. |
Well, to do that in Kibana, the easiest way is to create a Kibana Scripted Field (in Management) named "full_name", which script is : Then you create a visualization (say Tag Cloud), and you do a "Terms" bucket aggregation based on "full_name" field. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hi Everyone, There is any plans to include it on Kibana for the next release? |
I was able to connect the output of my scripted metric to a Vega visualization. In other news, I hear that supporting triple quoted strings is coming. I can't wait to push readable code into code reviews. |
This comment has been minimized.
This comment has been minimized.
1 similar comment
+1 |
Another alternative for this is to use a transform, transforms are available since
The benefit of transform is less load at query time and likely a more responsive dashboard. However, the price tag is the extra storage you need for the output index of the transform. |
Nice alternative @hendrikmuhs |
@hendrikmuhs According to the documentation for 7.5, transforms are "in beta and [are] subject to change" (https://www.elastic.co/guide/en/elasticsearch/reference/7.5/transform-overview.html). They're also marked as an X-pack feature. Do you know how stable transforms are? Have they changed much since being introduced in 7.2? |
@SolomonShorser-OICR Note that I am one of the authors of transform. It is an X-pack feature, while starting with 6.3 X-pack has been opened and elasticsearch distributions bundle it. We now like to say it's a commercial feature. In the case of transform however it's licensed as 'basic', which is a free license. That means you can use transform for free without any limitation. Improvements have been made in every version, soon 7.6 will add cross cluster search support. Prior 7.5. the name was data frame transform. I (and my co-workers) happily answer more questions, however I think this issue is not the right place. I only wanted to give a quick pointer to anyone trying to solve a usecase that require visualization of scripted metric results. Let's use https://discuss.elastic.co/ for further questions (my name there: @Hendrik_Muhs) |
Elasticsearch decided to discourage usage of scripted metric aggregations across the stack (see elastic/elasticsearch#63096 for more details why). So we'll be closing this issue, since there are no longer plans to implement this. Please don't confuse scripted metric aggregation with bucket script aggregation which can be used to do calculations, like |
Replaced original description ~ @timroes
This ticket tracks implementing Elasticsearch's Scripted Metrics Aggregation (SMA) into Kibana.
SMA can be used to completely calculate a custom metric value based upon map/reduce on each individual document, i.e. you have the chance to map each document to a value (based on all fields in that document) and then use a combine and reduce script to reduce all those values into one metric result. An example for a scripted metric aggregation (taken from the documentation) could look as follows:
Do not confuse with Bucket script aggregation!
If you are simply looking into, e.g. the ratio of two metric values, this is not the right ticket to track. To calculate the result of multiple metric aggregation into a new value per bucket (e.g.
metric1 / metric2 * 100
), you would use the Bucket Script Aggregation available in Elasticsearch.The progress for supporting that aggregation in Kibana is tracked in #4707.
Original description
The text was updated successfully, but these errors were encountered: