diff --git a/public/app/plugins/datasource/elasticsearch/query_def.js b/public/app/plugins/datasource/elasticsearch/query_def.js index f5f4cc600e4..e84ff00aab9 100644 --- a/public/app/plugins/datasource/elasticsearch/query_def.js +++ b/public/app/plugins/datasource/elasticsearch/query_def.js @@ -96,7 +96,7 @@ function (_) { var self = this; var result = []; _.each(targets.metrics, function(metric) { - if (metric.type !== 'moving_avg') { + if (!self.isPipelineAgg(metric)) { result.push({text: self.describeMetric(metric), value: metric.id }); } }); diff --git a/public/app/plugins/datasource/elasticsearch/specs/query_def_specs.ts b/public/app/plugins/datasource/elasticsearch/specs/query_def_specs.ts index 7f8be653dfc..153639d3d9a 100644 --- a/public/app/plugins/datasource/elasticsearch/specs/query_def_specs.ts +++ b/public/app/plugins/datasource/elasticsearch/specs/query_def_specs.ts @@ -42,10 +42,24 @@ describe('ElasticQueryDef', function() { var response = QueryDef.getPipelineAggOptions(targets); - it('should return zero', function() { + it('should return one', function() { expect(response.length).to.be(1); }); }); + + describe('with derivatives targets', function() { + var targets = { + metrics: [ + { type: 'derivative', field: '@value' } + ] + }; + + var response = QueryDef.getPipelineAggOptions(targets); + + it('should return zero', function() { + expect(response.length).to.be(0); + }); + }); }); describe('isPipelineMetric', function() {