diff --git a/public/app/plugins/datasource/elasticsearch/metric_agg.js b/public/app/plugins/datasource/elasticsearch/metric_agg.js index 90c303a5722..88053b0efac 100644 --- a/public/app/plugins/datasource/elasticsearch/metric_agg.js +++ b/public/app/plugins/datasource/elasticsearch/metric_agg.js @@ -67,7 +67,6 @@ function (angular, _, queryDef) { } else if (!$scope.agg.field) { $scope.agg.field = 'select field'; } - switch($scope.agg.type) { case 'cardinality': { var precision_threshold = $scope.agg.settings.precision_threshold || ''; @@ -105,12 +104,12 @@ function (angular, _, queryDef) { case 'raw_document': { $scope.agg.settings.size = $scope.agg.settings.size || 500; $scope.settingsLinkText = 'Size: ' + $scope.agg.settings.size ; - $scope.target.metrics = [$scope.agg]; + $scope.target.metrics.splice(0,$scope.target.metrics.length, $scope.agg); + $scope.target.bucketAggs = []; break; } } - if ($scope.aggDef.supportsInlineScript) { // I know this stores the inline script twice // but having it like this simplifes the query_builder