-
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
[Lens] Summarize a break down by (collapse bucket column) #94619
Comments
Pinging @elastic/kibana-app (Team:KibanaApp) |
this case got +1'd by a customer who had to do series aggregation in TSVB to get the proper calculation per server to then derive an overall calculation. |
+1 - summary of a metric across hosts without displaying the hosts |
The approach described above is missing one feature which might be common (but is also not supported in TSVB today) - calculating the ratio of two series aggs. However, if we would implement #94609 , then it would be possible to do the calculation with the given primitives:
We can add the same functionality to TSVB relatively easily by adding a new variable to the math context: #130766 |
In some cases aggregating calculations spanning a whole series should be kept along with the individual values (#94597), but in some cases they are not relevant and should be "collapsed" - e.g. in the resulting table passed to the chart only the aggregated value is included. This will reduce the number of rows in the table.
Description
by_terms(field, size, metric, reduce op, order by, order direction)
by_toplevel_terms(field, size, metric, reduce op, order by, order direction)
Reduce op can be:
min
,max
,sum
,avg
,last
,first
Order by can be:
term
,metric
,count
Example:
by_toplevel_terms(“host”, 100, last(out_bytes), sum)
by_terms
is the function to do min/max/sum/... buckets on the current level of bucket nesting, by usingby_toplevel_terms
it's doing the same thing, but changing the order of columns, putting the inner terms agg to the top level.This syntax is limiting the collapsed bucket columns to use the top values function only, but I think this is also by far the most common use case. If this wouldn't cover some case, we could make it more flexible later on and allow other buckets. This can always be worked around by the user adding a runtime field which calculates the desired bucket (e.g. for bucketing by year)
Implementation
If there are multiple
by_terms
orby_toplevel_terms
, we have to do separate esaggs calls anyway, merging together the resulting tables using an outer join on the shared bucket columns. This makes the logic ofto_expression
much more complex, because for eachby_*_terms
a separate esaggs has to be made (as some of the columns will be collapsed but others won't). The resulting tables can be joined together by doing an outer join on the bucket columns all esaggs calls have in common.Use case
If the last state of multiple entities has to be aggregated, e.g. the cumulative load of all hosts:
by_toplevel_terms(host, 100, last_value(load), sum)
The text was updated successfully, but these errors were encountered: