-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Fix label on scripted field date histograms #8638
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,7 +41,8 @@ export default function DateHistogramAggType(timefilter, config, Private) { | |
| makeLabel: function (agg) { | ||
| const output = this.params.write(agg); | ||
| const params = output.params; | ||
| return params.field + ' per ' + (output.metricScaleText || output.bucketInterval.description); | ||
| const field = params.field || agg.params.field.displayName || ''; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I couldn't trigger a single example where the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd generally agree, but I'm playing it safe since we're so close to release with limited time to let this bake.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I worry about accessing the field display name directly like this because elsewhere in this file we access params information in a particularly defensive way: https://github.com/elastic/kibana/pull/8638/files#diff-2cd930ccd69e832107c9578ef648e5b7R23 That leads me to believe that there are circumstances where
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most other aggs (example) access displayName directly, so it seemed safe to me. I suppose there might something special about the date histogram though. I can change it to use lodash's get if you'd like.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Bargs I'm comfortable with this approach if we want to roll it out for 5.x, since that'll be given a full blown QA run, but if we want to get this into 5.0, we should be more cautious around the access here.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @epixa makes sense, it's a trivial change so the question is, do we want to put it in 5.0? If so I'm happy to make the change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this an issue in 4.x, or is this is a regression?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's new and only affects painless/groovy/etc - the issue only affects the date histogram and lucene expressions can't produce date fields.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's do it |
||
| return field + ' per ' + (output.metricScaleText || output.bucketInterval.description); | ||
| }, | ||
| createFilter: createFilter, | ||
| decorateAggConfig: function () { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sweeto!