diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index a2337397e8..822ec39e04 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -16619,7 +16619,7 @@ "data stream" ], "summary": "Downsample an index", - "description": "Aggregate a time series (TSDS) index and store pre-computed statistical summaries (`min`, `max`, `sum`, `value_count` and `avg`) for each metric field grouped by a configured time interval.\nFor example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index.\nAll documents within an hour interval are summarized and stored as a single document in the downsample index.\n\nNOTE: Only indices in a time series data stream are supported.\nNeither field nor document level security can be defined on the source index.\nThe source index must be read only (`index.blocks.write: true`).", + "description": "Downsamples a time series (TSDS) index and reduces its size by keeping the last value or by pre-aggregating metrics:\n\n- When running in `aggregate` mode, it pre-calculates and stores statistical summaries (`min`, `max`, `sum`, `value_count` and `avg`)\nfor each metric field grouped by a configured time interval and their dimensions.\n- When running in `last_value` mode, it keeps the last value for each metric in the configured interval and their dimensions.\n\nFor example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index.\nAll documents within an hour interval are summarized and stored as a single document in the downsample index.\n\nNOTE: Only indices in a time series data stream are supported.\nNeither field nor document level security can be defined on the source index.\nThe source index must be read-only (`index.blocks.write: true`).", "operationId": "indices-downsample", "parameters": [ { @@ -88423,25 +88423,8 @@ } ] }, - "config": { - "description": "The downsample configuration to execute.", - "allOf": [ - { - "$ref": "#/components/schemas/indices._types.DownsampleConfig" - } - ] - } - }, - "required": [ - "after", - "config" - ] - }, - "indices._types.DownsampleConfig": { - "type": "object", - "properties": { "fixed_interval": { - "description": "The interval at which to aggregate the original time series index.", + "description": "The downsample interval.", "allOf": [ { "$ref": "#/components/schemas/_types.DurationLarge" @@ -88450,6 +88433,7 @@ } }, "required": [ + "after", "fixed_interval" ] }, @@ -97147,6 +97131,37 @@ } ] }, + "indices._types.DownsampleConfig": { + "type": "object", + "properties": { + "fixed_interval": { + "description": "The interval at which to aggregate the original time series index.", + "allOf": [ + { + "$ref": "#/components/schemas/_types.DurationLarge" + } + ] + }, + "sampling_method": { + "description": "The sampling method used to reduce the documents; it can be either `aggregate` or `last_value`. Defaults to `aggregate`.", + "allOf": [ + { + "$ref": "#/components/schemas/indices._types.SamplingMethod" + } + ] + } + }, + "required": [ + "fixed_interval" + ] + }, + "indices._types.SamplingMethod": { + "type": "string", + "enum": [ + "aggregate", + "last_value" + ] + }, "indices.explain_data_lifecycle.DataStreamLifecycleExplain": { "type": "object", "properties": { diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index fe34c83b3c..b772f29a13 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -60634,25 +60634,8 @@ } ] }, - "config": { - "description": "The downsample configuration to execute.", - "allOf": [ - { - "$ref": "#/components/schemas/indices._types.DownsampleConfig" - } - ] - } - }, - "required": [ - "after", - "config" - ] - }, - "indices._types.DownsampleConfig": { - "type": "object", - "properties": { "fixed_interval": { - "description": "The interval at which to aggregate the original time series index.", + "description": "The downsample interval.", "allOf": [ { "$ref": "#/components/schemas/_types.DurationLarge" @@ -60661,6 +60644,7 @@ } }, "required": [ + "after", "fixed_interval" ] }, diff --git a/output/schema/schema.json b/output/schema/schema.json index 3b4fd524e7..3da2b7a6a9 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -7407,7 +7407,7 @@ "stability": "experimental" } }, - "description": "Downsample an index.\nAggregate a time series (TSDS) index and store pre-computed statistical summaries (`min`, `max`, `sum`, `value_count` and `avg`) for each metric field grouped by a configured time interval.\nFor example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index.\nAll documents within an hour interval are summarized and stored as a single document in the downsample index.\n\nNOTE: Only indices in a time series data stream are supported.\nNeither field nor document level security can be defined on the source index.\nThe source index must be read only (`index.blocks.write: true`).", + "description": "Downsample an index.\nDownsamples a time series (TSDS) index and reduces its size by keeping the last value or by pre-aggregating metrics:\n\n- When running in `aggregate` mode, it pre-calculates and stores statistical summaries (`min`, `max`, `sum`, `value_count` and `avg`)\nfor each metric field grouped by a configured time interval and their dimensions.\n- When running in `last_value` mode, it keeps the last value for each metric in the configured interval and their dimensions.\n\nFor example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index.\nAll documents within an hour interval are summarized and stored as a single document in the downsample index.\n\nNOTE: Only indices in a time series data stream are supported.\nNeither field nor document level security can be defined on the source index.\nThe source index must be read-only (`index.blocks.write: true`).", "docId": "indices-downsample-data-stream", "docTag": "data stream", "docUrl": "https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-downsample", @@ -149515,9 +149515,21 @@ "namespace": "_types" } } + }, + { + "description": "The sampling method used to reduce the documents; it can be either `aggregate` or `last_value`. Defaults to `aggregate`.", + "name": "sampling_method", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SamplingMethod", + "namespace": "indices._types" + } + } } ], - "specLocation": "indices/_types/Downsample.ts#L22-L27" + "specLocation": "indices/_types/Downsample.ts#L22-L31" }, { "kind": "interface", @@ -149539,19 +149551,19 @@ } }, { - "description": "The downsample configuration to execute.", - "name": "config", + "description": "The downsample interval.", + "name": "fixed_interval", "required": true, "type": { "kind": "instance_of", "type": { - "name": "DownsampleConfig", - "namespace": "indices._types" + "name": "DurationLarge", + "namespace": "_types" } } } ], - "specLocation": "indices/_types/DownsamplingRound.ts#L23-L32" + "specLocation": "indices/_types/DownsamplingRound.ts#L22-L31" }, { "kind": "interface", @@ -152479,6 +152491,22 @@ ], "specLocation": "indices/_types/IndexSettings.ts#L66-L68" }, + { + "kind": "enum", + "members": [ + { + "name": "aggregate" + }, + { + "name": "last_value" + } + ], + "name": { + "name": "SamplingMethod", + "namespace": "indices._types" + }, + "specLocation": "indices/_types/Downsample.ts#L33-L36" + }, { "kind": "interface", "name": { @@ -157264,7 +157292,7 @@ } } }, - "description": "Downsample an index.\nAggregate a time series (TSDS) index and store pre-computed statistical summaries (`min`, `max`, `sum`, `value_count` and `avg`) for each metric field grouped by a configured time interval.\nFor example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index.\nAll documents within an hour interval are summarized and stored as a single document in the downsample index.\n\nNOTE: Only indices in a time series data stream are supported.\nNeither field nor document level security can be defined on the source index.\nThe source index must be read only (`index.blocks.write: true`).", + "description": "Downsample an index.\nDownsamples a time series (TSDS) index and reduces its size by keeping the last value or by pre-aggregating metrics:\n\n- When running in `aggregate` mode, it pre-calculates and stores statistical summaries (`min`, `max`, `sum`, `value_count` and `avg`)\nfor each metric field grouped by a configured time interval and their dimensions.\n- When running in `last_value` mode, it keeps the last value for each metric in the configured interval and their dimensions.\n\nFor example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index.\nAll documents within an hour interval are summarized and stored as a single document in the downsample index.\n\nNOTE: Only indices in a time series data stream are supported.\nNeither field nor document level security can be defined on the source index.\nThe source index must be read-only (`index.blocks.write: true`).", "examples": { "DownsampleRequestExample1": { "alternatives": [ @@ -157334,7 +157362,7 @@ } ], "query": [], - "specLocation": "indices/downsample/Request.ts#L24-L58" + "specLocation": "indices/downsample/Request.ts#L24-L63" }, { "kind": "response", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 0ec904e4a5..51111e9d9f 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -11926,11 +11926,12 @@ export interface IndicesDataStreamVisibility { export interface IndicesDownsampleConfig { fixed_interval: DurationLarge + sampling_method?: IndicesSamplingMethod } export interface IndicesDownsamplingRound { after: Duration - config: IndicesDownsampleConfig + fixed_interval: DurationLarge } export interface IndicesFailureStore { @@ -12226,6 +12227,8 @@ export interface IndicesRetentionLease { period: Duration } +export type IndicesSamplingMethod = 'aggregate' | 'last_value' + export interface IndicesSearchIdle { after?: Duration } diff --git a/specification/indices/_types/Downsample.ts b/specification/indices/_types/Downsample.ts index f34526fc48..46fa228a0c 100644 --- a/specification/indices/_types/Downsample.ts +++ b/specification/indices/_types/Downsample.ts @@ -24,4 +24,13 @@ export class DownsampleConfig { * The interval at which to aggregate the original time series index. */ fixed_interval: DurationLarge + /** + * The sampling method used to reduce the documents; it can be either `aggregate` or `last_value`. Defaults to `aggregate`. + */ + sampling_method?: SamplingMethod +} + +enum SamplingMethod { + aggregate, + last_value } diff --git a/specification/indices/_types/DownsamplingRound.ts b/specification/indices/_types/DownsamplingRound.ts index 71cb430c4d..7f0890ae88 100644 --- a/specification/indices/_types/DownsamplingRound.ts +++ b/specification/indices/_types/DownsamplingRound.ts @@ -17,8 +17,7 @@ * under the License. */ -import { Duration } from '@_types/Time' -import { DownsampleConfig } from '@indices/_types/Downsample' +import { Duration, DurationLarge } from '@_types/Time' export class DownsamplingRound { /** @@ -26,7 +25,7 @@ export class DownsamplingRound { */ after: Duration /** - * The downsample configuration to execute. + * The downsample interval. */ - config: DownsampleConfig + fixed_interval: DurationLarge } diff --git a/specification/indices/downsample/Request.ts b/specification/indices/downsample/Request.ts index 64e32d4d41..5fed5390a2 100644 --- a/specification/indices/downsample/Request.ts +++ b/specification/indices/downsample/Request.ts @@ -23,13 +23,18 @@ import { DownsampleConfig } from '@indices/_types/Downsample' /** * Downsample an index. - * Aggregate a time series (TSDS) index and store pre-computed statistical summaries (`min`, `max`, `sum`, `value_count` and `avg`) for each metric field grouped by a configured time interval. + * Downsamples a time series (TSDS) index and reduces its size by keeping the last value or by pre-aggregating metrics: + * + * - When running in `aggregate` mode, it pre-calculates and stores statistical summaries (`min`, `max`, `sum`, `value_count` and `avg`) + * for each metric field grouped by a configured time interval and their dimensions. + * - When running in `last_value` mode, it keeps the last value for each metric in the configured interval and their dimensions. + * * For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index. * All documents within an hour interval are summarized and stored as a single document in the downsample index. * * NOTE: Only indices in a time series data stream are supported. * Neither field nor document level security can be defined on the source index. - * The source index must be read only (`index.blocks.write: true`). + * The source index must be read-only (`index.blocks.write: true`). * @doc_id indices-downsample-data-stream * @rest_spec_name indices.downsample * @availability stack since=8.5.0 stability=experimental