Skip to content

Commit

Permalink
Fix label on scripted field date histograms
Browse files Browse the repository at this point in the history
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.

Now with more lodash for safer access

Fixes elastic#8632
  • Loading branch information
Bargs committed Oct 12, 2016
1 parent 10e1fd6 commit fc635bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 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,7 @@ export default function DateHistogramAggType(timefilter, config, Private) {
makeLabel: function (agg) {
const output = this.params.write(agg);
const params = output.params;
const field = params.field || agg.params.field.displayName || '';
const field = params.field || _.get(agg, 'params.field.displayName', '');
return field + ' per ' + (output.metricScaleText || output.bucketInterval.description);
},
createFilter: createFilter,
Expand Down

0 comments on commit fc635bc

Please sign in to comment.