-
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
Vizualize a custom aggregation #2206
Comments
Currently not possible, filing as an enhancement request. |
Rashid, could you please elaborate more on why it is not possible right now? Does this functionality require changes in the logic of the embedded web-server? Or update of the UI and the way request is build may be sufficient? |
Let me explain my UC. |
+1 |
+1 In our use case, a P0 scenario is metrics that are "weighted". We got this working via an ElasticSearch "scripted_metric". A nice UI friendly editor for scripted_metric can be quite complicated, ** Example code for sum(a)/sum(b): **
"scripted_metric": {
"init_script": "_agg[\"numerator\"] = []; _agg[\"denominator\"] = [];"
"map_script": "_agg.numerator << (doc[\"a\"]); _agg.denominator = << (doc[\"b\"].value);"
"combine_script": "num_sum=0; den_sum=0; for (t in _agg.numerator) { num_sum+= t}; for (t in _agg.denominator) { den_sum += t }; return [num_sum: num_sum, den_sum: den_sum];"
"reduce_script": "num_sum = 0; den_sum=0; for (a in _aggs) { num_sum += a.num_sum; den_sum += a.den_sum; }; return (num_sum/den_sum);"
"scripted_metric": {
"init_script_file": "dividesums_init"
"map_script": "dividesums_map"
"combine_script": "dividesums_combine"
"reduce_script": "dividesums_reduce" What I simply need is for Kibana to eventually generate this type of agg in the query, "aggs": {
"my_dividesums_metric": {
"scripted_metric": {
"init_script_file": "reliability_init",
"map_script_file": "reliability_map",
"combine_script_file": "reliability_combine",
"reduce_script_file": "reliability_reduce"
}
}
} I've tried putting this in the "scripted field" textbox, but there's an error indicating what's expected is purely the value of "script", example: Perhaps if there's a different type of scripted field where the value you're putting is the contents of "scripted_field" ? Example: |
Ah, digging through the code I can see why this isn't working even after editing the visState: So, when I modify the JS to the following, I get "Unable to get property 'params' of undefined or null reference". {
"id": "1",
"type": "scripted_metric",
"schema": "metric",
"params": {
"init_script_file": "reliability_init",
"map_script_file": "reliability_map",
"combine_script_file": "reliability_combine",
"reduce_script_file": "reliability_reduce"
}
}, |
I'm wondering if this is possible through JSON input in Kibana 4. @rashidkpc do you have any recommendation on that? Can we use a scripted metric in the JSON input section of the metric? |
I am interested in this as well |
+1 |
4 similar comments
+1 |
+1 |
👍 |
+1 |
Any progress on this one? Currently, it seems to be impossible to do aggregations of pre-aggregated data because of this limitation. As an example, historical telemetry data can be represented as number of requests ( Edit: related #4584 |
+1 |
I think this is a duplicate of "scripted metric aggregation" #2646. Since that issue has way more comments, closing this one in favor of the other one. Please feel free to transfer your comment there! To answer some questions in this thread, if you'd like to do time-series math, such as
you may consider trying out the Timelion Kibana plugin: https://github.com/elastic/timelion |
Hello,
I may duplicate some previous requests (#1331). Still, is there a way to visualize a custom metric aggregation besides the predefined ones (e.g. count, sum, average, etc)?
Specifically, I would like define a scripted_metric aggregation that computes precision/recall statistics and is represented with a bar chart. It would be nice, if there would be an option to define a JSON of a custom aggregation and Kibana would use it as is.
Is it possible? Am I missing something?
Thank you,
Savva
The text was updated successfully, but these errors were encountered: