From 57f91c7ecc2aa052ff94bc8dadf619b340e767a8 Mon Sep 17 00:00:00 2001 From: Laura Trotta <153528055+l-trotta@users.noreply.github.com> Date: Tue, 20 Feb 2024 12:35:04 +0100 Subject: [PATCH] fixes from pr 2412 (#746) --- .../ElasticsearchAsyncClient.java | 6 +- .../elasticsearch/ElasticsearchClient.java | 6 +- .../elasticsearch/core/FieldCapsRequest.java | 30 ++ .../elasticsearch/doc-files/api-spec.html | 268 +++++------ .../indices/SettingsSimilarity.java | 437 ++++++++++-------- .../indices/SettingsSimilarityBm25.java | 10 +- .../indices/SettingsSimilarityBuilders.java | 180 ++++++++ .../indices/SettingsSimilarityDfi.java | 10 +- .../indices/SettingsSimilarityDfr.java | 10 +- .../indices/SettingsSimilarityIb.java | 10 +- .../indices/SettingsSimilarityLmd.java | 10 +- .../indices/SettingsSimilarityLmj.java | 10 +- .../SettingsSimilarityScriptedTfidf.java | 10 +- .../indices/SettingsSimilarityVariant.java | 48 ++ .../ingest/AttachmentProcessor.java | 33 ++ .../nodes/info/NodeInfoDiscover.java | 166 ++++++- .../nodes/info/NodeInfoPath.java | 43 +- .../nodes/info/NodeInfoSettings.java | 19 +- .../nodes/info/NodeInfoSettingsCluster.java | 39 +- 19 files changed, 964 insertions(+), 381 deletions(-) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityBuilders.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityVariant.java diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java index 5d036bb98..2141bc5cc 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java @@ -2238,7 +2238,8 @@ public final CompletableFuture updateByQuery(UpdateByQueryReque } /** - * Performs an update on every document in the index without changing the + * Updates documents that match the specified query. If no query is specified, + * performs an update on every document in the index without changing the * source, for example to pick up a mapping change. * * @param fn diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java index 10e55792c..9207b23a6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java @@ -2283,7 +2283,8 @@ public final UpdateResponse update( // ----- Endpoint: update_by_query /** - * Performs an update on every document in the index without changing the + * Updates documents that match the specified query. If no query is specified, + * performs an update on every document in the index without changing the * source, for example to pick up a mapping change. * * @see + * API name: {@code include_empty_fields} + */ + @Nullable + public final Boolean includeEmptyFields() { + return this.includeEmptyFields; + } + /** * If true, unmapped fields are included in the response. *

@@ -294,6 +308,9 @@ public static class Builder extends RequestBase.AbstractBuilder @Nullable private Boolean ignoreUnavailable; + @Nullable + private Boolean includeEmptyFields; + @Nullable private Boolean includeUnmapped; @@ -401,6 +418,16 @@ public final Builder ignoreUnavailable(@Nullable Boolean value) { return this; } + /** + * If false, empty fields are not included in the response. + *

+ * API name: {@code include_empty_fields} + */ + public final Builder includeEmptyFields(@Nullable Boolean value) { + this.includeEmptyFields = value; + return this; + } + /** * If true, unmapped fields are included in the response. *

@@ -634,6 +661,9 @@ protected static void setupFieldCapsRequestDeserializer(ObjectDeserializer 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/4cb84340eb2908f2e67b44123fe0af08cfb89f9b/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/31beaf3a6e4e9d70db0361537e3a2fffc015a6b2/specification/" + (paths[hash] || ""); - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarity.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarity.java index 7f3110357..319cc2eb7 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarity.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarity.java @@ -19,6 +19,8 @@ package co.elastic.clients.elasticsearch.indices; +import co.elastic.clients.json.JsonData; +import co.elastic.clients.json.JsonEnum; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -26,9 +28,13 @@ 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.OpenTaggedUnion; +import co.elastic.clients.util.TaggedUnionUtils; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; +import java.lang.Object; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -57,39 +63,74 @@ * specification */ @JsonpDeserializable -public class SettingsSimilarity implements JsonpSerializable { - @Nullable - private final SettingsSimilarityBm25 bm25; +public class SettingsSimilarity implements OpenTaggedUnion, JsonpSerializable { - @Nullable - private final SettingsSimilarityDfi dfi; + /** + * {@link SettingsSimilarity} variant kinds. + * + * @see API + * specification + */ - @Nullable - private final SettingsSimilarityDfr dfr; + public enum Kind implements JsonEnum { + Bm25("bm25"), - @Nullable - private final SettingsSimilarityIb ib; + Dfi("dfi"), - @Nullable - private final SettingsSimilarityLmd lmd; + Dfr("dfr"), - @Nullable - private final SettingsSimilarityLmj lmj; + Ib("ib"), - @Nullable - private final SettingsSimilarityScriptedTfidf scriptedTfidf; + Lmd("lmd"), + + Lmj("lmj"), + + ScriptedTfidf("scripted_tfidf"), + + /** A custom {@code SettingsSimilarity} defined by a plugin */ + _Custom(null) + + ; + + private final String jsonValue; + + Kind(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } - // --------------------------------------------------------------------------------------------- + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + public SettingsSimilarity(SettingsSimilarityVariant value) { + + this._kind = ApiTypeHelper.requireNonNull(value._settingsSimilarityKind(), this, ""); + this._value = ApiTypeHelper.requireNonNull(value, this, ""); + this._customKind = null; + + } private SettingsSimilarity(Builder builder) { - this.bm25 = builder.bm25; - this.dfi = builder.dfi; - this.dfr = builder.dfr; - this.ib = builder.ib; - this.lmd = builder.lmd; - this.lmj = builder.lmj; - this.scriptedTfidf = builder.scriptedTfidf; + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + this._customKind = builder._customKind; } @@ -98,278 +139,285 @@ public static SettingsSimilarity of(Function - implements - ObjectBuilder { - @Nullable - private SettingsSimilarityBm25 bm25; + @Override + @SuppressWarnings("unchecked") + public void serialize(JsonGenerator generator, JsonpMapper mapper) { - @Nullable - private SettingsSimilarityDfi dfi; + generator.writeStartObject(); - @Nullable - private SettingsSimilarityDfr dfr; + generator.writeKey(_kind == Kind._Custom ? _customKind : _kind.jsonValue()); + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } - @Nullable - private SettingsSimilarityIb ib; + generator.writeEnd(); - @Nullable - private SettingsSimilarityLmd lmd; + } - @Nullable - private SettingsSimilarityLmj lmj; + @Override + public String toString() { + return JsonpUtils.toString(this); + } - @Nullable - private SettingsSimilarityScriptedTfidf scriptedTfidf; + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private Kind _kind; + private Object _value; + private String _customKind; - /** - * API name: {@code bm25} - */ - public final Builder bm25(@Nullable SettingsSimilarityBm25 value) { - this.bm25 = value; + @Override + protected Builder self() { + return this; + } + public ObjectBuilder bm25(SettingsSimilarityBm25 v) { + this._kind = Kind.Bm25; + this._value = v; return this; } - /** - * API name: {@code bm25} - */ - public final Builder bm25(Function> fn) { + public ObjectBuilder bm25( + Function> fn) { return this.bm25(fn.apply(new SettingsSimilarityBm25.Builder()).build()); } - /** - * API name: {@code dfi} - */ - public final Builder dfi(@Nullable SettingsSimilarityDfi value) { - this.dfi = value; + public ObjectBuilder dfi(SettingsSimilarityDfi v) { + this._kind = Kind.Dfi; + this._value = v; return this; } - /** - * API name: {@code dfi} - */ - public final Builder dfi(Function> fn) { + public ObjectBuilder dfi( + Function> fn) { return this.dfi(fn.apply(new SettingsSimilarityDfi.Builder()).build()); } - /** - * API name: {@code dfr} - */ - public final Builder dfr(@Nullable SettingsSimilarityDfr value) { - this.dfr = value; + public ObjectBuilder dfr(SettingsSimilarityDfr v) { + this._kind = Kind.Dfr; + this._value = v; return this; } - /** - * API name: {@code dfr} - */ - public final Builder dfr(Function> fn) { + public ObjectBuilder dfr( + Function> fn) { return this.dfr(fn.apply(new SettingsSimilarityDfr.Builder()).build()); } - /** - * API name: {@code ib} - */ - public final Builder ib(@Nullable SettingsSimilarityIb value) { - this.ib = value; + public ObjectBuilder ib(SettingsSimilarityIb v) { + this._kind = Kind.Ib; + this._value = v; return this; } - /** - * API name: {@code ib} - */ - public final Builder ib(Function> fn) { + public ObjectBuilder ib( + Function> fn) { return this.ib(fn.apply(new SettingsSimilarityIb.Builder()).build()); } - /** - * API name: {@code lmd} - */ - public final Builder lmd(@Nullable SettingsSimilarityLmd value) { - this.lmd = value; + public ObjectBuilder lmd(SettingsSimilarityLmd v) { + this._kind = Kind.Lmd; + this._value = v; return this; } - /** - * API name: {@code lmd} - */ - public final Builder lmd(Function> fn) { + public ObjectBuilder lmd( + Function> fn) { return this.lmd(fn.apply(new SettingsSimilarityLmd.Builder()).build()); } - /** - * API name: {@code lmj} - */ - public final Builder lmj(@Nullable SettingsSimilarityLmj value) { - this.lmj = value; + public ObjectBuilder lmj(SettingsSimilarityLmj v) { + this._kind = Kind.Lmj; + this._value = v; return this; } - /** - * API name: {@code lmj} - */ - public final Builder lmj(Function> fn) { + public ObjectBuilder lmj( + Function> fn) { return this.lmj(fn.apply(new SettingsSimilarityLmj.Builder()).build()); } - /** - * API name: {@code scripted_tfidf} - */ - public final Builder scriptedTfidf(@Nullable SettingsSimilarityScriptedTfidf value) { - this.scriptedTfidf = value; + public ObjectBuilder scriptedTfidf(SettingsSimilarityScriptedTfidf v) { + this._kind = Kind.ScriptedTfidf; + this._value = v; return this; } - /** - * API name: {@code scripted_tfidf} - */ - public final Builder scriptedTfidf( + public ObjectBuilder scriptedTfidf( Function> fn) { return this.scriptedTfidf(fn.apply(new SettingsSimilarityScriptedTfidf.Builder()).build()); } - @Override - protected Builder self() { - return this; - } - /** - * Builds a {@link SettingsSimilarity}. + * Define this {@code SettingsSimilarity} as a plugin-defined variant. * - * @throws NullPointerException - * if some of the required fields are null. + * @param name + * the plugin-defined identifier + * @param data + * the data for this custom {@code SettingsSimilarity}. It is + * converted internally to {@link JsonData}. */ + public ObjectBuilder _custom(String name, Object data) { + this._kind = Kind._Custom; + this._customKind = name; + this._value = JsonData.of(data); + return this; + } + public SettingsSimilarity build() { _checkSingleUse(); - return new SettingsSimilarity(this); } - } - - // --------------------------------------------------------------------------------------------- - /** - * Json deserializer for {@link SettingsSimilarity} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, SettingsSimilarity::setupSettingsSimilarityDeserializer); + } - protected static void setupSettingsSimilarityDeserializer(ObjectDeserializer op) { + protected static void setupSettingsSimilarityDeserializer(ObjectDeserializer op) { op.add(Builder::bm25, SettingsSimilarityBm25._DESERIALIZER, "bm25"); op.add(Builder::dfi, SettingsSimilarityDfi._DESERIALIZER, "dfi"); @@ -379,6 +427,13 @@ protected static void setupSettingsSimilarityDeserializer(ObjectDeserializer { + JsonpUtils.ensureCustomVariantsAllowed(parser, mapper); + builder._custom(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); + }); + } + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SettingsSimilarity::setupSettingsSimilarityDeserializer, Builder::build); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityBm25.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityBm25.java index e9cf76fb4..addd2cfb5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityBm25.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityBm25.java @@ -59,7 +59,7 @@ * specification */ @JsonpDeserializable -public class SettingsSimilarityBm25 implements JsonpSerializable { +public class SettingsSimilarityBm25 implements SettingsSimilarityVariant, JsonpSerializable { private final double b; private final boolean discountOverlaps; @@ -80,6 +80,14 @@ public static SettingsSimilarityBm25 of(Function> fn) { + SettingsSimilarity.Builder builder = new SettingsSimilarity.Builder(); + builder.bm25(fn.apply(new SettingsSimilarityBm25.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link SettingsSimilarityDfi dfi} + * {@code SettingsSimilarity} variant. + */ + public static SettingsSimilarityDfi.Builder dfi() { + return new SettingsSimilarityDfi.Builder(); + } + + /** + * Creates a SettingsSimilarity of the {@link SettingsSimilarityDfi dfi} + * {@code SettingsSimilarity} variant. + */ + public static SettingsSimilarity dfi( + Function> fn) { + SettingsSimilarity.Builder builder = new SettingsSimilarity.Builder(); + builder.dfi(fn.apply(new SettingsSimilarityDfi.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link SettingsSimilarityDfr dfr} + * {@code SettingsSimilarity} variant. + */ + public static SettingsSimilarityDfr.Builder dfr() { + return new SettingsSimilarityDfr.Builder(); + } + + /** + * Creates a SettingsSimilarity of the {@link SettingsSimilarityDfr dfr} + * {@code SettingsSimilarity} variant. + */ + public static SettingsSimilarity dfr( + Function> fn) { + SettingsSimilarity.Builder builder = new SettingsSimilarity.Builder(); + builder.dfr(fn.apply(new SettingsSimilarityDfr.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link SettingsSimilarityIb ib} + * {@code SettingsSimilarity} variant. + */ + public static SettingsSimilarityIb.Builder ib() { + return new SettingsSimilarityIb.Builder(); + } + + /** + * Creates a SettingsSimilarity of the {@link SettingsSimilarityIb ib} + * {@code SettingsSimilarity} variant. + */ + public static SettingsSimilarity ib( + Function> fn) { + SettingsSimilarity.Builder builder = new SettingsSimilarity.Builder(); + builder.ib(fn.apply(new SettingsSimilarityIb.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link SettingsSimilarityLmd lmd} + * {@code SettingsSimilarity} variant. + */ + public static SettingsSimilarityLmd.Builder lmd() { + return new SettingsSimilarityLmd.Builder(); + } + + /** + * Creates a SettingsSimilarity of the {@link SettingsSimilarityLmd lmd} + * {@code SettingsSimilarity} variant. + */ + public static SettingsSimilarity lmd( + Function> fn) { + SettingsSimilarity.Builder builder = new SettingsSimilarity.Builder(); + builder.lmd(fn.apply(new SettingsSimilarityLmd.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link SettingsSimilarityLmj lmj} + * {@code SettingsSimilarity} variant. + */ + public static SettingsSimilarityLmj.Builder lmj() { + return new SettingsSimilarityLmj.Builder(); + } + + /** + * Creates a SettingsSimilarity of the {@link SettingsSimilarityLmj lmj} + * {@code SettingsSimilarity} variant. + */ + public static SettingsSimilarity lmj( + Function> fn) { + SettingsSimilarity.Builder builder = new SettingsSimilarity.Builder(); + builder.lmj(fn.apply(new SettingsSimilarityLmj.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link SettingsSimilarityScriptedTfidf + * scripted_tfidf} {@code SettingsSimilarity} variant. + */ + public static SettingsSimilarityScriptedTfidf.Builder scriptedTfidf() { + return new SettingsSimilarityScriptedTfidf.Builder(); + } + + /** + * Creates a SettingsSimilarity of the {@link SettingsSimilarityScriptedTfidf + * scripted_tfidf} {@code SettingsSimilarity} variant. + */ + public static SettingsSimilarity scriptedTfidf( + Function> fn) { + SettingsSimilarity.Builder builder = new SettingsSimilarity.Builder(); + builder.scriptedTfidf(fn.apply(new SettingsSimilarityScriptedTfidf.Builder()).build()); + return builder.build(); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityDfi.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityDfi.java index 400b33b01..acc0cfb49 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityDfi.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityDfi.java @@ -59,7 +59,7 @@ * specification */ @JsonpDeserializable -public class SettingsSimilarityDfi implements JsonpSerializable { +public class SettingsSimilarityDfi implements SettingsSimilarityVariant, JsonpSerializable { private final DFIIndependenceMeasure independenceMeasure; // --------------------------------------------------------------------------------------------- @@ -75,6 +75,14 @@ public static SettingsSimilarityDfi of(Function */ @JsonpDeserializable -public class SettingsSimilarityDfr implements JsonpSerializable { +public class SettingsSimilarityDfr implements SettingsSimilarityVariant, JsonpSerializable { private final DFRAfterEffect afterEffect; private final DFRBasicModel basicModel; @@ -82,6 +82,14 @@ public static SettingsSimilarityDfr of(Function */ @JsonpDeserializable -public class SettingsSimilarityIb implements JsonpSerializable { +public class SettingsSimilarityIb implements SettingsSimilarityVariant, JsonpSerializable { private final IBDistribution distribution; private final IBLambda lambda; @@ -82,6 +82,14 @@ public static SettingsSimilarityIb of(Function */ @JsonpDeserializable -public class SettingsSimilarityLmd implements JsonpSerializable { +public class SettingsSimilarityLmd implements SettingsSimilarityVariant, JsonpSerializable { private final int mu; // --------------------------------------------------------------------------------------------- @@ -73,6 +73,14 @@ public static SettingsSimilarityLmd of(Function */ @JsonpDeserializable -public class SettingsSimilarityLmj implements JsonpSerializable { +public class SettingsSimilarityLmj implements SettingsSimilarityVariant, JsonpSerializable { private final double lambda; // --------------------------------------------------------------------------------------------- @@ -73,6 +73,14 @@ public static SettingsSimilarityLmj of(Function */ @JsonpDeserializable -public class SettingsSimilarityScriptedTfidf implements JsonpSerializable { +public class SettingsSimilarityScriptedTfidf implements SettingsSimilarityVariant, JsonpSerializable { private final Script script; // --------------------------------------------------------------------------------------------- @@ -75,6 +75,14 @@ public static SettingsSimilarityScriptedTfidf of( return fn.apply(new Builder()).build(); } + /** + * SettingsSimilarity variant kind. + */ + @Override + public SettingsSimilarity.Kind _settingsSimilarityKind() { + return SettingsSimilarity.Kind.ScriptedTfidf; + } + /** * Required - API name: {@code script} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityVariant.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityVariant.java new file mode 100644 index 000000000..badfa9446 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SettingsSimilarityVariant.java @@ -0,0 +1,48 @@ +/* + * 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; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * Base interface for {@link SettingsSimilarity} variants. + */ +public interface SettingsSimilarityVariant { + + SettingsSimilarity.Kind _settingsSimilarityKind(); + + default SettingsSimilarity _toSettingsSimilarity() { + return new SettingsSimilarity(this); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/AttachmentProcessor.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/AttachmentProcessor.java index 145985311..4cabffb36 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/AttachmentProcessor.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/AttachmentProcessor.java @@ -76,6 +76,9 @@ public class AttachmentProcessor extends ProcessorBase implements ProcessorVaria @Nullable private final String targetField; + @Nullable + private final Boolean removeBinary; + @Nullable private final String resourceName; @@ -90,6 +93,7 @@ private AttachmentProcessor(Builder builder) { this.indexedCharsField = builder.indexedCharsField; this.properties = ApiTypeHelper.unmodifiable(builder.properties); this.targetField = builder.targetField; + this.removeBinary = builder.removeBinary; this.resourceName = builder.resourceName; } @@ -170,6 +174,16 @@ public final String targetField() { return this.targetField; } + /** + * If true, the binary field will be removed from the document + *

+ * API name: {@code remove_binary} + */ + @Nullable + public final Boolean removeBinary() { + return this.removeBinary; + } + /** * Field containing the name of the resource to decode. If specified, the * processor passes this resource name to the underlying Tika library to enable @@ -217,6 +231,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("target_field"); generator.write(this.targetField); + } + if (this.removeBinary != null) { + generator.writeKey("remove_binary"); + generator.write(this.removeBinary); + } if (this.resourceName != null) { generator.writeKey("resource_name"); @@ -252,6 +271,9 @@ public static class Builder extends ProcessorBase.AbstractBuilder @Nullable private String targetField; + @Nullable + private Boolean removeBinary; + @Nullable private String resourceName; @@ -338,6 +360,16 @@ public final Builder targetField(@Nullable String value) { return this; } + /** + * If true, the binary field will be removed from the document + *

+ * API name: {@code remove_binary} + */ + public final Builder removeBinary(@Nullable Boolean value) { + this.removeBinary = value; + return this; + } + /** * Field containing the name of the resource to decode. If specified, the * processor passes this resource name to the underlying Tika library to enable @@ -385,6 +417,7 @@ protected static void setupAttachmentProcessorDeserializer(ObjectDeserializer settings; + + private final List seedHosts; + + @Nullable + private final String type; + + private final List seedProviders; // --------------------------------------------------------------------------------------------- private NodeInfoDiscover(Builder builder) { - this.seedHosts = ApiTypeHelper.requireNonNull(builder.seedHosts, this, "seedHosts"); + this.settings = ApiTypeHelper.unmodifiable(builder.settings); + + this.seedHosts = ApiTypeHelper.unmodifiable(builder.seedHosts); + this.type = builder.type; + this.seedProviders = ApiTypeHelper.unmodifiable(builder.seedProviders); } @@ -74,12 +89,34 @@ public static NodeInfoDiscover of(Function settings() { + return this.settings; + } + + /** + * API name: {@code seed_hosts} */ - public final String seedHosts() { + public final List seedHosts() { return this.seedHosts; } + /** + * API name: {@code type} + */ + @Nullable + public final String type() { + return this.type; + } + + /** + * API name: {@code seed_providers} + */ + public final List seedProviders() { + return this.seedProviders; + } + /** * Serialize this object to JSON. */ @@ -91,8 +128,37 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("seed_hosts"); - generator.write(this.seedHosts); + for (Map.Entry item0 : this.settings.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + + if (ApiTypeHelper.isDefined(this.seedHosts)) { + generator.writeKey("seed_hosts"); + generator.writeStartArray(); + for (String item0 : this.seedHosts) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (this.type != null) { + generator.writeKey("type"); + generator.write(this.type); + + } + if (ApiTypeHelper.isDefined(this.seedProviders)) { + generator.writeKey("seed_providers"); + generator.writeStartArray(); + for (String item0 : this.seedProviders) { + generator.write(item0); + + } + generator.writeEnd(); + + } } @@ -108,13 +174,83 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String seedHosts; + @Nullable + private Map settings = new HashMap<>(); /** - * Required - API name: {@code seed_hosts} + * Additional or alternative settings + *

+ * Adds all entries of map to settings. */ - public final Builder seedHosts(String value) { - this.seedHosts = value; + public final Builder settings(Map map) { + this.settings = _mapPutAll(this.settings, map); + return this; + } + + /** + * Additional or alternative settings + *

+ * Adds an entry to settings. + */ + public final Builder settings(String key, JsonData value) { + this.settings = _mapPut(this.settings, key, value); + return this; + } + + @Nullable + private List seedHosts; + + @Nullable + private String type; + + @Nullable + private List seedProviders; + + /** + * API name: {@code seed_hosts} + *

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

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

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

+ * Adds one or more values to seedProviders. + */ + public final Builder seedProviders(String value, String... values) { + this.seedProviders = _listAdd(this.seedProviders, value, values); return this; } @@ -146,7 +282,15 @@ public NodeInfoDiscover build() { protected static void setupNodeInfoDiscoverDeserializer(ObjectDeserializer op) { - op.add(Builder::seedHosts, JsonpDeserializer.stringDeserializer(), "seed_hosts"); + op.add(Builder::seedHosts, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "seed_hosts"); + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + op.add(Builder::seedProviders, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "seed_providers"); + + op.setUnknownFieldHandler((builder, name, parser, mapper) -> { + builder.settings(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); + }); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoPath.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoPath.java index 1074b0778..1cb88dc98 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoPath.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoPath.java @@ -60,8 +60,10 @@ */ @JsonpDeserializable public class NodeInfoPath implements JsonpSerializable { + @Nullable private final String logs; + @Nullable private final String home; private final List repo; @@ -72,9 +74,9 @@ public class NodeInfoPath implements JsonpSerializable { private NodeInfoPath(Builder builder) { - this.logs = ApiTypeHelper.requireNonNull(builder.logs, this, "logs"); - this.home = ApiTypeHelper.requireNonNull(builder.home, this, "home"); - this.repo = ApiTypeHelper.unmodifiableRequired(builder.repo, this, "repo"); + this.logs = builder.logs; + this.home = builder.home; + this.repo = ApiTypeHelper.unmodifiable(builder.repo); this.data = ApiTypeHelper.unmodifiable(builder.data); } @@ -84,21 +86,23 @@ public static NodeInfoPath of(Function> fn) } /** - * Required - API name: {@code logs} + * API name: {@code logs} */ + @Nullable public final String logs() { return this.logs; } /** - * Required - API name: {@code home} + * API name: {@code home} */ + @Nullable public final String home() { return this.home; } /** - * Required - API name: {@code repo} + * API name: {@code repo} */ public final List repo() { return this.repo; @@ -122,12 +126,16 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("logs"); - generator.write(this.logs); + if (this.logs != null) { + generator.writeKey("logs"); + generator.write(this.logs); - generator.writeKey("home"); - generator.write(this.home); + } + if (this.home != null) { + generator.writeKey("home"); + generator.write(this.home); + } if (ApiTypeHelper.isDefined(this.repo)) { generator.writeKey("repo"); generator.writeStartArray(); @@ -163,33 +171,36 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable private String logs; + @Nullable private String home; + @Nullable private List repo; @Nullable private List data; /** - * Required - API name: {@code logs} + * API name: {@code logs} */ - public final Builder logs(String value) { + public final Builder logs(@Nullable String value) { this.logs = value; return this; } /** - * Required - API name: {@code home} + * API name: {@code home} */ - public final Builder home(String value) { + public final Builder home(@Nullable String value) { this.home = value; return this; } /** - * Required - API name: {@code repo} + * API name: {@code repo} *

* Adds all elements of list to repo. */ @@ -199,7 +210,7 @@ public final Builder repo(List list) { } /** - * Required - API name: {@code repo} + * API name: {@code repo} *

* Adds one or more values to repo. */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoSettings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoSettings.java index de50a5480..f2caa5182 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoSettings.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoSettings.java @@ -62,6 +62,7 @@ public class NodeInfoSettings implements JsonpSerializable { private final NodeInfoSettingsNode node; + @Nullable private final NodeInfoPath path; @Nullable @@ -103,7 +104,7 @@ private NodeInfoSettings(Builder builder) { this.cluster = ApiTypeHelper.requireNonNull(builder.cluster, this, "cluster"); this.node = ApiTypeHelper.requireNonNull(builder.node, this, "node"); - this.path = ApiTypeHelper.requireNonNull(builder.path, this, "path"); + this.path = builder.path; this.repositories = builder.repositories; this.discovery = builder.discovery; this.action = builder.action; @@ -138,8 +139,9 @@ public final NodeInfoSettingsNode node() { } /** - * Required - API name: {@code path} + * API name: {@code path} */ + @Nullable public final NodeInfoPath path() { return this.path; } @@ -254,9 +256,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("node"); this.node.serialize(generator, mapper); - generator.writeKey("path"); - this.path.serialize(generator, mapper); + if (this.path != null) { + generator.writeKey("path"); + this.path.serialize(generator, mapper); + } if (this.repositories != null) { generator.writeKey("repositories"); this.repositories.serialize(generator, mapper); @@ -330,6 +334,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private NodeInfoSettingsNode node; + @Nullable private NodeInfoPath path; @Nullable @@ -397,15 +402,15 @@ public final Builder node(Function> fn) { return this.path(fn.apply(new NodeInfoPath.Builder()).build()); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoSettingsCluster.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoSettingsCluster.java index fa83093b4..17c3f2bed 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoSettingsCluster.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoSettingsCluster.java @@ -32,6 +32,7 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.String; +import java.util.List; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -68,8 +69,7 @@ public class NodeInfoSettingsCluster implements JsonpSerializable { private final NodeInfoSettingsClusterElection election; - @Nullable - private final String initialMasterNodes; + private final List initialMasterNodes; @Nullable private final DeprecationIndexing deprecationIndexing; @@ -81,7 +81,7 @@ private NodeInfoSettingsCluster(Builder builder) { this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.routing = builder.routing; this.election = ApiTypeHelper.requireNonNull(builder.election, this, "election"); - this.initialMasterNodes = builder.initialMasterNodes; + this.initialMasterNodes = ApiTypeHelper.unmodifiable(builder.initialMasterNodes); this.deprecationIndexing = builder.deprecationIndexing; } @@ -115,8 +115,7 @@ public final NodeInfoSettingsClusterElection election() { /** * API name: {@code initial_master_nodes} */ - @Nullable - public final String initialMasterNodes() { + public final List initialMasterNodes() { return this.initialMasterNodes; } @@ -150,9 +149,14 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("election"); this.election.serialize(generator, mapper); - if (this.initialMasterNodes != null) { + if (ApiTypeHelper.isDefined(this.initialMasterNodes)) { generator.writeKey("initial_master_nodes"); - generator.write(this.initialMasterNodes); + generator.writeStartArray(); + for (String item0 : this.initialMasterNodes) { + generator.write(item0); + + } + generator.writeEnd(); } if (this.deprecationIndexing != null) { @@ -185,7 +189,7 @@ public static class Builder extends WithJsonObjectBuilderBase private NodeInfoSettingsClusterElection election; @Nullable - private String initialMasterNodes; + private List initialMasterNodes; @Nullable private DeprecationIndexing deprecationIndexing; @@ -231,9 +235,21 @@ public final Builder election( /** * API name: {@code initial_master_nodes} + *

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

+ * Adds one or more values to initialMasterNodes. */ - public final Builder initialMasterNodes(@Nullable String value) { - this.initialMasterNodes = value; + public final Builder initialMasterNodes(String value, String... values) { + this.initialMasterNodes = _listAdd(this.initialMasterNodes, value, values); return this; } @@ -285,7 +301,8 @@ protected static void setupNodeInfoSettingsClusterDeserializer( op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(Builder::routing, IndexRouting._DESERIALIZER, "routing"); op.add(Builder::election, NodeInfoSettingsClusterElection._DESERIALIZER, "election"); - op.add(Builder::initialMasterNodes, JsonpDeserializer.stringDeserializer(), "initial_master_nodes"); + op.add(Builder::initialMasterNodes, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "initial_master_nodes"); op.add(Builder::deprecationIndexing, DeprecationIndexing._DESERIALIZER, "deprecation_indexing"); }