diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterDetails.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterDetails.java new file mode 100644 index 000000000..5b60019a7 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterDetails.java @@ -0,0 +1,311 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +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.Boolean; +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; + +// typedef: _types.ClusterDetails + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ClusterDetails implements JsonpSerializable { + private final ClusterSearchStatus status; + + private final String indices; + + @Nullable + private final Long took; + + private final boolean timedOut; + + @Nullable + private final ShardStatistics shards; + + private final List failures; + + // --------------------------------------------------------------------------------------------- + + private ClusterDetails(Builder builder) { + + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + this.indices = ApiTypeHelper.requireNonNull(builder.indices, this, "indices"); + this.took = builder.took; + this.timedOut = ApiTypeHelper.requireNonNull(builder.timedOut, this, "timedOut"); + this.shards = builder.shards; + this.failures = ApiTypeHelper.unmodifiable(builder.failures); + + } + + public static ClusterDetails of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code status} + */ + public final ClusterSearchStatus status() { + return this.status; + } + + /** + * Required - API name: {@code indices} + */ + public final String indices() { + return this.indices; + } + + /** + * API name: {@code took} + */ + @Nullable + public final Long took() { + return this.took; + } + + /** + * Required - API name: {@code timed_out} + */ + public final boolean timedOut() { + return this.timedOut; + } + + /** + * API name: {@code _shards} + */ + @Nullable + public final ShardStatistics shards() { + return this.shards; + } + + /** + * API name: {@code failures} + */ + public final List failures() { + return this.failures; + } + + /** + * 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("status"); + this.status.serialize(generator, mapper); + generator.writeKey("indices"); + generator.write(this.indices); + + if (this.took != null) { + generator.writeKey("took"); + generator.write(this.took); + + } + generator.writeKey("timed_out"); + generator.write(this.timedOut); + + if (this.shards != null) { + generator.writeKey("_shards"); + this.shards.serialize(generator, mapper); + + } + if (ApiTypeHelper.isDefined(this.failures)) { + generator.writeKey("failures"); + generator.writeStartArray(); + for (ShardFailure item0 : this.failures) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ClusterDetails}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private ClusterSearchStatus status; + + private String indices; + + @Nullable + private Long took; + + private Boolean timedOut; + + @Nullable + private ShardStatistics shards; + + @Nullable + private List failures; + + /** + * Required - API name: {@code status} + */ + public final Builder status(ClusterSearchStatus value) { + this.status = value; + return this; + } + + /** + * Required - API name: {@code indices} + */ + public final Builder indices(String value) { + this.indices = value; + return this; + } + + /** + * API name: {@code took} + */ + public final Builder took(@Nullable Long value) { + this.took = value; + return this; + } + + /** + * Required - API name: {@code timed_out} + */ + public final Builder timedOut(boolean value) { + this.timedOut = value; + return this; + } + + /** + * API name: {@code _shards} + */ + public final Builder shards(@Nullable ShardStatistics value) { + this.shards = value; + return this; + } + + /** + * API name: {@code _shards} + */ + public final Builder shards(Function> fn) { + return this.shards(fn.apply(new ShardStatistics.Builder()).build()); + } + + /** + * API name: {@code failures} + *

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

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

+ * Adds a value to failures using a builder lambda. + */ + public final Builder failures(Function> fn) { + return failures(fn.apply(new ShardFailure.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ClusterDetails}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ClusterDetails build() { + _checkSingleUse(); + + return new ClusterDetails(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ClusterDetails} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + ClusterDetails::setupClusterDetailsDeserializer); + + protected static void setupClusterDetailsDeserializer(ObjectDeserializer op) { + + op.add(Builder::status, ClusterSearchStatus._DESERIALIZER, "status"); + op.add(Builder::indices, JsonpDeserializer.stringDeserializer(), "indices"); + op.add(Builder::took, JsonpDeserializer.longDeserializer(), "took"); + op.add(Builder::timedOut, JsonpDeserializer.booleanDeserializer(), "timed_out"); + op.add(Builder::shards, ShardStatistics._DESERIALIZER, "_shards"); + op.add(Builder::failures, JsonpDeserializer.arrayDeserializer(ShardFailure._DESERIALIZER), "failures"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterSearchStatus.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterSearchStatus.java new file mode 100644 index 000000000..07253da2c --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ClusterSearchStatus.java @@ -0,0 +1,61 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch._types; + +import co.elastic.clients.json.JsonEnum; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public enum ClusterSearchStatus implements JsonEnum { + Running("running"), + + Successful("successful"), + + Partial("partial"), + + Skipped("skipped"), + + Failed("failed"), + + ; + + private final String jsonValue; + + ClusterSearchStatus(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + ClusterSearchStatus.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutTrainedModelVocabularyRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutTrainedModelVocabularyRequest.java index 437abb717..777f0e51a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutTrainedModelVocabularyRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/PutTrainedModelVocabularyRequest.java @@ -36,6 +36,7 @@ import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; +import java.lang.Double; import java.lang.String; import java.util.Collections; import java.util.HashMap; @@ -63,6 +64,8 @@ public class PutTrainedModelVocabularyRequest extends RequestBase implements Jso private final String modelId; + private final List scores; + private final List vocabulary; // --------------------------------------------------------------------------------------------- @@ -71,6 +74,7 @@ private PutTrainedModelVocabularyRequest(Builder builder) { this.merges = ApiTypeHelper.unmodifiable(builder.merges); this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + this.scores = ApiTypeHelper.unmodifiable(builder.scores); this.vocabulary = ApiTypeHelper.unmodifiableRequired(builder.vocabulary, this, "vocabulary"); } @@ -98,6 +102,15 @@ public final String modelId() { return this.modelId; } + /** + * The optional vocabulary value scores if required by the tokenizer. + *

+ * API name: {@code scores} + */ + public final List scores() { + return this.scores; + } + /** * Required - The model vocabulary, which must not be empty. *

@@ -127,6 +140,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (ApiTypeHelper.isDefined(this.scores)) { + generator.writeKey("scores"); + generator.writeStartArray(); + for (Double item0 : this.scores) { + generator.write(item0); + + } + generator.writeEnd(); + } if (ApiTypeHelper.isDefined(this.vocabulary)) { generator.writeKey("vocabulary"); @@ -155,6 +178,9 @@ public static class Builder extends RequestBase.AbstractBuilder private String modelId; + @Nullable + private List scores; + private List vocabulary; /** @@ -191,6 +217,30 @@ public final Builder modelId(String value) { return this; } + /** + * The optional vocabulary value scores if required by the tokenizer. + *

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

+ * Adds all elements of list to scores. + */ + public final Builder scores(List list) { + this.scores = _listAddAll(this.scores, list); + return this; + } + + /** + * The optional vocabulary value scores if required by the tokenizer. + *

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

+ * Adds one or more values to scores. + */ + public final Builder scores(Double value, Double... values) { + this.scores = _listAdd(this.scores, value, values); + return this; + } + /** * Required - The model vocabulary, which must not be empty. *

@@ -245,6 +295,7 @@ protected static void setupPutTrainedModelVocabularyRequestDeserializer( ObjectDeserializer op) { op.add(Builder::merges, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "merges"); + op.add(Builder::scores, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer()), "scores"); op.add(Builder::vocabulary, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "vocabulary");