From ae0681f54f89f31376599798cc9c17adb9bdd976 Mon Sep 17 00:00:00 2001 From: Ivana Date: Fri, 10 Jul 2020 16:09:03 +0200 Subject: [PATCH] Rename legacy and new metrics --- .../app/plugins/datasource/elasticsearch/elastic_response.ts | 2 +- public/app/plugins/datasource/elasticsearch/metric_agg.ts | 4 ++-- public/app/plugins/datasource/elasticsearch/query_builder.ts | 4 ++-- public/app/plugins/datasource/elasticsearch/query_def.ts | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/public/app/plugins/datasource/elasticsearch/elastic_response.ts b/public/app/plugins/datasource/elasticsearch/elastic_response.ts index 505b7fe8d58..e2579b85a16 100644 --- a/public/app/plugins/datasource/elasticsearch/elastic_response.ts +++ b/public/app/plugins/datasource/elasticsearch/elastic_response.ts @@ -391,7 +391,7 @@ export class ElasticResponse { } getTimeSeries() { - if (this.targets.some((target: any) => target.metrics.some((metric: any) => metric.type === 'raw_document_v2'))) { + if (this.targets.some((target: any) => target.metrics.some((metric: any) => metric.type === 'raw_data'))) { return this.processResponseToDataFrames(false); } return this.processResponseToSeries(); diff --git a/public/app/plugins/datasource/elasticsearch/metric_agg.ts b/public/app/plugins/datasource/elasticsearch/metric_agg.ts index 869547feb69..7275c4293fb 100644 --- a/public/app/plugins/datasource/elasticsearch/metric_agg.ts +++ b/public/app/plugins/datasource/elasticsearch/metric_agg.ts @@ -102,7 +102,7 @@ export class ElasticMetricAggCtrl { break; } case 'raw_document': - case 'raw_document_v2': { + case 'raw_data': { $scope.agg.settings.size = $scope.agg.settings.size || 500; $scope.settingsLinkText = 'Size: ' + $scope.agg.settings.size; $scope.target.metrics.splice(0, $scope.target.metrics.length, $scope.agg); @@ -167,7 +167,7 @@ export class ElasticMetricAggCtrl { // reset back to metric/group by query if ( $scope.target.bucketAggs.length === 0 && - ($scope.agg.type !== 'raw_document' || $scope.agg.type !== 'raw_document_v2') + ($scope.agg.type !== 'raw_document' || $scope.agg.type !== 'raw_data') ) { $scope.target.bucketAggs = [queryDef.defaultBucketAgg()]; } diff --git a/public/app/plugins/datasource/elasticsearch/query_builder.ts b/public/app/plugins/datasource/elasticsearch/query_builder.ts index 1af06169b82..98c994cbfcd 100644 --- a/public/app/plugins/datasource/elasticsearch/query_builder.ts +++ b/public/app/plugins/datasource/elasticsearch/query_builder.ts @@ -213,7 +213,7 @@ export class ElasticQueryBuilder { if (target.bucketAggs.length === 0) { metric = target.metrics[0]; - if (!metric || !(metric.type === 'raw_document' || metric.type === 'raw_document_v2')) { + if (!metric || !(metric.type === 'raw_document' || metric.type === 'raw_data')) { throw { message: 'Invalid query' }; } } @@ -222,7 +222,7 @@ export class ElasticQueryBuilder { * Check if metric type is raw_document. If metric doesn't have size (or size is 0), update size to 500. * Otherwise it will not be a valid query and error will be thrown. */ - if (target.metrics?.[0]?.type === 'raw_document' || target.metrics?.[0]?.type === 'raw_document_v2') { + if (target.metrics?.[0]?.type === 'raw_document' || target.metrics?.[0]?.type === 'raw_data') { metric = target.metrics[0]; const size = (metric.settings && metric.settings.size !== 0 && metric.settings.size) || 500; return this.documentQuery(query, size); diff --git a/public/app/plugins/datasource/elasticsearch/query_def.ts b/public/app/plugins/datasource/elasticsearch/query_def.ts index 5892fabd07b..2a364c7a373 100644 --- a/public/app/plugins/datasource/elasticsearch/query_def.ts +++ b/public/app/plugins/datasource/elasticsearch/query_def.ts @@ -79,8 +79,8 @@ export const metricAggTypes = [ supportsMultipleBucketPaths: true, minVersion: 2, }, - { text: 'Raw Document', value: 'raw_document', requiresField: false }, - { text: 'Raw Document v2', value: 'raw_document_v2', requiresField: false }, + { text: 'Raw Document (legacy)', value: 'raw_document', requiresField: false }, + { text: 'Raw data', value: 'raw_data', requiresField: false }, { text: 'Logs', value: 'logs', requiresField: false }, ];