Elastic Search: Fix BasePipelineMetricAggregation schema type (#64335)

* Fix type

* Tweak BaseBucketAggregation type

* Remove comment
This commit is contained in:
Alex Khomenko 2023-03-08 13:12:44 +02:00 committed by GitHub
parent 42c32504be
commit 4c30403904
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 126 additions and 187 deletions

View File

@ -38,90 +38,85 @@ It extends [DataQuery](#dataquery).
It extends [BucketAggregationWithField](#bucketaggregationwithfield). It extends [BucketAggregationWithField](#bucketaggregationwithfield).
| Property | Type | Required | Description | | Property | Type | Required | Description |
|------------|---------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |------------|--------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*<br/>Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | | `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*<br/>Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. |
| `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | | `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | | `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `settings` | [object](#settings) | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | | `settings` | | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
### BucketAggregationWithField ### BucketAggregationWithField
It extends [BaseBucketAggregation](#basebucketaggregation). It extends [BaseBucketAggregation](#basebucketaggregation).
| Property | Type | Required | Description | | Property | Type | Required | Description |
|------------|---------------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |------------|--------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `id` | string | **Yes** | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* | | `id` | string | **Yes** | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* |
| `type` | string | **Yes** | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))*<br/>Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | | `type` | string | **Yes** | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))*<br/>Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. |
| `field` | string | No | | | `field` | string | No | |
| `settings` | [object](#settings) | No | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* | | `settings` | | No | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* |
### BaseBucketAggregation ### BaseBucketAggregation
| Property | Type | Required | Description | | Property | Type | Required | Description |
|------------|---------------------|----------|---------------------------------------------------------------------------------------------------| |------------|--------|----------|---------------------------------------------------------------------------------------------------|
| `id` | string | **Yes** | | | `id` | string | **Yes** | |
| `type` | string | **Yes** | Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | | `type` | string | **Yes** | Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. |
| `settings` | [object](#settings) | No | | | `settings` | | No | |
### Settings
| Property | Type | Required | Description |
|----------|------|----------|-------------|
### Filters ### Filters
It extends [BaseBucketAggregation](#basebucketaggregation). It extends [BaseBucketAggregation](#basebucketaggregation).
| Property | Type | Required | Description | | Property | Type | Required | Description |
|------------|---------------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |------------|--------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `id` | string | **Yes** | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* | | `id` | string | **Yes** | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* |
| `type` | string | **Yes** | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))*<br/>Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | | `type` | string | **Yes** | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))*<br/>Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. |
| `settings` | [object](#settings) | No | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* | | `settings` | | No | *(Inherited from [BaseBucketAggregation](#basebucketaggregation))* |
### GeoHashGrid ### GeoHashGrid
It extends [BucketAggregationWithField](#bucketaggregationwithfield). It extends [BucketAggregationWithField](#bucketaggregationwithfield).
| Property | Type | Required | Description | | Property | Type | Required | Description |
|------------|---------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |------------|--------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*<br/>Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | | `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*<br/>Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. |
| `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | | `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | | `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `settings` | [object](#settings) | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | | `settings` | | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
### Histogram ### Histogram
It extends [BucketAggregationWithField](#bucketaggregationwithfield). It extends [BucketAggregationWithField](#bucketaggregationwithfield).
| Property | Type | Required | Description | | Property | Type | Required | Description |
|------------|---------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |------------|--------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*<br/>Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | | `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*<br/>Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. |
| `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | | `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | | `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `settings` | [object](#settings) | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | | `settings` | | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
### Nested ### Nested
It extends [BucketAggregationWithField](#bucketaggregationwithfield). It extends [BucketAggregationWithField](#bucketaggregationwithfield).
| Property | Type | Required | Description | | Property | Type | Required | Description |
|------------|---------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |------------|--------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*<br/>Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | | `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*<br/>Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. |
| `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | | `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | | `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `settings` | [object](#settings) | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | | `settings` | | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
### Terms ### Terms
It extends [BucketAggregationWithField](#bucketaggregationwithfield). It extends [BucketAggregationWithField](#bucketaggregationwithfield).
| Property | Type | Required | Description | | Property | Type | Required | Description |
|------------|---------------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |------------|--------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*<br/>Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. | | `type` | string | **Yes** | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))*<br/>Possible values are: `terms`, `filters`, `geohash_grid`, `date_histogram`, `histogram`, `nested`. |
| `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | | `field` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | | `id` | string | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
| `settings` | [object](#settings) | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* | | `settings` | | No | *(Inherited from [BucketAggregationWithField](#bucketaggregationwithfield))* |
### DataQuery ### DataQuery
@ -222,11 +217,11 @@ It extends [MetricAggregationWithField](#metricaggregationwithfield).
| Property | Type | Required | Description | | Property | Type | Required | Description |
|---------------|---------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |---------------|---------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | string | **Yes** | *(Inherited from [MetricAggregationWithField](#metricaggregationwithfield))*<br/>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))* | | `field` | string | No | *(Inherited from [MetricAggregationWithField](#metricaggregationwithfield))* |
| `hide` | boolean | No | *(Inherited from [MetricAggregationWithField](#metricaggregationwithfield))* | | `hide` | boolean | No | *(Inherited from [MetricAggregationWithField](#metricaggregationwithfield))* |
| `id` | string | No | *(Inherited from [MetricAggregationWithField](#metricaggregationwithfield))* | | `id` | string | No | *(Inherited from [MetricAggregationWithField](#metricaggregationwithfield))* |
| `pipelineAgg` | string | No | | | `pipelineAgg` | string | No | |
| `type` | string | No | *(Inherited from [MetricAggregationWithField](#metricaggregationwithfield))*<br/>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 ### MetricAggregationWithField
@ -279,6 +274,11 @@ It extends [BasePipelineMetricAggregation](#basepipelinemetricaggregation).
| `pipelineAgg` | string | No | *(Inherited from [BasePipelineMetricAggregation](#basepipelinemetricaggregation))* | | `pipelineAgg` | string | No | *(Inherited from [BasePipelineMetricAggregation](#basepipelinemetricaggregation))* |
| `settings` | [object](#settings) | No | | | `settings` | [object](#settings) | No | |
### Settings
| Property | Type | Required | Description |
|----------|------|----------|-------------|
### Meta ### Meta
| Property | Type | Required | Description | | Property | Type | Required | Description |

View File

@ -62,25 +62,12 @@ const (
// Defines values for BasePipelineMetricAggregationType. // Defines values for BasePipelineMetricAggregationType.
const ( const (
BasePipelineMetricAggregationTypeAvg BasePipelineMetricAggregationType = "avg"
BasePipelineMetricAggregationTypeBucketScript BasePipelineMetricAggregationType = "bucket_script" BasePipelineMetricAggregationTypeBucketScript BasePipelineMetricAggregationType = "bucket_script"
BasePipelineMetricAggregationTypeCardinality BasePipelineMetricAggregationType = "cardinality"
BasePipelineMetricAggregationTypeCount BasePipelineMetricAggregationType = "count"
BasePipelineMetricAggregationTypeCumulativeSum BasePipelineMetricAggregationType = "cumulative_sum" BasePipelineMetricAggregationTypeCumulativeSum BasePipelineMetricAggregationType = "cumulative_sum"
BasePipelineMetricAggregationTypeDerivative BasePipelineMetricAggregationType = "derivative" BasePipelineMetricAggregationTypeDerivative BasePipelineMetricAggregationType = "derivative"
BasePipelineMetricAggregationTypeExtendedStats BasePipelineMetricAggregationType = "extended_stats"
BasePipelineMetricAggregationTypeLogs BasePipelineMetricAggregationType = "logs"
BasePipelineMetricAggregationTypeMax BasePipelineMetricAggregationType = "max"
BasePipelineMetricAggregationTypeMin BasePipelineMetricAggregationType = "min"
BasePipelineMetricAggregationTypeMovingAvg BasePipelineMetricAggregationType = "moving_avg" BasePipelineMetricAggregationTypeMovingAvg BasePipelineMetricAggregationType = "moving_avg"
BasePipelineMetricAggregationTypeMovingFn BasePipelineMetricAggregationType = "moving_fn" BasePipelineMetricAggregationTypeMovingFn BasePipelineMetricAggregationType = "moving_fn"
BasePipelineMetricAggregationTypePercentiles BasePipelineMetricAggregationType = "percentiles"
BasePipelineMetricAggregationTypeRate BasePipelineMetricAggregationType = "rate"
BasePipelineMetricAggregationTypeRawData BasePipelineMetricAggregationType = "raw_data"
BasePipelineMetricAggregationTypeRawDocument BasePipelineMetricAggregationType = "raw_document"
BasePipelineMetricAggregationTypeSerialDiff BasePipelineMetricAggregationType = "serial_diff" BasePipelineMetricAggregationTypeSerialDiff BasePipelineMetricAggregationType = "serial_diff"
BasePipelineMetricAggregationTypeSum BasePipelineMetricAggregationType = "sum"
BasePipelineMetricAggregationTypeTopMetrics BasePipelineMetricAggregationType = "top_metrics"
) )
// Defines values for BucketAggregationSettingsOrder. // Defines values for BucketAggregationSettingsOrder.
@ -457,7 +444,7 @@ type AverageType string
// BaseBucketAggregation defines model for BaseBucketAggregation. // BaseBucketAggregation defines model for BaseBucketAggregation.
type BaseBucketAggregation struct { type BaseBucketAggregation struct {
Id string `json:"id"` Id string `json:"id"`
Settings map[string]interface{} `json:"settings,omitempty"` Settings *interface{} `json:"settings,omitempty"`
Type BaseBucketAggregationType `json:"type"` Type BaseBucketAggregationType `json:"type"`
} }
@ -498,35 +485,31 @@ type BasePipelineMetricAggregationType string
// BucketAggregation defines model for BucketAggregation. // BucketAggregation defines model for BucketAggregation.
type BucketAggregation struct { type BucketAggregation struct {
Field *string `json:"field,omitempty"` Field *string `json:"field,omitempty"`
Id *string `json:"id,omitempty"` Id *string `json:"id,omitempty"`
Settings *BucketAggregationSettings `json:"settings,omitempty"` Settings *struct {
Type *interface{} `json:"type,omitempty"` Filters []struct {
union json.RawMessage 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. // BucketAggregationSettingsOrder defines model for BucketAggregation.Settings.Order.
type BucketAggregationSettingsOrder string 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. // BucketAggregationType defines model for BucketAggregationType.
type BucketAggregationType string type BucketAggregationType string
@ -534,7 +517,7 @@ type BucketAggregationType string
type BucketAggregationWithField struct { type BucketAggregationWithField struct {
Field *string `json:"field,omitempty"` Field *string `json:"field,omitempty"`
Id string `json:"id"` Id string `json:"id"`
Settings map[string]interface{} `json:"settings,omitempty"` Settings *interface{} `json:"settings,omitempty"`
Type BucketAggregationWithFieldType `json:"type"` Type BucketAggregationWithFieldType `json:"type"`
} }
@ -664,32 +647,28 @@ type ElasticsearchDataQuery struct {
// BucketAggsSettingsOrder defines model for ElasticsearchDataQuery.BucketAggs.Settings.Order. // BucketAggsSettingsOrder defines model for ElasticsearchDataQuery.BucketAggs.Settings.Order.
type BucketAggsSettingsOrder string 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. // BucketAggsItem defines model for ElasticsearchDataQuery.bucketAggs.Item.
type BucketAggsItem struct { type BucketAggsItem struct {
Field *string `json:"field,omitempty"` Field *string `json:"field,omitempty"`
Id *string `json:"id,omitempty"` Id *string `json:"id,omitempty"`
Settings *BucketAggsSettings `json:"settings,omitempty"` Settings *struct {
Type *interface{} `json:"type,omitempty"` Filters []struct {
union json.RawMessage 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. // MetricsSettings defines model for ElasticsearchDataQuery.Metrics.Settings.

View File

@ -49,9 +49,9 @@ composableKinds: DataQuery: {
#BucketAggregationType: "terms" | "filters" | "geohash_grid" | "date_histogram" | "histogram" | "nested" @cuetsy(kind="type") #BucketAggregationType: "terms" | "filters" | "geohash_grid" | "date_histogram" | "histogram" | "nested" @cuetsy(kind="type")
#BaseBucketAggregation: { #BaseBucketAggregation: {
id: string id: string
type: #BucketAggregationType type: #BucketAggregationType
settings?: {...} settings?: _
} @cuetsy(kind="interface") } @cuetsy(kind="interface")
#BucketAggregationWithField: { #BucketAggregationWithField: {
@ -287,6 +287,7 @@ composableKinds: DataQuery: {
#BasePipelineMetricAggregation: { #BasePipelineMetricAggregation: {
#MetricAggregationWithField #MetricAggregationWithField
pipelineAgg?: string pipelineAgg?: string
type: #PipelineMetricAggregationType
} @cuetsy(kind="interface") } @cuetsy(kind="interface")
#PipelineMetricAggregationWithMultipleBucketPaths: { #PipelineMetricAggregationWithMultipleBucketPaths: {

View File

@ -20,7 +20,7 @@ export type BucketAggregationType = ('terms' | 'filters' | 'geohash_grid' | 'dat
export interface BaseBucketAggregation { export interface BaseBucketAggregation {
id: string; id: string;
settings?: Record<string, unknown>; settings?: unknown;
type: BucketAggregationType; type: BucketAggregationType;
} }
@ -29,6 +29,13 @@ export interface BucketAggregationWithField extends BaseBucketAggregation {
} }
export interface DateHistogram extends BucketAggregationWithField { export interface DateHistogram extends BucketAggregationWithField {
settings?: {
interval?: string;
min_doc_count?: string;
trimEdges?: string;
offset?: string;
timeZone?: string;
};
type: 'date_histogram'; type: 'date_histogram';
} }
@ -41,6 +48,10 @@ export interface DateHistogramSettings {
} }
export interface Histogram extends BucketAggregationWithField { export interface Histogram extends BucketAggregationWithField {
settings?: {
interval?: string;
min_doc_count?: string;
};
type: 'histogram'; type: 'histogram';
} }
@ -52,10 +63,18 @@ export interface HistogramSettings {
export type TermsOrder = ('desc' | 'asc'); export type TermsOrder = ('desc' | 'asc');
export interface Nested extends BucketAggregationWithField { export interface Nested extends BucketAggregationWithField {
settings?: Record<string, unknown>;
type: 'nested'; type: 'nested';
} }
export interface Terms extends BucketAggregationWithField { export interface Terms extends BucketAggregationWithField {
settings?: {
order?: TermsOrder;
size?: string;
min_doc_count?: string;
orderBy?: string;
missing?: string;
};
type: 'terms'; type: 'terms';
} }
@ -68,6 +87,9 @@ export interface TermsSettings {
} }
export interface Filters extends BaseBucketAggregation { export interface Filters extends BaseBucketAggregation {
settings?: {
filters?: Array<Filter>;
};
type: 'filters'; type: 'filters';
} }
@ -85,6 +107,9 @@ export const defaultFiltersSettings: Partial<FiltersSettings> = {
}; };
export interface GeoHashGrid extends BucketAggregationWithField { export interface GeoHashGrid extends BucketAggregationWithField {
settings?: {
precision?: string;
};
type: 'geohash_grid'; type: 'geohash_grid';
} }
@ -234,6 +259,7 @@ export interface Rate extends MetricAggregationWithField {
export interface BasePipelineMetricAggregation extends MetricAggregationWithField { export interface BasePipelineMetricAggregation extends MetricAggregationWithField {
pipelineAgg?: string; pipelineAgg?: string;
type: PipelineMetricAggregationType;
} }
export interface PipelineMetricAggregationWithMultipleBucketPaths extends BaseMetricAggregation { export interface PipelineMetricAggregationWithMultipleBucketPaths extends BaseMetricAggregation {

View File

@ -2,7 +2,6 @@ import { DataSourceJsonData } from '@grafana/data';
import { import {
BucketAggregationType, BucketAggregationType,
Filter,
MetricAggregation, MetricAggregation,
MetricAggregationType, MetricAggregationType,
MovingAverageEWMAModelSettings, MovingAverageEWMAModelSettings,
@ -11,18 +10,9 @@ import {
MovingAverageLinearModelSettings, MovingAverageLinearModelSettings,
MovingAverageModel, MovingAverageModel,
MovingAverageSimpleModelSettings, MovingAverageSimpleModelSettings,
PipelineMetricAggregationType,
TermsOrder,
ExtendedStats, ExtendedStats,
BasePipelineMetricAggregation as SchemaBasePipelineMetricAggregation,
PipelineMetricAggregationWithMultipleBucketPaths as SchemaPipelineMetricAggregationWithMultipleBucketPaths,
MovingAverage as SchemaMovingAverage, MovingAverage as SchemaMovingAverage,
Filters as SchemaFilters, BucketAggregation,
Terms as SchemaTerms,
DateHistogram as SchemaDateHistogram,
Histogram as SchemaHistogram,
GeoHashGrid as SchemaGeoHashGrid,
Nested as SchemaNested,
} from './dataquery.gen'; } from './dataquery.gen';
export * from './dataquery.gen'; export * from './dataquery.gen';
@ -30,17 +20,6 @@ export { Elasticsearch as ElasticsearchQuery } from './dataquery.gen';
export type MetricAggregationWithMeta = ExtendedStats; 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<T extends MovingAverageModel = MovingAverageModel> = Partial< export type MovingAverageModelSettings<T extends MovingAverageModel = MovingAverageModel> = Partial<
Extract< Extract<
| MovingAverageSimpleModelSettings | MovingAverageSimpleModelSettings
@ -56,52 +35,6 @@ export interface MovingAverage<T extends MovingAverageModel = MovingAverageModel
settings?: MovingAverageModelSettings<T>; settings?: MovingAverageModelSettings<T>;
} }
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 type Interval = 'Hourly' | 'Daily' | 'Weekly' | 'Monthly' | 'Yearly';
export interface ElasticsearchOptions extends DataSourceJsonData { export interface ElasticsearchOptions extends DataSourceJsonData {