when selecting Raw Documet metric type, the $scope.target.metrics was replaced by [$scope.agg], however the pointer to this variables is shared with metricAggs. Instead we free the array and add $scope.agg