diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DenseVectorIndexOptions.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DenseVectorIndexOptions.java index 6633a0e55..bc701379e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DenseVectorIndexOptions.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DenseVectorIndexOptions.java @@ -60,7 +60,7 @@ * specification */ @JsonpDeserializable -public class DenseVectorIndexOptions implements SemanticTextIndexOptionsVariant, JsonpSerializable { +public class DenseVectorIndexOptions implements JsonpSerializable { @Nullable private final Float confidenceInterval; @@ -87,14 +87,6 @@ public static DenseVectorIndexOptions of(Function0.90 and 1.0 or exactly diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/SemanticTextIndexOptions.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/SemanticTextIndexOptions.java index 59123a1a6..67e965657 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/SemanticTextIndexOptions.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/SemanticTextIndexOptions.java @@ -19,7 +19,6 @@ package co.elastic.clients.elasticsearch._types.mapping; -import co.elastic.clients.json.JsonEnum; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -27,13 +26,9 @@ 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.TaggedUnion; -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; @@ -62,57 +57,15 @@ * specification */ @JsonpDeserializable -public class SemanticTextIndexOptions implements TaggedUnion, JsonpSerializable { +public class SemanticTextIndexOptions implements JsonpSerializable { + @Nullable + private final DenseVectorIndexOptions denseVector; - /** - * {@link SemanticTextIndexOptions} variant kinds. - * - * @see API - * specification - */ - - public enum Kind implements JsonEnum { - DenseVector("dense_vector"), - - ; - - 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 SemanticTextIndexOptions(SemanticTextIndexOptionsVariant value) { - - this._kind = ApiTypeHelper.requireNonNull(value._semanticTextIndexOptionsKind(), this, ""); - this._value = ApiTypeHelper.requireNonNull(value, this, ""); - - } + // --------------------------------------------------------------------------------------------- private SemanticTextIndexOptions(Builder builder) { - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + this.denseVector = builder.denseVector; } @@ -121,35 +74,30 @@ public static SemanticTextIndexOptions of(Function implements ObjectBuilder { - private Kind _kind; - private Object _value; + @Nullable + private DenseVectorIndexOptions denseVector; - @Override - protected Builder self() { - return this; + public Builder() { } - public ObjectBuilder denseVector(DenseVectorIndexOptions v) { - this._kind = Kind.DenseVector; - this._value = v; + private Builder(SemanticTextIndexOptions instance) { + this.denseVector = instance.denseVector; + + } + /** + * API name: {@code dense_vector} + */ + public final Builder denseVector(@Nullable DenseVectorIndexOptions value) { + this.denseVector = value; return this; } - public ObjectBuilder denseVector( + /** + * API name: {@code dense_vector} + */ + public final Builder denseVector( Function> fn) { return this.denseVector(fn.apply(new DenseVectorIndexOptions.Builder()).build()); } + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link SemanticTextIndexOptions}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ public SemanticTextIndexOptions build() { _checkSingleUse(); + return new SemanticTextIndexOptions(this); } + } + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SemanticTextIndexOptions} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SemanticTextIndexOptions::setupSemanticTextIndexOptionsDeserializer); - protected static void setupSemanticTextIndexOptionsDeserializer(ObjectDeserializer op) { + protected static void setupSemanticTextIndexOptionsDeserializer( + ObjectDeserializer op) { op.add(Builder::denseVector, DenseVectorIndexOptions._DESERIALIZER, "dense_vector"); } - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, SemanticTextIndexOptions::setupSemanticTextIndexOptionsDeserializer, Builder::build); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/SemanticTextIndexOptionsBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/SemanticTextIndexOptionsBuilders.java deleted file mode 100644 index 29864b9c1..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/SemanticTextIndexOptionsBuilders.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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.mapping; - -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 SemanticTextIndexOptions} variants. - */ -public class SemanticTextIndexOptionsBuilders { - private SemanticTextIndexOptionsBuilders() { - } - - /** - * Creates a builder for the {@link DenseVectorIndexOptions dense_vector} - * {@code SemanticTextIndexOptions} variant. - */ - public static DenseVectorIndexOptions.Builder denseVector() { - return new DenseVectorIndexOptions.Builder(); - } - - /** - * Creates a SemanticTextIndexOptions of the {@link DenseVectorIndexOptions - * dense_vector} {@code SemanticTextIndexOptions} variant. - */ - public static SemanticTextIndexOptions denseVector( - Function> fn) { - SemanticTextIndexOptions.Builder builder = new SemanticTextIndexOptions.Builder(); - builder.denseVector(fn.apply(new DenseVectorIndexOptions.Builder()).build()); - return builder.build(); - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/SemanticTextIndexOptionsVariant.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/SemanticTextIndexOptionsVariant.java deleted file mode 100644 index f2e11ed9f..000000000 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/SemanticTextIndexOptionsVariant.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.mapping; - -//---------------------------------------------------------------- -// 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 SemanticTextIndexOptions} variants. - */ -public interface SemanticTextIndexOptionsVariant { - - SemanticTextIndexOptions.Kind _semanticTextIndexOptionsKind(); - - default SemanticTextIndexOptions _toSemanticTextIndexOptions() { - return new SemanticTextIndexOptions(this); - } - -} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/SemanticTextProperty.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/SemanticTextProperty.java index 5bbf897ab..04eb762d6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/SemanticTextProperty.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/SemanticTextProperty.java @@ -340,17 +340,6 @@ public final Builder indexOptions( return this.indexOptions(fn.apply(new SemanticTextIndexOptions.Builder()).build()); } - /** - * Settings for index_options that override any defaults used by semantic_text, - * for example specific quantization settings. - *

- * API name: {@code index_options} - */ - public final Builder indexOptions(SemanticTextIndexOptionsVariant value) { - this.indexOptions = value._toSemanticTextIndexOptions(); - return this; - } - /** * Settings for chunking text into smaller passages. If specified, these will * override the chunking settings sent in the inference endpoint associated with diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/BulkOperationBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/BulkOperationBase.java index 488112820..d2f372ac6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/BulkOperationBase.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/BulkOperationBase.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch.core.bulk; +import co.elastic.clients.elasticsearch._types.VersionType; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -73,6 +74,12 @@ public abstract class BulkOperationBase implements JsonpSerializable { @Nullable private final Long ifSeqNo; + @Nullable + private final Long version; + + @Nullable + private final VersionType versionType; + // --------------------------------------------------------------------------------------------- protected BulkOperationBase(AbstractBuilder builder) { @@ -82,6 +89,8 @@ protected BulkOperationBase(AbstractBuilder builder) { this.routing = builder.routing; this.ifPrimaryTerm = builder.ifPrimaryTerm; this.ifSeqNo = builder.ifSeqNo; + this.version = builder.version; + this.versionType = builder.versionType; } @@ -131,6 +140,29 @@ public final Long ifSeqNo() { return this.ifSeqNo; } + /** + * The explicit version number for concurrency control. It must be a + * non-negative long number. This parameter is not supported for + * update actions. + *

+ * API name: {@code version} + */ + @Nullable + public final Long version() { + return this.version; + } + + /** + * The version type. This parameter is not supported for update + * actions. + *

+ * API name: {@code version_type} + */ + @Nullable + public final VersionType versionType() { + return this.versionType; + } + /** * Serialize this object to JSON. */ @@ -167,6 +199,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.ifSeqNo); } + if (this.version != null) { + generator.writeKey("version"); + generator.write(this.version); + + } + if (this.versionType != null) { + generator.writeKey("version_type"); + this.versionType.serialize(generator, mapper); + } } @@ -193,6 +234,12 @@ public abstract static class AbstractBuilder @@ -239,6 +286,29 @@ public final BuilderT ifSeqNo(@Nullable Long value) { return self(); } + /** + * The explicit version number for concurrency control. It must be a + * non-negative long number. This parameter is not supported for + * update actions. + *

+ * API name: {@code version} + */ + public final BuilderT version(@Nullable Long value) { + this.version = value; + return self(); + } + + /** + * The version type. This parameter is not supported for update + * actions. + *

+ * API name: {@code version_type} + */ + public final BuilderT versionType(@Nullable VersionType value) { + this.versionType = value; + return self(); + } + protected AbstractBuilder() { } @@ -248,6 +318,8 @@ protected AbstractBuilder(BulkOperationBase instance) { this.routing = instance.routing; this.ifPrimaryTerm = instance.ifPrimaryTerm; this.ifSeqNo = instance.ifSeqNo; + this.version = instance.version; + this.versionType = instance.versionType; } @@ -264,6 +336,8 @@ protected static > void setupBulkOper op.add(AbstractBuilder::routing, JsonpDeserializer.stringDeserializer(), "routing"); op.add(AbstractBuilder::ifPrimaryTerm, JsonpDeserializer.longDeserializer(), "if_primary_term"); op.add(AbstractBuilder::ifSeqNo, JsonpDeserializer.longDeserializer(), "if_seq_no"); + op.add(AbstractBuilder::version, JsonpDeserializer.longDeserializer(), "version"); + op.add(AbstractBuilder::versionType, VersionType._DESERIALIZER, "version_type"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/DeleteOperation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/DeleteOperation.java index efaaee0ae..d845ffd83 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/DeleteOperation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/DeleteOperation.java @@ -19,18 +19,14 @@ package co.elastic.clients.elasticsearch.core.bulk; -import co.elastic.clients.elasticsearch._types.VersionType; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; -import co.elastic.clients.json.JsonpMapper; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; -import java.lang.Long; import java.util.Objects; import java.util.function.Function; -import javax.annotation.Nullable; //---------------------------------------------------------------- // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. @@ -56,20 +52,11 @@ */ @JsonpDeserializable public class DeleteOperation extends BulkOperationBase implements BulkOperationVariant { - @Nullable - private final Long version; - - @Nullable - private final VersionType versionType; - // --------------------------------------------------------------------------------------------- private DeleteOperation(Builder builder) { super(builder); - this.version = builder.version; - this.versionType = builder.versionType; - } public static DeleteOperation of(Function> fn) { @@ -84,44 +71,6 @@ public BulkOperation.Kind _bulkOperationKind() { return BulkOperation.Kind.Delete; } - /** - * The explicit version number for concurrency control. It must be a - * non-negative long number. This parameter is not supported for - * update actions. - *

- * API name: {@code version} - */ - @Nullable - public final Long version() { - return this.version; - } - - /** - * The version type. This parameter is not supported for update - * actions. - *

- * API name: {@code version_type} - */ - @Nullable - public final VersionType versionType() { - return this.versionType; - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - super.serializeInternal(generator, mapper); - if (this.version != null) { - generator.writeKey("version"); - generator.write(this.version); - - } - if (this.versionType != null) { - generator.writeKey("version_type"); - this.versionType.serialize(generator, mapper); - } - - } - // --------------------------------------------------------------------------------------------- /** @@ -131,43 +80,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends BulkOperationBase.AbstractBuilder implements ObjectBuilder { - @Nullable - private Long version; - - @Nullable - private VersionType versionType; - public Builder() { } private Builder(DeleteOperation instance) { super(instance); - this.version = instance.version; - this.versionType = instance.versionType; } - /** - * The explicit version number for concurrency control. It must be a - * non-negative long number. This parameter is not supported for - * update actions. - *

- * API name: {@code version} - */ - public final Builder version(@Nullable Long value) { - this.version = value; - return this; - } - - /** - * The version type. This parameter is not supported for update - * actions. - *

- * API name: {@code version_type} - */ - public final Builder versionType(@Nullable VersionType value) { - this.versionType = value; - return this; - } - @Override protected Builder self() { return this; @@ -202,8 +120,6 @@ public Builder rebuild() { protected static void setupDeleteOperationDeserializer(ObjectDeserializer op) { BulkOperationBase.setupBulkOperationBaseDeserializer(op); - op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); - op.add(Builder::versionType, VersionType._DESERIALIZER, "version_type"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/WriteOperation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/WriteOperation.java index e8fb771b9..4f2240827 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/WriteOperation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/WriteOperation.java @@ -19,7 +19,6 @@ package co.elastic.clients.elasticsearch.core.bulk; -import co.elastic.clients.elasticsearch._types.VersionType; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -30,7 +29,6 @@ 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.Map; import java.util.Objects; @@ -60,12 +58,6 @@ */ public abstract class WriteOperation extends BulkOperationBase { - @Nullable - private final Long version; - - @Nullable - private final VersionType versionType; - private final Map dynamicTemplates; @Nullable @@ -85,8 +77,6 @@ public abstract class WriteOperation extends BulkOperationBase { protected WriteOperation(AbstractBuilder builder) { super(builder); - this.version = builder.version; - this.versionType = builder.versionType; this.dynamicTemplates = ApiTypeHelper.unmodifiable(builder.dynamicTemplates); this.pipeline = builder.pipeline; this.requireAlias = builder.requireAlias; @@ -95,29 +85,6 @@ protected WriteOperation(AbstractBuilder builder) { } - /** - * The explicit version number for concurrency control. It must be a - * non-negative long number. This parameter is not supported for - * update actions. - *

- * API name: {@code version} - */ - @Nullable - public final Long version() { - return this.version; - } - - /** - * The version type. This parameter is not supported for update - * actions. - *

- * API name: {@code version_type} - */ - @Nullable - public final VersionType versionType() { - return this.versionType; - } - /** * A map from the full name of fields to the name of dynamic templates. It * defaults to an empty map. If a name matches a dynamic template, that template @@ -180,15 +147,6 @@ public final Boolean listExecutedPipelines() { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { super.serializeInternal(generator, mapper); - if (this.version != null) { - generator.writeKey("version"); - generator.write(this.version); - - } - if (this.versionType != null) { - generator.writeKey("version_type"); - this.versionType.serialize(generator, mapper); - } if (ApiTypeHelper.isDefined(this.dynamicTemplates)) { generator.writeKey("dynamic_templates"); generator.writeStartObject(); @@ -226,12 +184,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public abstract static class AbstractBuilder> extends BulkOperationBase.AbstractBuilder { - @Nullable - private Long version; - - @Nullable - private VersionType versionType; - @Nullable private Map dynamicTemplates; @@ -247,29 +199,6 @@ public abstract static class AbstractBuilderupdate actions. - *

- * API name: {@code version} - */ - public final BuilderT version(@Nullable Long value) { - this.version = value; - return self(); - } - - /** - * The version type. This parameter is not supported for update - * actions. - *

- * API name: {@code version_type} - */ - public final BuilderT versionType(@Nullable VersionType value) { - this.versionType = value; - return self(); - } - /** * A map from the full name of fields to the name of dynamic templates. It * defaults to an empty map. If a name matches a dynamic template, that template @@ -353,8 +282,6 @@ protected AbstractBuilder() { protected AbstractBuilder(WriteOperation instance) { super(instance); - this.version = instance.version; - this.versionType = instance.versionType; this.dynamicTemplates = instance.dynamicTemplates; this.pipeline = instance.pipeline; this.requireAlias = instance.requireAlias; @@ -369,8 +296,6 @@ protected AbstractBuilder(WriteOperation instance) { protected static > void setupWriteOperationDeserializer( ObjectDeserializer op) { BulkOperationBase.setupBulkOperationBaseDeserializer(op); - op.add(AbstractBuilder::version, JsonpDeserializer.longDeserializer(), "version"); - op.add(AbstractBuilder::versionType, VersionType._DESERIALIZER, "version_type"); op.add(AbstractBuilder::dynamicTemplates, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "dynamic_templates"); op.add(AbstractBuilder::pipeline, JsonpDeserializer.stringDeserializer(), "pipeline");