-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[TSVB] FR: Scripted Fields / Scripted Aggregations #13928
Comments
Thanks for filing @hetzer-fastec! I think the new Math aggregation we are working on #13681 will help with your use case. Would you mind reviewing the description to see if the functionality fully fits your use case. I believe it will. cc: @simianhacker |
Thanks for your quick answer, @alexfrancoeur! I already saw #13681, but as far as I can see that one does not really solve my use case, it only partially helps. The main problem I am having is that I cannot create a scripted aggregation, e.g. a scripted sum aggregation in the TSVB. For example, suppose we have a type car, which has a state "s", and two numeric values "a" and "b". Now we want to have a scripted sum aggregation, which basically selects "a" as a summand if the state has a certain feature and "b" as a summand it this is not the case. Let's call this sum "L". Let's now consider that our car type has two other numerical fields "c" and "d", which are summed as well based on some condition regarding the state. Let's call this sum "P". Now at the end we want to compute the result of "L" / "P", which we can do by a bucket-script aggregation. While I can theoretically create two sums in the TSVB using the sum aggregation, I cannot create them in the way I described it as the sum aggregation does not allow to define a script, which the summation is based on. While I really like the idea of the math aggregation, it does not solve my problem, as far as I understood the issue. Please correct me if I am wrong - I am more than happy to learn that my issue is resolved with the help of the math aggregation :). |
@alexfrancoeur Any news on this ? :) |
At least another reply would be great! |
@hetzer-fastec apologies, somehow I missed your comments from earlier. Thank you for your patience. I agree and do not believe that Math.js may not be able to handle the state-like logic you are looking for. @simianhacker, this is a pretty interesting use case. Any idea's how @hetzer-fastec can accomplish this? If TSVB natively supported scripted fields would this be possible? |
At some point I'm going to integrate TSVB with Kibana Index Patterns (and scripted fields). There are no timelines (due to other forces of nature on my time :D) |
@simianhacker @alexfrancoeur Thanks for the update! I guess, I have to wait until its implemented then :). |
+1 |
+1 |
3 similar comments
+1 |
+1 |
+1 |
vote for this issue |
+1 I believe this is a serious limitation. Other tools have it but do not have bucket script. |
+1 |
7 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
Scripted Fields support for TSVB would be a great new feature. +1 |
+1 |
Quick update on this issue, we've added this to the Metrics UI roadmap for 7.9. The goal is to allow users to define scripted fields ad hoc since there isn't a hard requirement for Kibana Saved Index Patterns in TSVB. I'm still working out what the best way to do this is. My initial approach will be to allow users to define scripted fields under the panel options so they can use them throughout the TSVB UI (via basic aggs and percentiles). |
After playing around with this a bit today, instead of adding scripted fields under Panel Options I think a better approach will be to do something like this: I've added a field named "Script" to all the field dropdowns, when this is selected it will display a text area for a script. Once you've entered a script, everything will just work like a normal field. The screen shot above is WIP and you should see a PR for this in the next couple of days. |
I like the ability to run arbitrary scripts AND it would be nice to have support for scripted fields. |
Any progress on this? |
@simianhacker thanks for working on the scripted field feature in TSVB! |
@Alsheh The PR was closed and this comment explains why: |
+1 |
With #82438 TSVB can use runtime fields in Visualizations. I believe this closes this request. |
Feature Request
I am suggesting to include support for scripted aggregations (such as a scripted sum aggregation as described in the official documentation: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-sum-aggregation.html) and/or scripted fields in the time series visual builder. Currently only the bucket script aggregation seems to be implemented (see #4707).
Right now, one can neither select a scripted field as the target of an aggregation nor supply a custom script in combination with a special aggregation in the time series visual builder, which is a drastic limitation, in my opinion.
I have a use case where I need to compute several bucket script aggregations over simple aggregations, which themselves are scripted / work on scripted fields. For example: I need to compute a sum of the form sum(f(x)), where f(x) = x, if y = 0 and f(x) = 0 else (x, y are document fields). Unfortunately I am not in a situation to alter the type in order to include an according precomputed field.
There seems to be no way, I can visualize these computations right now in Kibana although I can generally compute them.
The text was updated successfully, but these errors were encountered: