Skip to content

Commit 9e0c174

Browse files
committed
Add sampling method to the DownsamplingConfig
1 parent 1ad1665 commit 9e0c174

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

specification/indices/_types/Downsample.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,13 @@ export class DownsampleConfig {
2424
* The interval at which to aggregate the original time series index.
2525
*/
2626
fixed_interval: DurationLarge
27+
/**
28+
* The sampling method used to reduce the documents; it can be either `aggregate` or `last_value`. Defaults to `aggregate`.
29+
*/
30+
sampling_method?: SamplingMethod
31+
}
32+
33+
enum SamplingMethod {
34+
aggregate,
35+
last_value
2736
}

specification/indices/downsample/Request.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,18 @@ import { DownsampleConfig } from '@indices/_types/Downsample'
2323

2424
/**
2525
* Downsample an index.
26-
* 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.
26+
* Downsamples a time series (TSDS) index and reduces its size by keeping the last value or by pre-aggregating metrics:
27+
*
28+
* - When running in `aggregate` mode, it pre-calculates and stores statistical summaries (`min`, `max`, `sum`, `value_count` and `avg`)
29+
* for each metric field grouped by a configured time interval and their dimensions.
30+
* - When running in `last_value` mode, it keeps the last value for each metric in the configured interval and their dimensions.
31+
*
2732
* For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index.
2833
* All documents within an hour interval are summarized and stored as a single document in the downsample index.
2934
*
3035
* NOTE: Only indices in a time series data stream are supported.
3136
* Neither field nor document level security can be defined on the source index.
32-
* The source index must be read only (`index.blocks.write: true`).
37+
* The source index must be read-only (`index.blocks.write: true`).
3338
* @doc_id indices-downsample-data-stream
3439
* @rest_spec_name indices.downsample
3540
* @availability stack since=8.5.0 stability=experimental

0 commit comments

Comments
 (0)