Skip to content

Commit

Permalink
Downsampling spec (#2259)
Browse files Browse the repository at this point in the history

This adds the specification for downsampling as part of
the data stream lifecycle.

The downsampling configuration is nullable (just like
data_retention) and itself can contain a nullable list
of downsampling rounds.

Each round consists of an after duration/timevalue field
and the downsample configuration (the fixed_interval)
  • Loading branch information
andreidan authored Aug 30, 2023
1 parent 9eefe89 commit b3a1e6f
Show file tree
Hide file tree
Showing 6 changed files with 182 additions and 4 deletions.
102 changes: 98 additions & 4 deletions output/schema/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions output/typescript/types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions specification/indices/_types/DataStreamLifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
import { Duration } from '@_types/Time'
import { long } from '@_types/Numeric'
import { ByteSize } from '@_types/common'
import { DataStreamLifecycleDownsampling } from '@indices/_types/DataStreamLifecycleDownsampling'

/**
* Data lifecycle denotes that a data stream is managed by the data stream lifecycle and contains the configuration.
*/
export class DataStreamLifecycle {
data_retention?: Duration
downsampling?: DataStreamLifecycleDownsampling
}

/**
Expand All @@ -39,6 +41,11 @@ export class DataStreamLifecycleWithRollover {
* When empty, every document in this data stream will be stored indefinitely.
*/
data_retention?: Duration

/**
* The downsampling configuration to execute for the managed backing index after rollover.
*/
downsampling?: DataStreamLifecycleDownsampling
/**
* The conditions which will trigger the rollover of a backing index as configured by the cluster setting `cluster.lifecycle.default.rollover`.
* This property is an implementation detail and it will only be retrieved when the query param `include_defaults` is set to true.
Expand Down
27 changes: 27 additions & 0 deletions specification/indices/_types/DataStreamLifecycleDownsampling.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { DownsamplingRound } from '@indices/_types/DownsamplingRound'

export class DataStreamLifecycleDownsampling {
/**
* The list of downsampling rounds to execute as part of this downsampling configuration
*/
rounds: DownsamplingRound[]
}
32 changes: 32 additions & 0 deletions specification/indices/_types/DownsamplingRound.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { Duration } from '@_types/Time'
import { DownsampleConfig } from '@indices/_types/Downsample'

export class DownsamplingRound {
/**
* The duration since rollover when this downsampling round should execute
*/
after: Duration
/**
* The downsample configuration to execute.
*/
config: DownsampleConfig
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import { RequestBase } from '@_types/Base'
import { DataStreamNames, ExpandWildcards } from '@_types/common'
import { Duration } from '@_types/Time'
import { DataStreamLifecycleDownsampling } from '@indices/_types/DataStreamLifecycleDownsampling'

/**
* Update the data lifecycle of the specified data streams.
Expand Down Expand Up @@ -65,5 +66,10 @@ export interface Request extends RequestBase {
* When empty, every document in this data stream will be stored indefinitely.
*/
data_retention?: Duration
/**
* If defined, every backing index will execute the configured downsampling configuration after the backing
* index is not the data stream write index anymore.
*/
downsampling?: DataStreamLifecycleDownsampling
}
}

0 comments on commit b3a1e6f

Please sign in to comment.