diff --git a/public/app/plugins/datasource/elasticsearch/metric_agg.js b/public/app/plugins/datasource/elasticsearch/metric_agg.js index c4e04dad325..2073fbc3a55 100644 --- a/public/app/plugins/datasource/elasticsearch/metric_agg.js +++ b/public/app/plugins/datasource/elasticsearch/metric_agg.js @@ -78,6 +78,23 @@ function (angular, _, queryDef) { return $scope.getFields({$fieldType: 'number'}); }; + $scope.getMetrics = function() { + console.log($scope.target.metrics); + + var mets = _.filter($scope.target.metrics, function(x) { + return x.type !== 'moving_avg'; + }); + + mets = _.map(mets, function(m) { + return { text: m.type, type: m.id }; + }); + + console.log(mets); + + return $q.when(mets) + .then(uiSegmentSrv.transformToSegments(false)); + }; + $scope.addMetricAgg = function() { var addIndex = metricAggs.length; diff --git a/public/app/plugins/datasource/elasticsearch/partials/metricAgg.html b/public/app/plugins/datasource/elasticsearch/partials/metricAgg.html index 65030af5655..09f48e487eb 100644 --- a/public/app/plugins/datasource/elasticsearch/partials/metricAgg.html +++ b/public/app/plugins/datasource/elasticsearch/partials/metricAgg.html @@ -7,7 +7,10 @@
  • - + +
  • +
  • +
  • {{settingsLinkText}} diff --git a/public/app/plugins/datasource/elasticsearch/query_def.js b/public/app/plugins/datasource/elasticsearch/query_def.js index baab2378e9f..1f7d352a2cc 100644 --- a/public/app/plugins/datasource/elasticsearch/query_def.js +++ b/public/app/plugins/datasource/elasticsearch/query_def.js @@ -13,6 +13,7 @@ function (_) { {text: "Min", value: 'min', requiresField: true}, {text: "Extended Stats", value: 'extended_stats', requiresField: true}, {text: "Percentiles", value: 'percentiles', requiresField: true}, + {text: "Moving Avg", value: 'moving_avg', requiresField: false, requiresBucketsPath: true}, {text: "Unique Count", value: "cardinality", requiresField: true}, {text: "Raw Document", value: "raw_document", requiresField: false} ],