From 4c304039049712e3e41cb484b4e11d220374ea7b Mon Sep 17 00:00:00 2001 From: Alex Khomenko Date: Wed, 8 Mar 2023 13:12:44 +0200 Subject: [PATCH] Elastic Search: Fix BasePipelineMetricAggregation schema type (#64335) * Fix type * Tweak BaseBucketAggregation type * Remove comment --- .../schema-reference.md | 104 ++++++++--------- .../kinds/dataquery/types_dataquery_gen.go | 105 +++++++----------- .../datasource/elasticsearch/dataquery.cue | 7 +- .../datasource/elasticsearch/dataquery.gen.ts | 28 ++++- .../plugins/datasource/elasticsearch/types.ts | 69 +----------- 5 files changed, 126 insertions(+), 187 deletions(-) diff --git a/docs/sources/developers/kinds/composable/elasticsearchdataquery/schema-reference.md b/docs/sources/developers/kinds/composable/elasticsearchdataquery/schema-reference.md index 61a6f2af201..5bebae059db 100644 --- a/docs/sources/developers/kinds/composable/elasticsearchdataquery/schema-reference.md +++ b/docs/sources/developers/kinds/composable/elasticsearchdataquery/schema-reference.md @@ -38,90 +38,85 @@ It extends [DataQuery](#dataquery). It extends [BucketAggregationWithField](#bucketaggregationwithfield). -| Property | Type | Required | Description | -|------------|---------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*
Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | -| `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | -| `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | -| `settings` | [object](#settings) | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | +| Property | Type | Required | Description | +|------------|--------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*
Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | +| `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | +| `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | +| `settings` | | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | ### BucketAggregationWithField It extends [BaseBucketAggregation](#basebucketaggregation). -| Property | Type | Required | Description | -|------------|---------------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `id` | string | **Yes** | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* | -| `type` | string | **Yes** | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))*
Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | -| `field` | string | No | | -| `settings` | [object](#settings) | No | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* | +| Property | Type | Required | Description | +|------------|--------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `id` | string | **Yes** | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* | +| `type` | string | **Yes** | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))*
Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | +| `field` | string | No | | +| `settings` | | No | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* | ### BaseBucketAggregation -| Property | Type | Required | Description | -|------------|---------------------|----------|---------------------------------------------------------------------------------------------------| -| `id` | string | **Yes** | | -| `type` | string | **Yes** | Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | -| `settings` | [object](#settings) | No | | - -### Settings - -| Property | Type | Required | Description | -|----------|------|----------|-------------| +| Property | Type | Required | Description | +|------------|--------|----------|---------------------------------------------------------------------------------------------------| +| `id` | string | **Yes** | | +| `type` | string | **Yes** | Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | +| `settings` | | No | | ### Filters It extends [BaseBucketAggregation](#basebucketaggregation). -| Property | Type | Required | Description | -|------------|---------------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `id` | string | **Yes** | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* | -| `type` | string | **Yes** | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))*
Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | -| `settings` | [object](#settings) | No | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* | +| Property | Type | Required | Description | +|------------|--------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `id` | string | **Yes** | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* | +| `type` | string | **Yes** | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))*
Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | +| `settings` | | No | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* | ### GeoHashGrid It extends [BucketAggregationWithField](#bucketaggregationwithfield). -| Property | Type | Required | Description | -|------------|---------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*
Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | -| `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | -| `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | -| `settings` | [object](#settings) | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | +| Property | Type | Required | Description | +|------------|--------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*
Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | +| `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | +| `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | +| `settings` | | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | ### Histogram It extends [BucketAggregationWithField](#bucketaggregationwithfield). -| Property | Type | Required | Description | -|------------|---------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*
Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | -| `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | -| `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | -| `settings` | [object](#settings) | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | +| Property | Type | Required | Description | +|------------|--------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*
Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | +| `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | +| `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | +| `settings` | | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | ### Nested It extends [BucketAggregationWithField](#bucketaggregationwithfield). -| Property | Type | Required | Description | -|------------|---------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*
Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | -| `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | -| `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | -| `settings` | [object](#settings) | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | +| Property | Type | Required | Description | +|------------|--------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*
Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | +| `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | +| `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | +| `settings` | | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | ### Terms It extends [BucketAggregationWithField](#bucketaggregationwithfield). -| Property | Type | Required | Description | -|------------|---------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*
Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | -| `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | -| `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | -| `settings` | [object](#settings) | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | +| Property | Type | Required | Description | +|------------|--------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*
Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | +| `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | +| `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | +| `settings` | | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | ### DataQuery @@ -222,11 +217,11 @@ It extends [MetricAggregationWithField](#metricaggregationwithfield). | Property | Type | Required | Description | |---------------|---------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `type` | string | **Yes** | *(Inherited from [MetricAggregationWithField](#metricaggregationwithfield))*
Possible values are: `count`, `avg`, `sum`, `min`, `max`, `extended_stats`, `percentiles`, `cardinality`, `raw_document`, `raw_data`, `logs`, `rate`, `top_metrics`, `moving_avg`, `moving_fn`, `derivative`, `serial_diff`, `cumulative_sum`, `bucket_script`. | | `field` | string | No | *(Inherited from [MetricAggregationWithField](#metricaggregationwithfield))* | | `hide` | boolean | No | *(Inherited from [MetricAggregationWithField](#metricaggregationwithfield))* | | `id` | string | No | *(Inherited from [MetricAggregationWithField](#metricaggregationwithfield))* | | `pipelineAgg` | string | No | | -| `type` | string | No | *(Inherited from [MetricAggregationWithField](#metricaggregationwithfield))*
Possible values are: `count`, `avg`, `sum`, `min`, `max`, `extended_stats`, `percentiles`, `cardinality`, `raw_document`, `raw_data`, `logs`, `rate`, `top_metrics`, `moving_avg`, `moving_fn`, `derivative`, `serial_diff`, `cumulative_sum`, `bucket_script`. | ### MetricAggregationWithField @@ -279,6 +274,11 @@ It extends [BasePipelineMetricAggregation](#basepipelinemetricaggregation). | `pipelineAgg` | string | No | *(Inherited from [BasePipelineMetricAggregation](#basepipelinemetricaggregation))* | | `settings` | [object](#settings) | No | | +### Settings + +| Property | Type | Required | Description | +|----------|------|----------|-------------| + ### Meta | Property | Type | Required | Description | diff --git a/pkg/tsdb/elasticsearch/kinds/dataquery/types_dataquery_gen.go b/pkg/tsdb/elasticsearch/kinds/dataquery/types_dataquery_gen.go index 76c9aff0afb..84bf27931d0 100644 --- a/pkg/tsdb/elasticsearch/kinds/dataquery/types_dataquery_gen.go +++ b/pkg/tsdb/elasticsearch/kinds/dataquery/types_dataquery_gen.go @@ -62,25 +62,12 @@ const ( // Defines values for BasePipelineMetricAggregationType. const ( - BasePipelineMetricAggregationTypeAvg BasePipelineMetricAggregationType = "avg" BasePipelineMetricAggregationTypeBucketScript BasePipelineMetricAggregationType = "bucket_script" - BasePipelineMetricAggregationTypeCardinality BasePipelineMetricAggregationType = "cardinality" - BasePipelineMetricAggregationTypeCount BasePipelineMetricAggregationType = "count" BasePipelineMetricAggregationTypeCumulativeSum BasePipelineMetricAggregationType = "cumulative_sum" BasePipelineMetricAggregationTypeDerivative BasePipelineMetricAggregationType = "derivative" - BasePipelineMetricAggregationTypeExtendedStats BasePipelineMetricAggregationType = "extended_stats" - BasePipelineMetricAggregationTypeLogs BasePipelineMetricAggregationType = "logs" - BasePipelineMetricAggregationTypeMax BasePipelineMetricAggregationType = "max" - BasePipelineMetricAggregationTypeMin BasePipelineMetricAggregationType = "min" BasePipelineMetricAggregationTypeMovingAvg BasePipelineMetricAggregationType = "moving_avg" BasePipelineMetricAggregationTypeMovingFn BasePipelineMetricAggregationType = "moving_fn" - BasePipelineMetricAggregationTypePercentiles BasePipelineMetricAggregationType = "percentiles" - BasePipelineMetricAggregationTypeRate BasePipelineMetricAggregationType = "rate" - BasePipelineMetricAggregationTypeRawData BasePipelineMetricAggregationType = "raw_data" - BasePipelineMetricAggregationTypeRawDocument BasePipelineMetricAggregationType = "raw_document" BasePipelineMetricAggregationTypeSerialDiff BasePipelineMetricAggregationType = "serial_diff" - BasePipelineMetricAggregationTypeSum BasePipelineMetricAggregationType = "sum" - BasePipelineMetricAggregationTypeTopMetrics BasePipelineMetricAggregationType = "top_metrics" ) // Defines values for BucketAggregationSettingsOrder. @@ -457,7 +444,7 @@ type AverageType string // BaseBucketAggregation defines model for BaseBucketAggregation. type BaseBucketAggregation struct { Id string `json:"id"` - Settings map[string]interface{} `json:"settings,omitempty"` + Settings *interface{} `json:"settings,omitempty"` Type BaseBucketAggregationType `json:"type"` } @@ -498,35 +485,31 @@ type BasePipelineMetricAggregationType string // BucketAggregation defines model for BucketAggregation. type BucketAggregation struct { - Field *string `json:"field,omitempty"` - Id *string `json:"id,omitempty"` - Settings *BucketAggregationSettings `json:"settings,omitempty"` - Type *interface{} `json:"type,omitempty"` - union json.RawMessage + Field *string `json:"field,omitempty"` + Id *string `json:"id,omitempty"` + Settings *struct { + Filters []struct { + Label string `json:"label"` + Query string `json:"query"` + } `json:"filters,omitempty"` + Interval *string `json:"interval,omitempty"` + MinDocCount *string `json:"min_doc_count,omitempty"` + Missing *string `json:"missing,omitempty"` + Offset *string `json:"offset,omitempty"` + Order *BucketAggregationSettingsOrder `json:"order,omitempty"` + OrderBy *string `json:"orderBy,omitempty"` + Precision *string `json:"precision,omitempty"` + Size *string `json:"size,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + TrimEdges *string `json:"trimEdges,omitempty"` + } `json:"settings,omitempty"` + Type *interface{} `json:"type,omitempty"` + union json.RawMessage } // BucketAggregationSettingsOrder defines model for BucketAggregation.Settings.Order. type BucketAggregationSettingsOrder string -// BucketAggregationSettings defines model for BucketAggregation.Settings. -type BucketAggregationSettings struct { - Filters []struct { - Label string `json:"label"` - Query string `json:"query"` - } `json:"filters,omitempty"` - Interval *string `json:"interval,omitempty"` - MinDocCount *string `json:"min_doc_count,omitempty"` - Missing *string `json:"missing,omitempty"` - Offset *string `json:"offset,omitempty"` - Order *BucketAggregationSettingsOrder `json:"order,omitempty"` - OrderBy *string `json:"orderBy,omitempty"` - Precision *string `json:"precision,omitempty"` - Size *string `json:"size,omitempty"` - TimeZone *string `json:"timeZone,omitempty"` - TrimEdges *string `json:"trimEdges,omitempty"` - AdditionalProperties map[string]interface{} `json:"-"` -} - // BucketAggregationType defines model for BucketAggregationType. type BucketAggregationType string @@ -534,7 +517,7 @@ type BucketAggregationType string type BucketAggregationWithField struct { Field *string `json:"field,omitempty"` Id string `json:"id"` - Settings map[string]interface{} `json:"settings,omitempty"` + Settings *interface{} `json:"settings,omitempty"` Type BucketAggregationWithFieldType `json:"type"` } @@ -664,32 +647,28 @@ type ElasticsearchDataQuery struct { // BucketAggsSettingsOrder defines model for ElasticsearchDataQuery.BucketAggs.Settings.Order. type BucketAggsSettingsOrder string -// BucketAggsSettings defines model for ElasticsearchDataQuery.BucketAggs.Settings. -type BucketAggsSettings struct { - Filters []struct { - Label string `json:"label"` - Query string `json:"query"` - } `json:"filters,omitempty"` - Interval *string `json:"interval,omitempty"` - MinDocCount *string `json:"min_doc_count,omitempty"` - Missing *string `json:"missing,omitempty"` - Offset *string `json:"offset,omitempty"` - Order *BucketAggsSettingsOrder `json:"order,omitempty"` - OrderBy *string `json:"orderBy,omitempty"` - Precision *string `json:"precision,omitempty"` - Size *string `json:"size,omitempty"` - TimeZone *string `json:"timeZone,omitempty"` - TrimEdges *string `json:"trimEdges,omitempty"` - AdditionalProperties map[string]interface{} `json:"-"` -} - // BucketAggsItem defines model for ElasticsearchDataQuery.bucketAggs.Item. type BucketAggsItem struct { - Field *string `json:"field,omitempty"` - Id *string `json:"id,omitempty"` - Settings *BucketAggsSettings `json:"settings,omitempty"` - Type *interface{} `json:"type,omitempty"` - union json.RawMessage + Field *string `json:"field,omitempty"` + Id *string `json:"id,omitempty"` + Settings *struct { + Filters []struct { + Label string `json:"label"` + Query string `json:"query"` + } `json:"filters,omitempty"` + Interval *string `json:"interval,omitempty"` + MinDocCount *string `json:"min_doc_count,omitempty"` + Missing *string `json:"missing,omitempty"` + Offset *string `json:"offset,omitempty"` + Order *BucketAggsSettingsOrder `json:"order,omitempty"` + OrderBy *string `json:"orderBy,omitempty"` + Precision *string `json:"precision,omitempty"` + Size *string `json:"size,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + TrimEdges *string `json:"trimEdges,omitempty"` + } `json:"settings,omitempty"` + Type *interface{} `json:"type,omitempty"` + union json.RawMessage } // MetricsSettings defines model for ElasticsearchDataQuery.Metrics.Settings. diff --git a/public/app/plugins/datasource/elasticsearch/dataquery.cue b/public/app/plugins/datasource/elasticsearch/dataquery.cue index b96eaa63607..5baed2d2427 100644 --- a/public/app/plugins/datasource/elasticsearch/dataquery.cue +++ b/public/app/plugins/datasource/elasticsearch/dataquery.cue @@ -49,9 +49,9 @@ composableKinds: DataQuery: { #BucketAggregationType: "terms" | "filters" | "geohash_grid" | "date_histogram" | "histogram" | "nested" @cuetsy(kind="type") #BaseBucketAggregation: { - id: string - type: #BucketAggregationType - settings?: {...} + id: string + type: #BucketAggregationType + settings?: _ } @cuetsy(kind="interface") #BucketAggregationWithField: { @@ -287,6 +287,7 @@ composableKinds: DataQuery: { #BasePipelineMetricAggregation: { #MetricAggregationWithField pipelineAgg?: string + type: #PipelineMetricAggregationType } @cuetsy(kind="interface") #PipelineMetricAggregationWithMultipleBucketPaths: { diff --git a/public/app/plugins/datasource/elasticsearch/dataquery.gen.ts b/public/app/plugins/datasource/elasticsearch/dataquery.gen.ts index 21060f60a7b..edc0d5eaf8a 100644 --- a/public/app/plugins/datasource/elasticsearch/dataquery.gen.ts +++ b/public/app/plugins/datasource/elasticsearch/dataquery.gen.ts @@ -20,7 +20,7 @@ export type BucketAggregationType = ('terms' | 'filters' | 'geohash_grid' | 'dat export interface BaseBucketAggregation { id: string; - settings?: Record; + settings?: unknown; type: BucketAggregationType; } @@ -29,6 +29,13 @@ export interface BucketAggregationWithField extends BaseBucketAggregation { } export interface DateHistogram extends BucketAggregationWithField { + settings?: { + interval?: string; + min_doc_count?: string; + trimEdges?: string; + offset?: string; + timeZone?: string; + }; type: 'date_histogram'; } @@ -41,6 +48,10 @@ export interface DateHistogramSettings { } export interface Histogram extends BucketAggregationWithField { + settings?: { + interval?: string; + min_doc_count?: string; + }; type: 'histogram'; } @@ -52,10 +63,18 @@ export interface HistogramSettings { export type TermsOrder = ('desc' | 'asc'); export interface Nested extends BucketAggregationWithField { + settings?: Record; type: 'nested'; } export interface Terms extends BucketAggregationWithField { + settings?: { + order?: TermsOrder; + size?: string; + min_doc_count?: string; + orderBy?: string; + missing?: string; + }; type: 'terms'; } @@ -68,6 +87,9 @@ export interface TermsSettings { } export interface Filters extends BaseBucketAggregation { + settings?: { + filters?: Array; + }; type: 'filters'; } @@ -85,6 +107,9 @@ export const defaultFiltersSettings: Partial = { }; export interface GeoHashGrid extends BucketAggregationWithField { + settings?: { + precision?: string; + }; type: 'geohash_grid'; } @@ -234,6 +259,7 @@ export interface Rate extends MetricAggregationWithField { export interface BasePipelineMetricAggregation extends MetricAggregationWithField { pipelineAgg?: string; + type: PipelineMetricAggregationType; } export interface PipelineMetricAggregationWithMultipleBucketPaths extends BaseMetricAggregation { diff --git a/public/app/plugins/datasource/elasticsearch/types.ts b/public/app/plugins/datasource/elasticsearch/types.ts index 047ed748991..13979f8032c 100644 --- a/public/app/plugins/datasource/elasticsearch/types.ts +++ b/public/app/plugins/datasource/elasticsearch/types.ts @@ -2,7 +2,6 @@ import { DataSourceJsonData } from '@grafana/data'; import { BucketAggregationType, - Filter, MetricAggregation, MetricAggregationType, MovingAverageEWMAModelSettings, @@ -11,18 +10,9 @@ import { MovingAverageLinearModelSettings, MovingAverageModel, MovingAverageSimpleModelSettings, - PipelineMetricAggregationType, - TermsOrder, ExtendedStats, - BasePipelineMetricAggregation as SchemaBasePipelineMetricAggregation, - PipelineMetricAggregationWithMultipleBucketPaths as SchemaPipelineMetricAggregationWithMultipleBucketPaths, MovingAverage as SchemaMovingAverage, - Filters as SchemaFilters, - Terms as SchemaTerms, - DateHistogram as SchemaDateHistogram, - Histogram as SchemaHistogram, - GeoHashGrid as SchemaGeoHashGrid, - Nested as SchemaNested, + BucketAggregation, } from './dataquery.gen'; export * from './dataquery.gen'; @@ -30,17 +20,6 @@ export { Elasticsearch as ElasticsearchQuery } from './dataquery.gen'; export type MetricAggregationWithMeta = ExtendedStats; -// Start of temporary overrides because of incorrect type generation in dataquery.gen.ts -// TODO: Remove this once the type generation is fixed -export interface BasePipelineMetricAggregation extends SchemaBasePipelineMetricAggregation { - type: PipelineMetricAggregationType; -} - -export interface PipelineMetricAggregationWithMultipleBucketPaths - extends SchemaPipelineMetricAggregationWithMultipleBucketPaths { - type: PipelineMetricAggregationType; -} - export type MovingAverageModelSettings = Partial< Extract< | MovingAverageSimpleModelSettings @@ -56,52 +35,6 @@ export interface MovingAverage; } -export interface Filters extends SchemaFilters { - settings?: { - filters?: Filter[]; - }; -} - -export interface Terms extends SchemaTerms { - settings?: { - min_doc_count?: string; - missing?: string; - order?: TermsOrder; - orderBy?: string; - size?: string; - }; -} - -export interface DateHistogram extends SchemaDateHistogram { - settings?: { - interval?: string; - min_doc_count?: string; - offset?: string; - timeZone?: string; - trimEdges?: string; - }; -} - -export interface Histogram extends SchemaHistogram { - settings?: { - interval?: string; - min_doc_count?: string; - }; -} - -interface GeoHashGrid extends SchemaGeoHashGrid { - settings?: { - precision?: string; - }; -} - -interface Nested extends SchemaNested { - settings?: {}; -} - -export type BucketAggregation = DateHistogram | Histogram | Terms | Filters | GeoHashGrid | Nested; -// End of temporary overrides - export type Interval = 'Hourly' | 'Daily' | 'Weekly' | 'Monthly' | 'Yearly'; export interface ElasticsearchOptions extends DataSourceJsonData {