mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Elasticsearch: Name fields after template variables values instead of their name (#36035)
This reverts commit 185bf8f9a2
.
This commit is contained in:
parent
e6e7ba209c
commit
a97259f07d
@ -35,7 +35,6 @@ import {
|
|||||||
import { bucketAggregationConfig } from './components/QueryEditor/BucketAggregationsEditor/utils';
|
import { bucketAggregationConfig } from './components/QueryEditor/BucketAggregationsEditor/utils';
|
||||||
import {
|
import {
|
||||||
BucketAggregation,
|
BucketAggregation,
|
||||||
BucketAggregationWithField,
|
|
||||||
isBucketAggregationWithField,
|
isBucketAggregationWithField,
|
||||||
} from './components/QueryEditor/BucketAggregationsEditor/aggregations';
|
} from './components/QueryEditor/BucketAggregationsEditor/aggregations';
|
||||||
import { generate, Observable, of, throwError } from 'rxjs';
|
import { generate, Observable, of, throwError } from 'rxjs';
|
||||||
@ -391,23 +390,7 @@ export class ElasticDatasource extends DataSourceApi<ElasticsearchQuery, Elastic
|
|||||||
this.templateSrv.replace(JSON.stringify(expandedQueries), scopedVars)
|
this.templateSrv.replace(JSON.stringify(expandedQueries), scopedVars)
|
||||||
);
|
);
|
||||||
|
|
||||||
// FIXME: with 8.0 we introduced an undocumented breaking change on how we name frames fields.
|
return finalQueries;
|
||||||
// Although the introduced behavior is correct, it wasn't documented.
|
|
||||||
// The following lines will restore the previous behaviour for 8.0, to be removed with a proper
|
|
||||||
// changelog in 8.1 by returning `finalQueries` without any further modification
|
|
||||||
return finalQueries.map((q, queryIndex) => ({
|
|
||||||
...q,
|
|
||||||
bucketAggs: q.bucketAggs?.map((bucketAgg, aggIndex) => {
|
|
||||||
if (isBucketAggregationWithField(bucketAgg)) {
|
|
||||||
return {
|
|
||||||
...bucketAgg,
|
|
||||||
field: (queries[queryIndex].bucketAggs?.[aggIndex] as BucketAggregationWithField).field,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return bucketAgg;
|
|
||||||
}),
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
testDatasource() {
|
testDatasource() {
|
||||||
|
Loading…
Reference in New Issue
Block a user