Skip to content

Commit 8375dc4

Browse files
committed
Add lifecycle in the edit data stream options
1 parent 46ba862 commit 8375dc4

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

modules/data-streams/src/yamlRestTest/resources/rest-api-spec/test/data_stream/230_data_stream_options.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ teardown:
4545

4646
---
4747
"Edit data stream options":
48+
- requires:
49+
reason: "Data stream failures lifecycle was added in 8.19+"
50+
test_runner_features: [ capabilities, allowed_warnings ]
51+
capabilities:
52+
- method: POST
53+
path: /_data_stream/{target}/_options
54+
capabilities: [ 'failures_lifecycle' ]
55+
4856
- do:
4957
indices.get_data_stream_options:
5058
name: "failure-data-stream"
@@ -57,15 +65,18 @@ teardown:
5765
name: "failure-data-stream"
5866
body:
5967
failure_store:
60-
enabled: false
68+
lifecycle:
69+
data_retention: 30d
6170
- is_true: acknowledged
6271

6372
- do:
6473
indices.get_data_stream_options:
6574
name: "failure-data-stream"
6675
- length: { data_streams: 1 }
6776
- match: { data_streams.0.name: failure-data-stream }
68-
- match: { data_streams.0.options.failure_store.enabled: false }
77+
- is_false: data_streams.0.options.failure_store.enabled
78+
- match: { data_streams.0.options.failure_store.lifecycle.enabled: true }
79+
- match: { data_streams.0.options.failure_store.lifecycle.data_retention: 30d }
6980

7081
- do:
7182
indices.delete_data_stream_options:

server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutComponentTemplateAction.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.elasticsearch.client.internal.node.NodeClient;
1414
import org.elasticsearch.cluster.metadata.ComponentTemplate;
1515
import org.elasticsearch.cluster.metadata.DataStream;
16+
import org.elasticsearch.cluster.metadata.DataStreamFailureStore;
1617
import org.elasticsearch.rest.BaseRestHandler;
1718
import org.elasticsearch.rest.RestRequest;
1819
import org.elasticsearch.rest.Scope;
@@ -31,7 +32,10 @@
3132
public class RestPutComponentTemplateAction extends BaseRestHandler {
3233

3334
public static final String SUPPORTS_FAILURE_STORE = "failure_store_in_template";
34-
private static final Set<String> capabilities = Set.of(SUPPORTS_FAILURE_STORE);
35+
private static final Set<String> capabilities = Set.of(
36+
SUPPORTS_FAILURE_STORE,
37+
DataStreamFailureStore.FAILURES_LIFECYCLE_API_CAPABILITY
38+
);
3539

3640
@Override
3741
public List<Route> routes() {

server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutComposableIndexTemplateAction.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.elasticsearch.client.internal.node.NodeClient;
1414
import org.elasticsearch.cluster.metadata.ComposableIndexTemplate;
1515
import org.elasticsearch.cluster.metadata.DataStream;
16+
import org.elasticsearch.cluster.metadata.DataStreamFailureStore;
1617
import org.elasticsearch.rest.BaseRestHandler;
1718
import org.elasticsearch.rest.RestRequest;
1819
import org.elasticsearch.rest.Scope;
@@ -31,7 +32,10 @@
3132
@ServerlessScope(Scope.PUBLIC)
3233
public class RestPutComposableIndexTemplateAction extends BaseRestHandler {
3334

34-
private static final Set<String> capabilities = Set.of(SUPPORTS_FAILURE_STORE);
35+
private static final Set<String> capabilities = Set.of(
36+
SUPPORTS_FAILURE_STORE,
37+
DataStreamFailureStore.FAILURES_LIFECYCLE_API_CAPABILITY
38+
);
3539

3640
@Override
3741
public List<Route> routes() {

0 commit comments

Comments
 (0)