From e093178a4c28d4969bf3ec0d9654273b2ce18e37 Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Thu, 28 May 2026 09:43:50 +0000 Subject: [PATCH] [codegen] update to latest spec --- .../elasticsearch/doc-files/api-spec.html | 18 +- .../indices/DataStreamLifecycle.java | 74 ++++++ .../indices/GetDataLifecycleResponse.java | 31 +++ .../indices/RetentionSource.java | 70 ++++++ .../get_data_lifecycle/GlobalRetention.java | 215 ++++++++++++++++++ .../shutdown/PutNodeRequest.java | 14 +- 6 files changed, 408 insertions(+), 14 deletions(-) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/indices/RetentionSource.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_lifecycle/GlobalRetention.java diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html index ef28fc2023..be6f1527ba 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html @@ -1518,9 +1518,9 @@ 'indices._types.DataStreamFailureStore': 'indices/_types/DataStreamFailureStore.ts#L22-L37', 'indices._types.DataStreamFailureStoreTemplate': 'indices/_types/DataStreamFailureStore.ts#L39-L54', 'indices._types.DataStreamIndex': 'indices/_types/DataStream.ts#L142-L163', -'indices._types.DataStreamLifecycle': 'indices/_types/DataStreamLifecycle.ts#L25-L45', -'indices._types.DataStreamLifecycleRolloverConditions': 'indices/_types/DataStreamLifecycle.ts#L60-L72', -'indices._types.DataStreamLifecycleWithRollover': 'indices/_types/DataStreamLifecycle.ts#L47-L58', +'indices._types.DataStreamLifecycle': 'indices/_types/DataStreamLifecycle.ts#L25-L55', +'indices._types.DataStreamLifecycleRolloverConditions': 'indices/_types/DataStreamLifecycle.ts#L77-L89', +'indices._types.DataStreamLifecycleWithRollover': 'indices/_types/DataStreamLifecycle.ts#L64-L75', 'indices._types.DataStreamOptions': 'indices/_types/DataStreamOptions.ts#L25-L34', 'indices._types.DataStreamOptionsTemplate': 'indices/_types/DataStreamOptions.ts#L36-L41', 'indices._types.DataStreamTimestampField': 'indices/_types/DataStream.ts#L135-L140', @@ -1571,6 +1571,7 @@ 'indices._types.NumericFielddataFormat': 'indices/_types/NumericFielddataFormat.ts#L20-L23', 'indices._types.Queries': 'indices/_types/IndexSettings.ts#L417-L419', 'indices._types.RetentionLease': 'indices/_types/IndexSettings.ts#L66-L68', +'indices._types.RetentionSource': 'indices/_types/DataStreamLifecycle.ts#L57-L62', 'indices._types.SearchIdle': 'indices/_types/IndexSettings.ts#L253-L256', 'indices._types.SegmentSortMissing': 'indices/_types/IndexSegmentSort.ts#L43-L46', 'indices._types.SegmentSortMode': 'indices/_types/IndexSegmentSort.ts#L36-L41', @@ -1676,9 +1677,10 @@ 'indices.get_alias.Request': 'indices/get_alias/IndicesGetAliasRequest.ts#L23-L92', 'indices.get_alias.Response': 'indices/get_alias/IndicesGetAliasResponse.ts#L28-L37', 'indices.get_alias._types.IndexAliases': 'indices/get_alias/_types/response.ts#L24-L26', -'indices.get_data_lifecycle.DataStreamWithLifecycle': 'indices/get_data_lifecycle/IndicesGetDataLifecycleResponse.ts#L27-L30', +'indices.get_data_lifecycle.DataStreamWithLifecycle': 'indices/get_data_lifecycle/IndicesGetDataLifecycleResponse.ts#L31-L34', 'indices.get_data_lifecycle.Request': 'indices/get_data_lifecycle/IndicesGetDataLifecycleRequest.ts#L24-L69', -'indices.get_data_lifecycle.Response': 'indices/get_data_lifecycle/IndicesGetDataLifecycleResponse.ts#L23-L25', +'indices.get_data_lifecycle.Response': 'indices/get_data_lifecycle/IndicesGetDataLifecycleResponse.ts#L24-L29', +'indices.get_data_lifecycle._types.GlobalRetention': 'indices/get_data_lifecycle/_types/response.ts#L22-L25', 'indices.get_data_lifecycle_stats.DataStreamStats': 'indices/get_data_lifecycle_stats/IndicesGetDataLifecycleStatsResponse.ts#L46-L59', 'indices.get_data_lifecycle_stats.Request': 'indices/get_data_lifecycle_stats/IndicesGetDataLifecycleStatsRequest.ts#L23-L41', 'indices.get_data_lifecycle_stats.Response': 'indices/get_data_lifecycle_stats/IndicesGetDataLifecycleStatsResponse.ts#L24-L44', @@ -2963,7 +2965,7 @@ 'shutdown.get_node.ShardMigrationStatus': 'shutdown/get_node/ShutdownGetNodeResponse.ts#L52-L54', 'shutdown.get_node.ShutdownStatus': 'shutdown/get_node/ShutdownGetNodeResponse.ts#L45-L50', 'shutdown.get_node.ShutdownType': 'shutdown/get_node/ShutdownGetNodeResponse.ts#L40-L43', -'shutdown.put_node.Request': 'shutdown/put_node/ShutdownPutNodeRequest.ts#L25-L110', +'shutdown.put_node.Request': 'shutdown/put_node/ShutdownPutNodeRequest.ts#L25-L112', 'shutdown.put_node.Response': 'shutdown/put_node/ShutdownPutNodeResponse.ts#L22-L24', 'simulate.ingest.IngestDocumentSimulation': 'simulate/ingest/SimulateIngestResponse.ts#L35-L78', 'simulate.ingest.Request': 'simulate/ingest/SimulateIngestRequest.ts#L29-L102', @@ -3379,10 +3381,10 @@ if (hash.length > 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/fb6b5c55b2fdb0dd963d8902a0c7c427a2653371/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/a8838fac083a3243c20c519083dbe28c0dd1db87/specification/" + (paths[hash] || ""); - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamLifecycle.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamLifecycle.java index ddce28b528..2d78dbd409 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamLifecycle.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamLifecycle.java @@ -67,6 +67,12 @@ public class DataStreamLifecycle implements JsonpSerializable { @Nullable private final Time dataRetention; + @Nullable + private final Time effectiveRetention; + + @Nullable + private final RetentionSource retentionDeterminedBy; + private final List downsampling; @Nullable @@ -77,6 +83,8 @@ public class DataStreamLifecycle implements JsonpSerializable { protected DataStreamLifecycle(AbstractBuilder builder) { this.dataRetention = builder.dataRetention; + this.effectiveRetention = builder.effectiveRetention; + this.retentionDeterminedBy = builder.retentionDeterminedBy; this.downsampling = ApiTypeHelper.unmodifiable(builder.downsampling); this.enabled = builder.enabled; @@ -99,6 +107,26 @@ public final Time dataRetention() { return this.dataRetention; } + /** + * The least amount of time data should be kept by elasticsearch. + *

+ * API name: {@code effective_retention} + */ + @Nullable + public final Time effectiveRetention() { + return this.effectiveRetention; + } + + /** + * Configuration source that can influence the retention of a data stream. + *

+ * API name: {@code retention_determined_by} + */ + @Nullable + public final RetentionSource retentionDeterminedBy() { + return this.retentionDeterminedBy; + } + /** * The list of downsampling rounds to execute as part of this downsampling * configuration @@ -138,6 +166,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.dataRetention.serialize(generator, mapper); } + if (this.effectiveRetention != null) { + generator.writeKey("effective_retention"); + this.effectiveRetention.serialize(generator, mapper); + + } + if (this.retentionDeterminedBy != null) { + generator.writeKey("retention_determined_by"); + this.retentionDeterminedBy.serialize(generator, mapper); + } if (ApiTypeHelper.isDefined(this.downsampling)) { generator.writeKey("downsampling"); generator.writeStartArray(); @@ -194,6 +231,12 @@ public abstract static class AbstractBuilder downsampling; @@ -225,6 +268,35 @@ public final BuilderT dataRetention(Function> return this.dataRetention(fn.apply(new Time.Builder()).build()); } + /** + * The least amount of time data should be kept by elasticsearch. + *

+ * API name: {@code effective_retention} + */ + public final BuilderT effectiveRetention(@Nullable Time value) { + this.effectiveRetention = value; + return self(); + } + + /** + * The least amount of time data should be kept by elasticsearch. + *

+ * API name: {@code effective_retention} + */ + public final BuilderT effectiveRetention(Function> fn) { + return this.effectiveRetention(fn.apply(new Time.Builder()).build()); + } + + /** + * Configuration source that can influence the retention of a data stream. + *

+ * API name: {@code retention_determined_by} + */ + public final BuilderT retentionDeterminedBy(@Nullable RetentionSource value) { + this.retentionDeterminedBy = value; + return self(); + } + /** * The list of downsampling rounds to execute as part of this downsampling * configuration @@ -292,6 +364,8 @@ protected static > void setupDataStre ObjectDeserializer op) { op.add(AbstractBuilder::dataRetention, Time._DESERIALIZER, "data_retention"); + op.add(AbstractBuilder::effectiveRetention, Time._DESERIALIZER, "effective_retention"); + op.add(AbstractBuilder::retentionDeterminedBy, RetentionSource._DESERIALIZER, "retention_determined_by"); op.add(AbstractBuilder::downsampling, JsonpDeserializer.arrayDeserializer(DownsamplingRound._DESERIALIZER), "downsampling"); op.add(AbstractBuilder::enabled, JsonpDeserializer.booleanDeserializer(), "enabled"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataLifecycleResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataLifecycleResponse.java index b770acbe51..d3d9e46b55 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataLifecycleResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataLifecycleResponse.java @@ -20,6 +20,7 @@ package co.elastic.clients.elasticsearch.indices; import co.elastic.clients.elasticsearch.indices.get_data_lifecycle.DataStreamWithLifecycle; +import co.elastic.clients.elasticsearch.indices.get_data_lifecycle.GlobalRetention; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -63,11 +64,14 @@ public class GetDataLifecycleResponse implements JsonpSerializable { private final List dataStreams; + private final GlobalRetention globalRetention; + // --------------------------------------------------------------------------------------------- private GetDataLifecycleResponse(Builder builder) { this.dataStreams = ApiTypeHelper.unmodifiableRequired(builder.dataStreams, this, "dataStreams"); + this.globalRetention = ApiTypeHelper.requireNonNull(builder.globalRetention, this, "globalRetention"); } @@ -82,6 +86,13 @@ public final List dataStreams() { return this.dataStreams; } + /** + * Required - API name: {@code global_retention} + */ + public final GlobalRetention globalRetention() { + return this.globalRetention; + } + /** * Serialize this object to JSON. */ @@ -103,6 +114,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } + generator.writeKey("global_retention"); + this.globalRetention.serialize(generator, mapper); } @@ -122,6 +135,8 @@ public static class Builder extends WithJsonObjectBuilderBase ObjectBuilder { private List dataStreams; + private GlobalRetention globalRetention; + /** * Required - API name: {@code data_streams} *

@@ -152,6 +167,21 @@ public final Builder dataStreams( return dataStreams(fn.apply(new DataStreamWithLifecycle.Builder()).build()); } + /** + * Required - API name: {@code global_retention} + */ + public final Builder globalRetention(GlobalRetention value) { + this.globalRetention = value; + return this; + } + + /** + * Required - API name: {@code global_retention} + */ + public final Builder globalRetention(Function> fn) { + return this.globalRetention(fn.apply(new GlobalRetention.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -183,6 +213,7 @@ protected static void setupGetDataLifecycleResponseDeserializer( op.add(Builder::dataStreams, JsonpDeserializer.arrayDeserializer(DataStreamWithLifecycle._DESERIALIZER), "data_streams"); + op.add(Builder::globalRetention, GlobalRetention._DESERIALIZER, "global_retention"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/RetentionSource.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/RetentionSource.java new file mode 100644 index 0000000000..a44557325e --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/RetentionSource.java @@ -0,0 +1,70 @@ +/* + * 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. + */ + +package co.elastic.clients.elasticsearch.indices; + +import co.elastic.clients.json.JsonEnum; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public enum RetentionSource implements JsonEnum { + DataStreamConfiguration("data_stream_configuration"), + + DefaultGlobalRetention("default_global_retention"), + + MaxGlobalRetention("max_global_retention"), + + DefaultFailuresRetention("default_failures_retention"), + + ; + + private final String jsonValue; + + RetentionSource(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + RetentionSource.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_lifecycle/GlobalRetention.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_lifecycle/GlobalRetention.java new file mode 100644 index 0000000000..e7ed8cc8fb --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_lifecycle/GlobalRetention.java @@ -0,0 +1,215 @@ +/* + * 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. + */ + +package co.elastic.clients.elasticsearch.indices.get_data_lifecycle; + +import co.elastic.clients.elasticsearch._types.Time; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: indices.get_data_lifecycle._types.GlobalRetention + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class GlobalRetention implements JsonpSerializable { + @Nullable + private final Time maxRetention; + + @Nullable + private final Time defaultRetention; + + // --------------------------------------------------------------------------------------------- + + private GlobalRetention(Builder builder) { + + this.maxRetention = builder.maxRetention; + this.defaultRetention = builder.defaultRetention; + + } + + public static GlobalRetention of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code max_retention} + */ + @Nullable + public final Time maxRetention() { + return this.maxRetention; + } + + /** + * API name: {@code default_retention} + */ + @Nullable + public final Time defaultRetention() { + return this.defaultRetention; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (this.maxRetention != null) { + generator.writeKey("max_retention"); + this.maxRetention.serialize(generator, mapper); + + } + if (this.defaultRetention != null) { + generator.writeKey("default_retention"); + this.defaultRetention.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GlobalRetention}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private Time maxRetention; + + @Nullable + private Time defaultRetention; + + public Builder() { + } + private Builder(GlobalRetention instance) { + this.maxRetention = instance.maxRetention; + this.defaultRetention = instance.defaultRetention; + + } + /** + * API name: {@code max_retention} + */ + public final Builder maxRetention(@Nullable Time value) { + this.maxRetention = value; + return this; + } + + /** + * API name: {@code max_retention} + */ + public final Builder maxRetention(Function> fn) { + return this.maxRetention(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code default_retention} + */ + public final Builder defaultRetention(@Nullable Time value) { + this.defaultRetention = value; + return this; + } + + /** + * API name: {@code default_retention} + */ + public final Builder defaultRetention(Function> fn) { + return this.defaultRetention(fn.apply(new Time.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link GlobalRetention}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GlobalRetention build() { + _checkSingleUse(); + + return new GlobalRetention(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GlobalRetention} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + GlobalRetention::setupGlobalRetentionDeserializer); + + protected static void setupGlobalRetentionDeserializer(ObjectDeserializer op) { + + op.add(Builder::maxRetention, Time._DESERIALIZER, "max_retention"); + op.add(Builder::defaultRetention, Time._DESERIALIZER, "default_retention"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/PutNodeRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/PutNodeRequest.java index b70f1e3556..94b0a33bd0 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/PutNodeRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/PutNodeRequest.java @@ -127,9 +127,10 @@ public static PutNodeRequest of(Function> * Only valid if type is restart. Controls how long Elasticsearch will wait for * the node to restart and join the cluster before reassigning its shards to * other nodes. This works the same as delaying allocation with the - * index.unassigned.node_left.delayed_timeout setting. If you specify both a - * restart allocation delay and an index-level allocation delay, the longer of - * the two is used. + * index.unassigned.node_left.delayed_timeout setting. If you don't specify a + * restart allocation delay, a default value of 5 minutes will be used. If both + * a restart allocation delay and an index-level allocation delay are + * configured, the longer of the two is used. *

* API name: {@code allocation_delay} */ @@ -285,9 +286,10 @@ private Builder(PutNodeRequest instance) { * Only valid if type is restart. Controls how long Elasticsearch will wait for * the node to restart and join the cluster before reassigning its shards to * other nodes. This works the same as delaying allocation with the - * index.unassigned.node_left.delayed_timeout setting. If you specify both a - * restart allocation delay and an index-level allocation delay, the longer of - * the two is used. + * index.unassigned.node_left.delayed_timeout setting. If you don't specify a + * restart allocation delay, a default value of 5 minutes will be used. If both + * a restart allocation delay and an index-level allocation delay are + * configured, the longer of the two is used. *

* API name: {@code allocation_delay} */