Downsample an index Technical preview; Added in 8.5.0

POST /{index}/_downsample/{target_index}

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).

Path parameters

  • index string Required

    Name of the time series index to downsample.

  • target_index string Required

    Name of the index to create.

application/json

Body Required

  • fixed_interval string Required

    The interval at which to aggregate the original time series index.

  • sampling_method string

    The sampling method used to reduce the documents; it can be either aggregate or last_value. Defaults to aggregate.

    Values are aggregate or last_value.

Responses

  • 200 application/json
POST /{index}/_downsample/{target_index}
curl \
 --request POST 'http://api.example.com/{index}/_downsample/{target_index}' \
 --header "Content-Type: application/json" \
 --data '"{\n  \"fixed_interval\": \"1d\"\n}"'
Request example
{
  "fixed_interval": "1d"
}