Skip to content

Commit

Permalink
Backport PR #8638
Browse files Browse the repository at this point in the history
---------

**Commit 1:**
Fix label on scripted field date histograms

Now that we support Painless scripted fields users can create scripted
date fields, and thus scripted date histograms. The label making method
for the date histogram agg was getting the field name in a way that was
incompatible with scripted fields, so I've added some fallback code for
that scenario. I looked through the rest of the makeLabel methods on all
the other aggs and they all correctly access the field displayName
already so this should only need fixed for date histograms.

Fixes #8632

* Original sha: 7359b45
* Authored by Matthew Bargar <[email protected]> on 2016-10-12T15:10:15Z
  • Loading branch information
elastic-jasper committed Oct 12, 2016
1 parent b74c43a commit de68ed0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ui/public/agg_types/buckets/date_histogram.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || '';
return field + ' per ' + (output.metricScaleText || output.bucketInterval.description);
},
createFilter: createFilter,
decorateAggConfig: function () {
Expand Down

0 comments on commit de68ed0

Please sign in to comment.