diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/Embedding.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/Embedding.java new file mode 100644 index 0000000000..7206a884c7 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/Embedding.java @@ -0,0 +1,248 @@ +/* + * 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._types; + +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.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +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: _types.Embedding + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class Embedding implements QueryVectorBuilderVariant, JsonpSerializable { + @Nullable + private final String inferenceId; + + private final KnnEmbeddingInput input; + + @Nullable + private final Time timeout; + + // --------------------------------------------------------------------------------------------- + + private Embedding(Builder builder) { + + this.inferenceId = builder.inferenceId; + this.input = ApiTypeHelper.requireNonNull(builder.input, this, "input"); + this.timeout = builder.timeout; + + } + + public static Embedding of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * QueryVectorBuilder variant kind. + */ + @Override + public QueryVectorBuilder.Kind _queryVectorBuilderKind() { + return QueryVectorBuilder.Kind.Embedding; + } + + /** + * API name: {@code inference_id} + */ + @Nullable + public final String inferenceId() { + return this.inferenceId; + } + + /** + * Required - API name: {@code input} + */ + public final KnnEmbeddingInput input() { + return this.input; + } + + /** + * API name: {@code timeout} + */ + @Nullable + public final Time timeout() { + return this.timeout; + } + + /** + * 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.inferenceId != null) { + generator.writeKey("inference_id"); + generator.write(this.inferenceId); + + } + generator.writeKey("input"); + this.input.serialize(generator, mapper); + + if (this.timeout != null) { + generator.writeKey("timeout"); + this.timeout.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Embedding}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private String inferenceId; + + private KnnEmbeddingInput input; + + @Nullable + private Time timeout; + + public Builder() { + } + private Builder(Embedding instance) { + this.inferenceId = instance.inferenceId; + this.input = instance.input; + this.timeout = instance.timeout; + + } + /** + * API name: {@code inference_id} + */ + public final Builder inferenceId(@Nullable String value) { + this.inferenceId = value; + return this; + } + + /** + * Required - API name: {@code input} + */ + public final Builder input(KnnEmbeddingInput value) { + this.input = value; + return this; + } + + /** + * Required - API name: {@code input} + */ + public final Builder input(Function> fn) { + return this.input(fn.apply(new KnnEmbeddingInput.Builder()).build()); + } + + /** + * API name: {@code timeout} + */ + public final Builder timeout(@Nullable Time value) { + this.timeout = value; + return this; + } + + /** + * API name: {@code timeout} + */ + public final Builder timeout(Function> fn) { + return this.timeout(fn.apply(new Time.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link Embedding}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public Embedding build() { + _checkSingleUse(); + + return new Embedding(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Embedding} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Embedding::setupEmbeddingDeserializer); + + protected static void setupEmbeddingDeserializer(ObjectDeserializer op) { + + op.add(Builder::inferenceId, JsonpDeserializer.stringDeserializer(), "inference_id"); + op.add(Builder::input, KnnEmbeddingInput._DESERIALIZER, "input"); + op.add(Builder::timeout, Time._DESERIALIZER, "timeout"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/InferenceString.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/InferenceString.java new file mode 100644 index 0000000000..f0fa0acb7b --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/InferenceString.java @@ -0,0 +1,236 @@ +/* + * 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._types; + +import co.elastic.clients.elasticsearch.inference.EmbeddingContentFormat; +import co.elastic.clients.elasticsearch.inference.EmbeddingContentType; +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.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +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: _types.InferenceString + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class InferenceString implements JsonpSerializable { + private final EmbeddingContentType type; + + @Nullable + private final EmbeddingContentFormat format; + + private final String value; + + // --------------------------------------------------------------------------------------------- + + private InferenceString(Builder builder) { + + this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); + this.format = builder.format; + this.value = ApiTypeHelper.requireNonNull(builder.value, this, "value"); + + } + + public static InferenceString of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The type of data that the value represents. + *

+ * API name: {@code type} + */ + public final EmbeddingContentType type() { + return this.type; + } + + /** + * The format of the data. If null, the default data format for the given type + * is used. + *

+ * API name: {@code format} + */ + @Nullable + public final EmbeddingContentFormat format() { + return this.format; + } + + /** + * Required - String which may be raw text, or the string representation of some + * other data such as an image in base64. + *

+ * API name: {@code value} + */ + public final String value() { + return this.value; + } + + /** + * 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) { + + generator.writeKey("type"); + this.type.serialize(generator, mapper); + if (this.format != null) { + generator.writeKey("format"); + this.format.serialize(generator, mapper); + } + generator.writeKey("value"); + generator.write(this.value); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link InferenceString}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private EmbeddingContentType type; + + @Nullable + private EmbeddingContentFormat format; + + private String value; + + public Builder() { + } + private Builder(InferenceString instance) { + this.type = instance.type; + this.format = instance.format; + this.value = instance.value; + + } + /** + * Required - The type of data that the value represents. + *

+ * API name: {@code type} + */ + public final Builder type(EmbeddingContentType value) { + this.type = value; + return this; + } + + /** + * The format of the data. If null, the default data format for the given type + * is used. + *

+ * API name: {@code format} + */ + public final Builder format(@Nullable EmbeddingContentFormat value) { + this.format = value; + return this; + } + + /** + * Required - String which may be raw text, or the string representation of some + * other data such as an image in base64. + *

+ * API name: {@code value} + */ + public final Builder value(String value) { + this.value = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link InferenceString}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public InferenceString build() { + _checkSingleUse(); + + return new InferenceString(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link InferenceString} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + InferenceString::setupInferenceStringDeserializer); + + protected static void setupInferenceStringDeserializer(ObjectDeserializer op) { + + op.add(Builder::type, EmbeddingContentType._DESERIALIZER, "type"); + op.add(Builder::format, EmbeddingContentFormat._DESERIALIZER, "format"); + op.add(Builder::value, JsonpDeserializer.stringDeserializer(), "value"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/KnnEmbeddingInput.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/KnnEmbeddingInput.java new file mode 100644 index 0000000000..eb5b734c2b --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/KnnEmbeddingInput.java @@ -0,0 +1,196 @@ +/* + * 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._types; + +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.ObjectDeserializer; +import co.elastic.clients.json.UnionDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import co.elastic.clients.util.TaggedUnion; +import co.elastic.clients.util.TaggedUnionUtils; +import jakarta.json.stream.JsonGenerator; +import java.lang.Object; +import java.lang.String; +import java.util.List; +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: _types.KnnEmbeddingInput + +/** + * Knn embedding input. Either a string, an object or array of objects + * + * @see API + * specification + */ +@JsonpDeserializable +public class KnnEmbeddingInput implements TaggedUnion, JsonpSerializable { + + public enum Kind { + Object, String + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + private KnnEmbeddingInput(Kind kind, Object value) { + this._kind = kind; + this._value = value; + } + + private KnnEmbeddingInput(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static KnnEmbeddingInput of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code object}? + */ + public boolean isObject() { + return _kind == Kind.Object; + } + + /** + * Get the {@code object} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code object} kind. + */ + public List object() { + return TaggedUnionUtils.get(this, Kind.Object); + } + + /** + * Is this variant instance of kind {@code string}? + */ + public boolean isString() { + return _kind == Kind.String; + } + + /** + * Get the {@code string} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code string} kind. + */ + public String string() { + return TaggedUnionUtils.get(this, Kind.String); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } else { + switch (_kind) { + case Object : + generator.writeStartArray(); + for (InferenceString item0 : ((List) this._value)) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + break; + case String : + generator.write(((String) this._value)); + + break; + } + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + public ObjectBuilder object(List v) { + this._kind = Kind.Object; + this._value = v; + return this; + } + + public ObjectBuilder string(String v) { + this._kind = Kind.String; + this._value = v; + return this; + } + + public KnnEmbeddingInput build() { + _checkSingleUse(); + return new KnnEmbeddingInput(this); + } + + } + + private static JsonpDeserializer buildKnnEmbeddingInputDeserializer() { + return new UnionDeserializer.Builder(KnnEmbeddingInput::new, false) + .addMember(Kind.Object, JsonpDeserializer.arrayDeserializer(InferenceString._DESERIALIZER)) + .addMember(Kind.String, JsonpDeserializer.stringDeserializer()).build(); + } + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer + .lazy(KnnEmbeddingInput::buildKnnEmbeddingInputDeserializer); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/KnnEmbeddingInputBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/KnnEmbeddingInputBuilders.java new file mode 100644 index 0000000000..ef73449631 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/KnnEmbeddingInputBuilders.java @@ -0,0 +1,52 @@ +/* + * 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._types; + +import co.elastic.clients.util.ObjectBuilder; +import java.util.function.Function; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * Builders for {@link KnnEmbeddingInput} variants. + *

+ * Variants object, string are not available here as + * they don't have a dedicated class. Use {@link KnnEmbeddingInput}'s builder + * for these. + * + */ +public class KnnEmbeddingInputBuilders { + private KnnEmbeddingInputBuilders() { + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/QueryVectorBuilder.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/QueryVectorBuilder.java index 2975a72ec4..84ea367c73 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/QueryVectorBuilder.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/QueryVectorBuilder.java @@ -71,6 +71,8 @@ public class QueryVectorBuilder implements TaggedUnion protected Builder self() { return this; } + public ObjectBuilder embedding(Embedding v) { + this._kind = Kind.Embedding; + this._value = v; + return this; + } + + public ObjectBuilder embedding(Function> fn) { + return this.embedding(fn.apply(new Embedding.Builder()).build()); + } + public ObjectBuilder textEmbedding(TextEmbedding v) { this._kind = Kind.TextEmbedding; this._value = v; @@ -215,6 +244,7 @@ public QueryVectorBuilder build() { protected static void setupQueryVectorBuilderDeserializer(ObjectDeserializer op) { + op.add(Builder::embedding, Embedding._DESERIALIZER, "embedding"); op.add(Builder::textEmbedding, TextEmbedding._DESERIALIZER, "text_embedding"); op.add(Builder::lookup, LookupQueryVectorBuilder._DESERIALIZER, "lookup"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/QueryVectorBuilderBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/QueryVectorBuilderBuilders.java index c7aba3d3f9..f1ad73a56a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/QueryVectorBuilderBuilders.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/QueryVectorBuilderBuilders.java @@ -44,6 +44,24 @@ public class QueryVectorBuilderBuilders { private QueryVectorBuilderBuilders() { } + /** + * Creates a builder for the {@link Embedding embedding} + * {@code QueryVectorBuilder} variant. + */ + public static Embedding.Builder embedding() { + return new Embedding.Builder(); + } + + /** + * Creates a QueryVectorBuilder of the {@link Embedding embedding} + * {@code QueryVectorBuilder} variant. + */ + public static QueryVectorBuilder embedding(Function> fn) { + QueryVectorBuilder.Builder builder = new QueryVectorBuilder.Builder(); + builder.embedding(fn.apply(new Embedding.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link TextEmbedding text_embedding} * {@code QueryVectorBuilder} variant. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/stats/CharFilterTypes.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/stats/CharFilterTypes.java index 1f9f0777af..207df68c3a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/stats/CharFilterTypes.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/stats/CharFilterTypes.java @@ -74,6 +74,9 @@ public class CharFilterTypes implements JsonpSerializable { private final List charFilterTypes; + @Nullable + private final MultipleSynonymGraphFilter multipleSynonymGraphFilters; + private final List filterTypes; private final List tokenizerTypes; @@ -92,6 +95,7 @@ private CharFilterTypes(Builder builder) { this.builtInTokenizers = ApiTypeHelper.unmodifiableRequired(builder.builtInTokenizers, this, "builtInTokenizers"); this.charFilterTypes = ApiTypeHelper.unmodifiableRequired(builder.charFilterTypes, this, "charFilterTypes"); + this.multipleSynonymGraphFilters = builder.multipleSynonymGraphFilters; this.filterTypes = ApiTypeHelper.unmodifiableRequired(builder.filterTypes, this, "filterTypes"); this.tokenizerTypes = ApiTypeHelper.unmodifiableRequired(builder.tokenizerTypes, this, "tokenizerTypes"); this.synonyms = ApiTypeHelper.unmodifiableRequired(builder.synonyms, this, "synonyms"); @@ -161,6 +165,14 @@ public final List charFilterTypes() { return this.charFilterTypes; } + /** + * API name: {@code multiple_synonym_graph_filters} + */ + @Nullable + public final MultipleSynonymGraphFilter multipleSynonymGraphFilters() { + return this.multipleSynonymGraphFilters; + } + /** * Required - Contains statistics about token filter types used in selected * nodes. @@ -259,6 +271,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (this.multipleSynonymGraphFilters != null) { + generator.writeKey("multiple_synonym_graph_filters"); + this.multipleSynonymGraphFilters.serialize(generator, mapper); + } if (ApiTypeHelper.isDefined(this.filterTypes)) { generator.writeKey("filter_types"); @@ -318,6 +335,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement private List charFilterTypes; + @Nullable + private MultipleSynonymGraphFilter multipleSynonymGraphFilters; + private List filterTypes; private List tokenizerTypes; @@ -333,6 +353,7 @@ private Builder(CharFilterTypes instance) { this.builtInFilters = instance.builtInFilters; this.builtInTokenizers = instance.builtInTokenizers; this.charFilterTypes = instance.charFilterTypes; + this.multipleSynonymGraphFilters = instance.multipleSynonymGraphFilters; this.filterTypes = instance.filterTypes; this.tokenizerTypes = instance.tokenizerTypes; this.synonyms = instance.synonyms; @@ -563,6 +584,22 @@ public final Builder charFilterTypes(Function> fn) { + return this.multipleSynonymGraphFilters(fn.apply(new MultipleSynonymGraphFilter.Builder()).build()); + } + /** * Required - Contains statistics about token filter types used in selected * nodes. @@ -716,6 +753,8 @@ protected static void setupCharFilterTypesDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class MultipleSynonymGraphFilter implements JsonpSerializable { + @Nullable + private final Integer analyzerCount; + + @Nullable + private final Integer indexCount; + + // --------------------------------------------------------------------------------------------- + + private MultipleSynonymGraphFilter(Builder builder) { + + this.analyzerCount = builder.analyzerCount; + this.indexCount = builder.indexCount; + + } + + public static MultipleSynonymGraphFilter of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Number of analyzers across the cluster whose filter chain contains more than + * one synonym_graph filter. + *

+ * API name: {@code analyzer_count} + */ + @Nullable + public final Integer analyzerCount() { + return this.analyzerCount; + } + + /** + * Number of indices that contain at least one analyzer with more than one + * synonym_graph filter. + *

+ * API name: {@code index_count} + */ + @Nullable + public final Integer indexCount() { + return this.indexCount; + } + + /** + * 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.analyzerCount != null) { + generator.writeKey("analyzer_count"); + generator.write(this.analyzerCount); + + } + if (this.indexCount != null) { + generator.writeKey("index_count"); + generator.write(this.indexCount); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link MultipleSynonymGraphFilter}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private Integer analyzerCount; + + @Nullable + private Integer indexCount; + + public Builder() { + } + private Builder(MultipleSynonymGraphFilter instance) { + this.analyzerCount = instance.analyzerCount; + this.indexCount = instance.indexCount; + + } + /** + * Number of analyzers across the cluster whose filter chain contains more than + * one synonym_graph filter. + *

+ * API name: {@code analyzer_count} + */ + public final Builder analyzerCount(@Nullable Integer value) { + this.analyzerCount = value; + return this; + } + + /** + * Number of indices that contain at least one analyzer with more than one + * synonym_graph filter. + *

+ * API name: {@code index_count} + */ + public final Builder indexCount(@Nullable Integer value) { + this.indexCount = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link MultipleSynonymGraphFilter}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public MultipleSynonymGraphFilter build() { + _checkSingleUse(); + + return new MultipleSynonymGraphFilter(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link MultipleSynonymGraphFilter} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, MultipleSynonymGraphFilter::setupMultipleSynonymGraphFilterDeserializer); + + protected static void setupMultipleSynonymGraphFilterDeserializer( + ObjectDeserializer op) { + + op.add(Builder::analyzerCount, JsonpDeserializer.integerDeserializer(), "analyzer_count"); + op.add(Builder::indexCount, JsonpDeserializer.integerDeserializer(), "index_count"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex_rethrottle/ParentReindexStatus.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex_rethrottle/ParentReindexStatus.java new file mode 100644 index 0000000000..26951ffaf7 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex_rethrottle/ParentReindexStatus.java @@ -0,0 +1,708 @@ +/* + * 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.core.reindex_rethrottle; + +import co.elastic.clients.elasticsearch._types.ReindexStatus; +import co.elastic.clients.elasticsearch._types.Retries; +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.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Float; +import java.lang.Integer; +import java.lang.Long; +import java.lang.String; +import java.util.List; +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: _global.reindex_rethrottle.ParentReindexStatus + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ParentReindexStatus implements JsonpSerializable { + private final List slices; + + @Nullable + private final Integer sliceId; + + private final long batches; + + @Nullable + private final Long created; + + private final long deleted; + + private final long noops; + + private final float requestsPerSecond; + + private final Retries retries; + + @Nullable + private final Time throttled; + + private final long throttledMillis; + + @Nullable + private final Time throttledUntil; + + private final long throttledUntilMillis; + + private final long total; + + @Nullable + private final Long updated; + + private final long versionConflicts; + + @Nullable + private final String cancelled; + + // --------------------------------------------------------------------------------------------- + + private ParentReindexStatus(Builder builder) { + + this.slices = ApiTypeHelper.unmodifiable(builder.slices); + this.sliceId = builder.sliceId; + this.batches = ApiTypeHelper.requireNonNull(builder.batches, this, "batches", 0); + this.created = builder.created; + this.deleted = ApiTypeHelper.requireNonNull(builder.deleted, this, "deleted", 0); + this.noops = ApiTypeHelper.requireNonNull(builder.noops, this, "noops", 0); + this.requestsPerSecond = ApiTypeHelper.requireNonNull(builder.requestsPerSecond, this, "requestsPerSecond", 0); + this.retries = ApiTypeHelper.requireNonNull(builder.retries, this, "retries"); + this.throttled = builder.throttled; + this.throttledMillis = ApiTypeHelper.requireNonNull(builder.throttledMillis, this, "throttledMillis", 0); + this.throttledUntil = builder.throttledUntil; + this.throttledUntilMillis = ApiTypeHelper.requireNonNull(builder.throttledUntilMillis, this, + "throttledUntilMillis", 0); + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total", 0); + this.updated = builder.updated; + this.versionConflicts = ApiTypeHelper.requireNonNull(builder.versionConflicts, this, "versionConflicts", 0); + this.cancelled = builder.cancelled; + + } + + public static ParentReindexStatus of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code slices} + */ + public final List slices() { + return this.slices; + } + + /** + * The slice ID + *

+ * API name: {@code slice_id} + */ + @Nullable + public final Integer sliceId() { + return this.sliceId; + } + + /** + * Required - The number of scroll responses pulled back by the reindex. + *

+ * API name: {@code batches} + */ + public final long batches() { + return this.batches; + } + + /** + * The number of documents that were successfully created. + *

+ * API name: {@code created} + */ + @Nullable + public final Long created() { + return this.created; + } + + /** + * Required - The number of documents that were successfully deleted. + *

+ * API name: {@code deleted} + */ + public final long deleted() { + return this.deleted; + } + + /** + * Required - The number of documents that were ignored because the script used + * for the reindex returned a noop value for ctx.op. + *

+ * API name: {@code noops} + */ + public final long noops() { + return this.noops; + } + + /** + * Required - The number of requests per second effectively executed during the + * reindex. + *

+ * API name: {@code requests_per_second} + */ + public final float requestsPerSecond() { + return this.requestsPerSecond; + } + + /** + * Required - The number of retries attempted by reindex. bulk is + * the number of bulk actions retried and search is the number of + * search actions retried. + *

+ * API name: {@code retries} + */ + public final Retries retries() { + return this.retries; + } + + /** + * API name: {@code throttled} + */ + @Nullable + public final Time throttled() { + return this.throttled; + } + + /** + * Required - Number of milliseconds the request slept to conform to + * requests_per_second. + *

+ * API name: {@code throttled_millis} + */ + public final long throttledMillis() { + return this.throttledMillis; + } + + /** + * API name: {@code throttled_until} + */ + @Nullable + public final Time throttledUntil() { + return this.throttledUntil; + } + + /** + * Required - This field should always be equal to zero in a + * _reindex response. It only has meaning when using the Task API, + * where it indicates the next time (in milliseconds since epoch) a throttled + * request will be executed again in order to conform to + * requests_per_second. + *

+ * API name: {@code throttled_until_millis} + */ + public final long throttledUntilMillis() { + return this.throttledUntilMillis; + } + + /** + * Required - The number of documents that were successfully processed. + *

+ * API name: {@code total} + */ + public final long total() { + return this.total; + } + + /** + * The number of documents that were successfully updated, for example, a + * document with same ID already existed prior to reindex updating it. + *

+ * API name: {@code updated} + */ + @Nullable + public final Long updated() { + return this.updated; + } + + /** + * Required - The number of version conflicts that reindex hits. + *

+ * API name: {@code version_conflicts} + */ + public final long versionConflicts() { + return this.versionConflicts; + } + + /** + * The reason for cancellation if the slice was canceled + *

+ * API name: {@code cancelled} + */ + @Nullable + public final String cancelled() { + return this.cancelled; + } + + /** + * 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 (ApiTypeHelper.isDefined(this.slices)) { + generator.writeKey("slices"); + generator.writeStartArray(); + for (ReindexStatus item0 : this.slices) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (this.sliceId != null) { + generator.writeKey("slice_id"); + generator.write(this.sliceId); + + } + generator.writeKey("batches"); + generator.write(this.batches); + + if (this.created != null) { + generator.writeKey("created"); + generator.write(this.created); + + } + generator.writeKey("deleted"); + generator.write(this.deleted); + + generator.writeKey("noops"); + generator.write(this.noops); + + generator.writeKey("requests_per_second"); + generator.write(this.requestsPerSecond); + + generator.writeKey("retries"); + this.retries.serialize(generator, mapper); + + if (this.throttled != null) { + generator.writeKey("throttled"); + this.throttled.serialize(generator, mapper); + + } + generator.writeKey("throttled_millis"); + generator.write(this.throttledMillis); + + if (this.throttledUntil != null) { + generator.writeKey("throttled_until"); + this.throttledUntil.serialize(generator, mapper); + + } + generator.writeKey("throttled_until_millis"); + generator.write(this.throttledUntilMillis); + + generator.writeKey("total"); + generator.write(this.total); + + if (this.updated != null) { + generator.writeKey("updated"); + generator.write(this.updated); + + } + generator.writeKey("version_conflicts"); + generator.write(this.versionConflicts); + + if (this.cancelled != null) { + generator.writeKey("cancelled"); + generator.write(this.cancelled); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ParentReindexStatus}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private List slices; + + @Nullable + private Integer sliceId; + + private Long batches; + + @Nullable + private Long created; + + private Long deleted; + + private Long noops; + + private Float requestsPerSecond; + + private Retries retries; + + @Nullable + private Time throttled; + + private Long throttledMillis; + + @Nullable + private Time throttledUntil; + + private Long throttledUntilMillis; + + private Long total; + + @Nullable + private Long updated; + + private Long versionConflicts; + + @Nullable + private String cancelled; + + public Builder() { + } + private Builder(ParentReindexStatus instance) { + this.slices = instance.slices; + this.sliceId = instance.sliceId; + this.batches = instance.batches; + this.created = instance.created; + this.deleted = instance.deleted; + this.noops = instance.noops; + this.requestsPerSecond = instance.requestsPerSecond; + this.retries = instance.retries; + this.throttled = instance.throttled; + this.throttledMillis = instance.throttledMillis; + this.throttledUntil = instance.throttledUntil; + this.throttledUntilMillis = instance.throttledUntilMillis; + this.total = instance.total; + this.updated = instance.updated; + this.versionConflicts = instance.versionConflicts; + this.cancelled = instance.cancelled; + + } + /** + * API name: {@code slices} + *

+ * Adds all elements of list to slices. + */ + public final Builder slices(List list) { + this.slices = _listAddAll(this.slices, list); + return this; + } + + /** + * API name: {@code slices} + *

+ * Adds one or more values to slices. + */ + public final Builder slices(ReindexStatus value, ReindexStatus... values) { + this.slices = _listAdd(this.slices, value, values); + return this; + } + + /** + * API name: {@code slices} + *

+ * Adds a value to slices using a builder lambda. + */ + public final Builder slices(Function> fn) { + return slices(fn.apply(new ReindexStatus.Builder()).build()); + } + + /** + * The slice ID + *

+ * API name: {@code slice_id} + */ + public final Builder sliceId(@Nullable Integer value) { + this.sliceId = value; + return this; + } + + /** + * Required - The number of scroll responses pulled back by the reindex. + *

+ * API name: {@code batches} + */ + public final Builder batches(long value) { + this.batches = value; + return this; + } + + /** + * The number of documents that were successfully created. + *

+ * API name: {@code created} + */ + public final Builder created(@Nullable Long value) { + this.created = value; + return this; + } + + /** + * Required - The number of documents that were successfully deleted. + *

+ * API name: {@code deleted} + */ + public final Builder deleted(long value) { + this.deleted = value; + return this; + } + + /** + * Required - The number of documents that were ignored because the script used + * for the reindex returned a noop value for ctx.op. + *

+ * API name: {@code noops} + */ + public final Builder noops(long value) { + this.noops = value; + return this; + } + + /** + * Required - The number of requests per second effectively executed during the + * reindex. + *

+ * API name: {@code requests_per_second} + */ + public final Builder requestsPerSecond(float value) { + this.requestsPerSecond = value; + return this; + } + + /** + * Required - The number of retries attempted by reindex. bulk is + * the number of bulk actions retried and search is the number of + * search actions retried. + *

+ * API name: {@code retries} + */ + public final Builder retries(Retries value) { + this.retries = value; + return this; + } + + /** + * Required - The number of retries attempted by reindex. bulk is + * the number of bulk actions retried and search is the number of + * search actions retried. + *

+ * API name: {@code retries} + */ + public final Builder retries(Function> fn) { + return this.retries(fn.apply(new Retries.Builder()).build()); + } + + /** + * API name: {@code throttled} + */ + public final Builder throttled(@Nullable Time value) { + this.throttled = value; + return this; + } + + /** + * API name: {@code throttled} + */ + public final Builder throttled(Function> fn) { + return this.throttled(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - Number of milliseconds the request slept to conform to + * requests_per_second. + *

+ * API name: {@code throttled_millis} + */ + public final Builder throttledMillis(long value) { + this.throttledMillis = value; + return this; + } + + /** + * API name: {@code throttled_until} + */ + public final Builder throttledUntil(@Nullable Time value) { + this.throttledUntil = value; + return this; + } + + /** + * API name: {@code throttled_until} + */ + public final Builder throttledUntil(Function> fn) { + return this.throttledUntil(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - This field should always be equal to zero in a + * _reindex response. It only has meaning when using the Task API, + * where it indicates the next time (in milliseconds since epoch) a throttled + * request will be executed again in order to conform to + * requests_per_second. + *

+ * API name: {@code throttled_until_millis} + */ + public final Builder throttledUntilMillis(long value) { + this.throttledUntilMillis = value; + return this; + } + + /** + * Required - The number of documents that were successfully processed. + *

+ * API name: {@code total} + */ + public final Builder total(long value) { + this.total = value; + return this; + } + + /** + * The number of documents that were successfully updated, for example, a + * document with same ID already existed prior to reindex updating it. + *

+ * API name: {@code updated} + */ + public final Builder updated(@Nullable Long value) { + this.updated = value; + return this; + } + + /** + * Required - The number of version conflicts that reindex hits. + *

+ * API name: {@code version_conflicts} + */ + public final Builder versionConflicts(long value) { + this.versionConflicts = value; + return this; + } + + /** + * The reason for cancellation if the slice was canceled + *

+ * API name: {@code cancelled} + */ + public final Builder cancelled(@Nullable String value) { + this.cancelled = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ParentReindexStatus}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ParentReindexStatus build() { + _checkSingleUse(); + + return new ParentReindexStatus(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ParentReindexStatus} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, ParentReindexStatus::setupParentReindexStatusDeserializer); + + protected static void setupParentReindexStatusDeserializer(ObjectDeserializer op) { + + op.add(Builder::slices, JsonpDeserializer.arrayDeserializer(ReindexStatus._DESERIALIZER), "slices"); + op.add(Builder::sliceId, JsonpDeserializer.integerDeserializer(), "slice_id"); + op.add(Builder::batches, JsonpDeserializer.longDeserializer(), "batches"); + op.add(Builder::created, JsonpDeserializer.longDeserializer(), "created"); + op.add(Builder::deleted, JsonpDeserializer.longDeserializer(), "deleted"); + op.add(Builder::noops, JsonpDeserializer.longDeserializer(), "noops"); + op.add(Builder::requestsPerSecond, JsonpDeserializer.floatDeserializer(), "requests_per_second"); + op.add(Builder::retries, Retries._DESERIALIZER, "retries"); + op.add(Builder::throttled, Time._DESERIALIZER, "throttled"); + op.add(Builder::throttledMillis, JsonpDeserializer.longDeserializer(), "throttled_millis"); + op.add(Builder::throttledUntil, Time._DESERIALIZER, "throttled_until"); + op.add(Builder::throttledUntilMillis, JsonpDeserializer.longDeserializer(), "throttled_until_millis"); + op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); + op.add(Builder::updated, JsonpDeserializer.longDeserializer(), "updated"); + op.add(Builder::versionConflicts, JsonpDeserializer.longDeserializer(), "version_conflicts"); + op.add(Builder::cancelled, JsonpDeserializer.stringDeserializer(), "cancelled"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex_rethrottle/ReindexTask.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex_rethrottle/ReindexTask.java index 227f36d064..9bcda32e4b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex_rethrottle/ReindexTask.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex_rethrottle/ReindexTask.java @@ -19,7 +19,6 @@ package co.elastic.clients.elasticsearch.core.reindex_rethrottle; -import co.elastic.clients.elasticsearch._types.ReindexStatus; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -81,7 +80,7 @@ public class ReindexTask implements JsonpSerializable { private final long startTimeInMillis; - private final ReindexStatus status; + private final ParentReindexStatus status; private final String type; @@ -169,7 +168,7 @@ public final long startTimeInMillis() { /** * Required - API name: {@code status} */ - public final ReindexStatus status() { + public final ParentReindexStatus status() { return this.status; } @@ -298,7 +297,7 @@ public abstract static class AbstractBuilder> fn) { - return this.status(fn.apply(new ReindexStatus.Builder()).build()); + public final BuilderT status(Function> fn) { + return this.status(fn.apply(new ParentReindexStatus.Builder()).build()); } /** @@ -434,7 +433,7 @@ protected static > void setupReindexT op.add(AbstractBuilder::node, JsonpDeserializer.stringDeserializer(), "node"); op.add(AbstractBuilder::runningTimeInNanos, JsonpDeserializer.longDeserializer(), "running_time_in_nanos"); op.add(AbstractBuilder::startTimeInMillis, JsonpDeserializer.longDeserializer(), "start_time_in_millis"); - op.add(AbstractBuilder::status, ReindexStatus._DESERIALIZER, "status"); + op.add(AbstractBuilder::status, ParentReindexStatus._DESERIALIZER, "status"); op.add(AbstractBuilder::type, JsonpDeserializer.stringDeserializer(), "type"); op.add(AbstractBuilder::headers, JsonpDeserializer.stringMapDeserializer( JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer())), "headers"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/InnerHits.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/InnerHits.java index a8f93a699d..a4540c150a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/InnerHits.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/InnerHits.java @@ -95,7 +95,9 @@ public class InnerHits implements JsonpSerializable { @Nullable private final Boolean seqNoPrimaryTerm; - private final List fields; + private final List field; + + private final List fields; private final List sort; @@ -124,6 +126,7 @@ private InnerHits(Builder builder) { this.ignoreUnmapped = builder.ignoreUnmapped; this.scriptFields = ApiTypeHelper.unmodifiable(builder.scriptFields); this.seqNoPrimaryTerm = builder.seqNoPrimaryTerm; + this.field = ApiTypeHelper.unmodifiable(builder.field); this.fields = ApiTypeHelper.unmodifiable(builder.fields); this.sort = ApiTypeHelper.unmodifiable(builder.sort); this.source = builder.source; @@ -222,10 +225,17 @@ public final Boolean seqNoPrimaryTerm() { return this.seqNoPrimaryTerm; } + /** + * API name: {@code field} + */ + public final List field() { + return this.field; + } + /** * API name: {@code fields} */ - public final List fields() { + public final List fields() { return this.fields; } @@ -341,12 +351,22 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("seq_no_primary_term"); generator.write(this.seqNoPrimaryTerm); + } + if (ApiTypeHelper.isDefined(this.field)) { + generator.writeKey("field"); + generator.writeStartArray(); + for (String item0 : this.field) { + generator.write(item0); + + } + generator.writeEnd(); + } if (ApiTypeHelper.isDefined(this.fields)) { generator.writeKey("fields"); generator.writeStartArray(); - for (String item0 : this.fields) { - generator.write(item0); + for (FieldAndFormat item0 : this.fields) { + item0.serialize(generator, mapper); } generator.writeEnd(); @@ -433,7 +453,10 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Boolean seqNoPrimaryTerm; @Nullable - private List fields; + private List field; + + @Nullable + private List fields; @Nullable private List sort; @@ -463,6 +486,7 @@ private Builder(InnerHits instance) { this.ignoreUnmapped = instance.ignoreUnmapped; this.scriptFields = instance.scriptFields; this.seqNoPrimaryTerm = instance.seqNoPrimaryTerm; + this.field = instance.field; this.fields = instance.fields; this.sort = instance.sort; this.source = instance.source; @@ -614,12 +638,32 @@ public final Builder seqNoPrimaryTerm(@Nullable Boolean value) { return this; } + /** + * API name: {@code field} + *

+ * Adds all elements of list to field. + */ + public final Builder field(List list) { + this.field = _listAddAll(this.field, list); + return this; + } + + /** + * API name: {@code field} + *

+ * Adds one or more values to field. + */ + public final Builder field(String value, String... values) { + this.field = _listAdd(this.field, value, values); + return this; + } + /** * API name: {@code fields} *

* Adds all elements of list to fields. */ - public final Builder fields(List list) { + public final Builder fields(List list) { this.fields = _listAddAll(this.fields, list); return this; } @@ -629,11 +673,20 @@ public final Builder fields(List list) { *

* Adds one or more values to fields. */ - public final Builder fields(String value, String... values) { + public final Builder fields(FieldAndFormat value, FieldAndFormat... values) { this.fields = _listAdd(this.fields, value, values); return this; } + /** + * API name: {@code fields} + *

+ * Adds a value to fields using a builder lambda. + */ + public final Builder fields(Function> fn) { + return fields(fn.apply(new FieldAndFormat.Builder()).build()); + } + /** * How the inner hits should be sorted per inner_hits. By default, * inner hits are sorted by score. @@ -769,7 +822,8 @@ protected static void setupInnerHitsDeserializer(ObjectDeserializer 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/7ada49949544b577bc7c9ab5420771204a12cdd2/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/a11ffef0fa62bc289d624a0dde052163740ee4bf/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/esql/DeleteViewRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DeleteViewRequest.java index fff130adab..3cdf1e6c28 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DeleteViewRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DeleteViewRequest.java @@ -33,9 +33,11 @@ import java.lang.String; import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Function; +import java.util.stream.Collectors; import javax.annotation.Nullable; //---------------------------------------------------------------- @@ -65,13 +67,13 @@ */ public class DeleteViewRequest extends RequestBase { - private final String name; + private final List name; // --------------------------------------------------------------------------------------------- private DeleteViewRequest(Builder builder) { - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); } @@ -84,7 +86,7 @@ public static DeleteViewRequest of(Function * API name: {@code name} */ - public final String name() { + public final List name() { return this.name; } @@ -97,7 +99,7 @@ public final String name() { public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { - private String name; + private List name; public Builder() { } @@ -109,9 +111,23 @@ private Builder(DeleteViewRequest instance) { * Required - The view name to remove. *

* API name: {@code name} + *

+ * Adds all elements of list to name. + */ + public final Builder name(List list) { + this.name = _listAddAll(this.name, list); + return this; + } + + /** + * Required - The view name to remove. + *

+ * API name: {@code name} + *

+ * Adds one or more values to name. */ - public final Builder name(String value) { - this.name = value; + public final Builder name(String value, String... values) { + this.name = _listAdd(this.name, value, values); return this; } @@ -166,7 +182,9 @@ public Builder rebuild() { buf.append("/_query"); buf.append("/view"); buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); + SimpleEndpoint.pathEncode( + request.name.stream().map(v -> v).filter(Objects::nonNull).collect(Collectors.joining(",")), + buf); return buf.toString(); } throw SimpleEndpoint.noPathTemplateFound("path"); @@ -183,7 +201,8 @@ public Builder rebuild() { propsSet |= _name; if (propsSet == (_name)) { - params.put("name", request.name); + params.put("name", request.name.stream().map(v -> v).filter(Objects::nonNull) + .collect(Collectors.joining(","))); } return params; }, 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 8ce947ca68..4e9842e8ca 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 @@ -83,6 +89,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.downsamplingMethod = builder.downsamplingMethod; this.enabled = builder.enabled; @@ -107,6 +115,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 @@ -168,6 +196,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(); @@ -233,6 +270,12 @@ public abstract static class AbstractBuilder downsampling; @@ -270,6 +313,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 @@ -368,6 +440,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::downsamplingMethod, SamplingMethod._DESERIALIZER, "downsampling_method"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesAsyncClient.java index 262d29235b..8439155e24 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesAsyncClient.java @@ -4818,6 +4818,8 @@ public CompletableFuture simulateTemplate() { * index. *

  • The number of primary shards in the target index must be a multiple of * the number of primary shards in the source index.
  • + *
  • The number of primary shards in the target index must be a divisor of the + * source index's index.number_of_routing_shards.
  • *
  • The node handling the split process must have sufficient free disk space * to accommodate a second copy of the existing index.
  • * @@ -4897,6 +4899,8 @@ public CompletableFuture split(SplitRequest request) { * index. *
  • The number of primary shards in the target index must be a multiple of * the number of primary shards in the source index.
  • + *
  • The number of primary shards in the target index must be a divisor of the + * source index's index.number_of_routing_shards.
  • *
  • The node handling the split process must have sufficient free disk space * to accommodate a second copy of the existing index.
  • * diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesClient.java index c497ae50cc..848fbf128f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesClient.java @@ -4884,6 +4884,8 @@ public SimulateTemplateResponse simulateTemplate() throws IOException, Elasticse * index. *
  • The number of primary shards in the target index must be a multiple of * the number of primary shards in the source index.
  • + *
  • The number of primary shards in the target index must be a divisor of the + * source index's index.number_of_routing_shards.
  • *
  • The node handling the split process must have sufficient free disk space * to accommodate a second copy of the existing index.
  • * @@ -4963,6 +4965,8 @@ public SplitResponse split(SplitRequest request) throws IOException, Elasticsear * index. *
  • The number of primary shards in the target index must be a multiple of * the number of primary shards in the source index.
  • + *
  • The number of primary shards in the target index must be a divisor of the + * source index's index.number_of_routing_shards.
  • *
  • The node handling the split process must have sufficient free disk space * to accommodate a second copy of the existing index.
  • * 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/SplitRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SplitRequest.java index 932bb47185..84d1b67640 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SplitRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SplitRequest.java @@ -122,6 +122,8 @@ * index. *

  • The number of primary shards in the target index must be a multiple of * the number of primary shards in the source index.
  • + *
  • The number of primary shards in the target index must be a divisor of the + * source index's index.number_of_routing_shards.
  • *
  • The node handling the split process must have sufficient free disk space * to accommodate a second copy of the existing index.
  • * 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/inference/ElasticsearchInferenceAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceAsyncClient.java index e4689274a2..170c918cf5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceAsyncClient.java @@ -2044,7 +2044,7 @@ public final CompletableFuture sparseEmbedding( * grant this privilege). You must use a client that supports streaming. * * @see Documentation + * "https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-inference-stream-completion">Documentation * on elastic.co */ @@ -2079,7 +2079,7 @@ public CompletableFuture streamCompletion(StreamCompletionReques * a function that initializes a builder to create the * {@link StreamCompletionRequest} * @see Documentation + * "https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-inference-stream-completion">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceClient.java index 3a01dfe4c7..64ba8cae61 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceClient.java @@ -2075,7 +2075,7 @@ public final SparseEmbeddingResponse sparseEmbedding( * grant this privilege). You must use a client that supports streaming. * * @see Documentation + * "https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-inference-stream-completion">Documentation * on elastic.co */ @@ -2110,7 +2110,7 @@ public BinaryResponse streamCompletion(StreamCompletionRequest request) throws I * a function that initializes a builder to create the * {@link StreamCompletionRequest} * @see Documentation + * "https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-inference-stream-completion">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelDeploymentNodesStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelDeploymentNodesStats.java index 6b745983bf..9fdb61d66c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelDeploymentNodesStats.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelDeploymentNodesStats.java @@ -33,6 +33,7 @@ import java.lang.Double; import java.lang.Integer; import java.lang.Long; +import java.lang.String; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -71,6 +72,9 @@ public class TrainedModelDeploymentNodesStats implements JsonpSerializable { @Nullable private final Double averageInferenceTimeMsExcludingCacheHits; + @Nullable + private final String averageInferenceProcessMemoryRssBytes; + @Nullable private final Integer errorCount; @@ -120,6 +124,7 @@ private TrainedModelDeploymentNodesStats(Builder builder) { this.averageInferenceTimeMs = builder.averageInferenceTimeMs; this.averageInferenceTimeMsLastMinute = builder.averageInferenceTimeMsLastMinute; this.averageInferenceTimeMsExcludingCacheHits = builder.averageInferenceTimeMsExcludingCacheHits; + this.averageInferenceProcessMemoryRssBytes = builder.averageInferenceProcessMemoryRssBytes; this.errorCount = builder.errorCount; this.inferenceCount = builder.inferenceCount; this.inferenceCacheHitCount = builder.inferenceCacheHitCount; @@ -174,6 +179,14 @@ public final Double averageInferenceTimeMsExcludingCacheHits() { return this.averageInferenceTimeMsExcludingCacheHits; } + /** + * API name: {@code average_inference_process_memory_rss_bytes} + */ + @Nullable + public final String averageInferenceProcessMemoryRssBytes() { + return this.averageInferenceProcessMemoryRssBytes; + } + /** * The number of errors when evaluating the trained model. *

    @@ -340,6 +353,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("average_inference_time_ms_excluding_cache_hits"); generator.write(this.averageInferenceTimeMsExcludingCacheHits); + } + if (this.averageInferenceProcessMemoryRssBytes != null) { + generator.writeKey("average_inference_process_memory_rss_bytes"); + generator.write(this.averageInferenceProcessMemoryRssBytes); + } if (this.errorCount != null) { generator.writeKey("error_count"); @@ -436,6 +454,9 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private Double averageInferenceTimeMsExcludingCacheHits; + @Nullable + private String averageInferenceProcessMemoryRssBytes; + @Nullable private Integer errorCount; @@ -484,6 +505,7 @@ private Builder(TrainedModelDeploymentNodesStats instance) { this.averageInferenceTimeMs = instance.averageInferenceTimeMs; this.averageInferenceTimeMsLastMinute = instance.averageInferenceTimeMsLastMinute; this.averageInferenceTimeMsExcludingCacheHits = instance.averageInferenceTimeMsExcludingCacheHits; + this.averageInferenceProcessMemoryRssBytes = instance.averageInferenceProcessMemoryRssBytes; this.errorCount = instance.errorCount; this.inferenceCount = instance.inferenceCount; this.inferenceCacheHitCount = instance.inferenceCacheHitCount; @@ -530,6 +552,14 @@ public final Builder averageInferenceTimeMsExcludingCacheHits(@Nullable Double v return this; } + /** + * API name: {@code average_inference_process_memory_rss_bytes} + */ + public final Builder averageInferenceProcessMemoryRssBytes(@Nullable String value) { + this.averageInferenceProcessMemoryRssBytes = value; + return this; + } + /** * The number of errors when evaluating the trained model. *

    @@ -734,6 +764,8 @@ protected static void setupTrainedModelDeploymentNodesStatsDeserializer( "average_inference_time_ms_last_minute"); op.add(Builder::averageInferenceTimeMsExcludingCacheHits, JsonpDeserializer.doubleDeserializer(), "average_inference_time_ms_excluding_cache_hits"); + op.add(Builder::averageInferenceProcessMemoryRssBytes, JsonpDeserializer.stringDeserializer(), + "average_inference_process_memory_rss_bytes"); op.add(Builder::errorCount, JsonpDeserializer.integerDeserializer(), "error_count"); op.add(Builder::inferenceCount, JsonpDeserializer.longDeserializer(), "inference_count"); op.add(Builder::inferenceCacheHitCount, JsonpDeserializer.longDeserializer(), "inference_cache_hit_count"); 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} */