Skip to content

Commit 636ab1c

Browse files
masseykepquentin
andauthored
Adding specification for the new data stream settings APIs (#4416) (#5342)
(cherry picked from commit 9e631d8) Co-authored-by: Quentin Pradet <[email protected]>
1 parent 44822e9 commit 636ab1c

15 files changed

+979
-16
lines changed

output/schema/schema.json

Lines changed: 516 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/typescript/types.ts

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/_doc_ids/table.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,13 +315,15 @@ indices-exists,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/
315315
indices-flush,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-flush.html,,
316316
indices-forcemerge,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-forcemerge.html,,
317317
indices-get-alias,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-get-alias.html,,
318+
indices-get-data-stream-settings,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-get-data-stream-settings.html,,
318319
indices-get-field-mapping,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-get-field-mapping.html,,
319320
indices-get-index,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-get-index.html,,
320321
indices-get-mapping,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-get-mapping.html,,
321322
indices-get-settings,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-get-settings.html,,
322323
indices-get-template,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-get-template.html,,
323324
indices-get-template-v1,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-get-template-v1.html,,
324325
indices-open-close,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-open-close.html,,
326+
indices-put-data-stream-settings,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-put-data-stream-settings.html,,
325327
indices-put-mapping,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-put-mapping.html,,
326328
indices-recovery,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-recovery.html,,
327329
indices-refresh,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/indices-refresh.html,,

specification/_json_spec/indices.put_data_stream_settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
},
3232
"timeout": {
3333
"type": "time",
34-
"description": "Period to wait for a response"
34+
"description": "Period to wait for a response",
35+
"default": "30s"
3536
},
3637
"master_timeout": {
3738
"type": "time",

specification/indices/_types/DataStream.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
} from '@_types/common'
2929
import { integer } from '@_types/Numeric'
3030
import { DataStreamLifecycleWithRollover } from '@indices/_types/DataStreamLifecycle'
31+
import { IndexSettings } from '@indices/_types/IndexSettings'
3132

3233
enum ManagedBy {
3334
ilm = 'Index Lifecycle Management',
@@ -104,6 +105,11 @@ export class DataStream {
104105
* If `true`, the next write to this data stream will trigger a rollover first and the document will be indexed in the new backing index. If the rollover fails the indexing request will fail too.
105106
*/
106107
rollover_on_write: boolean
108+
/**
109+
* The settings specific to this data stream that will take precedence over the settings in the matching index
110+
* template.
111+
*/
112+
settings: IndexSettings
107113
/**
108114
* Health status of the data stream.
109115
* This health status is based on the state of the primary and replica shards of the stream’s backing indices.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { RequestBase } from '@_types/Base'
21+
import { Indices } from '@_types/common'
22+
import { Duration } from '@_types/Time'
23+
24+
/**
25+
* Get data stream settings.
26+
*
27+
* Get setting information for one or more data streams.
28+
* @rest_spec_name indices.get_data_stream_settings
29+
* @availability stack stability=stable visibility=public
30+
* @availability serverless stability=stable visibility=public
31+
* @index_privileges view_index_metadata
32+
* @doc_id indices-get-data-stream-settings
33+
* @doc_tag data stream
34+
*/
35+
export interface Request extends RequestBase {
36+
urls: [
37+
{
38+
path: '/_data_stream/{name}/_settings'
39+
methods: ['GET']
40+
}
41+
]
42+
path_parts: {
43+
/**
44+
* A comma-separated list of data streams or data stream patterns. Supports wildcards (`*`).
45+
*/
46+
name: Indices
47+
}
48+
query_parameters: {
49+
/**
50+
* The period to wait for a connection to the master node. If no response is
51+
* received before the timeout expires, the request fails and returns an
52+
* error.
53+
* @server_default 30s
54+
*/
55+
master_timeout?: Duration
56+
}
57+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { IndexSettings } from '@indices/_types/IndexSettings'
21+
22+
export class Response {
23+
/** @codegen_name data_stream_settings */
24+
body: {
25+
data_streams: Array<DataStreamSettings>
26+
}
27+
}
28+
29+
export class DataStreamSettings {
30+
/** The name of the data stream. */
31+
name: string
32+
/** The settings specific to this data stream */
33+
settings: IndexSettings
34+
/**
35+
* The settings specific to this data stream merged with the settings from its template. These `effective_settings`
36+
* are the settings that will be used when a new index is created for this data stream.
37+
*/
38+
effective_settings: IndexSettings
39+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
summary: Get data stream settings on a data stream
2+
description: >
3+
This is a response to `GET /_data_stream/my-data-stream/_settings` where my-data-stream that has two settings set. The
4+
`effective_settings` field shows additional settings that are pulled from its template.
5+
# type: response
6+
# response_code: 200
7+
value: |-
8+
{
9+
"data_streams": [
10+
{
11+
"name": "my-data-stream",
12+
"settings": {
13+
"index": {
14+
"lifecycle": {
15+
"name": "new-test-policy"
16+
},
17+
"number_of_shards": "11"
18+
}
19+
},
20+
"effective_settings": {
21+
"index": {
22+
"lifecycle": {
23+
"name": "new-test-policy"
24+
},
25+
"mode": "standard",
26+
"number_of_shards": "11",
27+
"number_of_replicas": "0"
28+
}
29+
}
30+
}
31+
]
32+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { RequestBase } from '@_types/Base'
21+
import { Indices } from '@_types/common'
22+
import { Duration } from '@_types/Time'
23+
import { IndexSettings } from '@indices/_types/IndexSettings'
24+
25+
/**
26+
* Update data stream settings.
27+
*
28+
* This API can be used to override settings on specific data streams. These overrides will take precedence over what
29+
* is specified in the template that the data stream matches. To prevent your data stream from getting into an invalid state,
30+
* only certain settings are allowed. If possible, the setting change is applied to all
31+
* backing indices. Otherwise, it will be applied when the data stream is next rolled over.
32+
* @rest_spec_name indices.put_data_stream_settings
33+
* @availability stack stability=stable visibility=public
34+
* @availability serverless stability=stable visibility=public
35+
* @index_privileges manage
36+
* @doc_id indices-put-data-stream-settings
37+
* @doc_tag data stream
38+
*/
39+
export interface Request extends RequestBase {
40+
urls: [
41+
{
42+
path: '/_data_stream/{name}/_settings'
43+
methods: ['PUT']
44+
}
45+
]
46+
path_parts: {
47+
/**
48+
* A comma-separated list of data streams or data stream patterns.
49+
*/
50+
name: Indices
51+
}
52+
query_parameters: {
53+
/**
54+
* If `true`, the request does not actually change the settings on any data streams or indices. Instead, it
55+
* simulates changing the settings and reports back to the user what would have happened had these settings
56+
* actually been applied.
57+
* @server_default false
58+
*/
59+
dry_run?: boolean
60+
/**
61+
* The period to wait for a connection to the master node. If no response is
62+
* received before the timeout expires, the request fails and returns an
63+
* error.
64+
* @server_default 30s
65+
*/
66+
master_timeout?: Duration
67+
/**
68+
* The period to wait for a response. If no response is received before the
69+
* timeout expires, the request fails and returns an error.
70+
* @server_default 30s
71+
*/
72+
timeout?: Duration
73+
}
74+
/** Settings to be applied to the data stream.
75+
* @codegen_name settings */
76+
body: IndexSettings
77+
}

0 commit comments

Comments
 (0)