diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/es_agg_source.js b/x-pack/legacy/plugins/maps/public/layers/sources/es_agg_source.js index a92fe1b076e4f6..967a3c41aec269 100644 --- a/x-pack/legacy/plugins/maps/public/layers/sources/es_agg_source.js +++ b/x-pack/legacy/plugins/maps/public/layers/sources/es_agg_source.js @@ -57,33 +57,8 @@ export class AbstractESAggSource extends AbstractESSource { return this.getMetricFieldForName(name); } - createField({ fieldName, label }) { - //if there is a corresponding field with a custom label, use that one. - if (!label) { - const matchField = this._metricFields.find(field => field.getName() === fieldName); - if (matchField) { - label = matchField.getLabel(); - } - } - - if (fieldName === COUNT_PROP_NAME) { - return new ESAggMetricField({ - aggType: COUNT_AGG_TYPE, - label: label, - source: this, - origin: this.getOriginForField(), - }); - } - //this only works because aggType is a fixed set and does not include the `_of_` string - const [aggType, docField] = fieldName.split(AGG_DELIMITER); - const esDocField = new ESDocField({ fieldName: docField, source: this }); - return new ESAggMetricField({ - label: label, - esDocField, - aggType, - source: this, - origin: this.getOriginForField(), - }); + createField() { + throw new Error('Cannot create a new field from just a fieldname for an es_agg_source.'); } hasMatchingMetricField(fieldName) {