From 4e9a5bae01fc8d3cad476b02b0ba9d0d3b5a1e80 Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Mon, 16 Nov 2026 10:41:06 +0000 Subject: [PATCH 1/4] [codegen] update to latest spec --- .../ElasticsearchAsyncClient.java | 5 + .../elasticsearch/ElasticsearchClient.java | 5 + .../_types/query_dsl/MoreLikeThisQuery.java | 91 ---- .../cat/CatAnomalyDetectorColumn.java | 2 +- .../core/bulk/BulkOperationBase.java | 60 --- .../core/bulk/BulkResponseItem.java | 20 +- .../core/bulk/DeleteOperation.java | 84 ++++ .../core/bulk/IndexOperation.java | 42 ++ .../elasticsearch/core/bulk/UpdateAction.java | 69 +++ .../core/bulk/UpdateOperation.java | 127 ++++++ .../core/bulk/WriteOperation.java | 223 +++++++++ .../elasticsearch/doc-files/api-spec.html | 429 +++++++++--------- .../ilm/ExplainLifecycleRequest.java | 56 +++ .../ilm/SearchableSnapshotAction.java | 42 ++ .../elasticsearch/indices/CacheRequests.java | 176 +++++++ .../elasticsearch/indices/DataStream.java | 35 +- .../elasticsearch/indices/IndexSettings.java | 37 ++ .../elasticsearch/indices/Requests.java | 176 +++++++ .../inference/ContentObject.java | 261 +++++------ .../inference/ContentObjectBuilders.java | 101 +++++ ...entType.java => ContentObjectVariant.java} | 30 +- .../inference/FileContentPart.java | 189 ++++++++ .../inference/ImageUrlContent.java | 189 ++++++++ .../elasticsearch/inference/TextContent.java | 180 ++++++++ .../ElasticsearchPrometheusAsyncClient.java | 131 ++++++ .../ElasticsearchPrometheusClient.java | 132 ++++++ .../prometheus/StatusBuildinfoRequest.java | 220 +++++++++ .../prometheus/StatusBuildinfoResponse.java | 199 ++++++++ .../status_buildinfo/BuildInfo.java | 260 +++++++++++ .../elasticsearch/rollup/Groupings.java | 32 +- 30 files changed, 3039 insertions(+), 564 deletions(-) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/indices/CacheRequests.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/indices/Requests.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ContentObjectBuilders.java rename java-client/src/main/java/co/elastic/clients/elasticsearch/inference/{ContentType.java => ContentObjectVariant.java} (69%) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/FileContentPart.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ImageUrlContent.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/inference/TextContent.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/ElasticsearchPrometheusAsyncClient.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/ElasticsearchPrometheusClient.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/StatusBuildinfoRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/StatusBuildinfoResponse.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/status_buildinfo/BuildInfo.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 693401f744..fdaaa08b34 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 @@ -134,6 +134,7 @@ import co.elastic.clients.elasticsearch.monitoring.ElasticsearchMonitoringAsyncClient; import co.elastic.clients.elasticsearch.nodes.ElasticsearchNodesAsyncClient; import co.elastic.clients.elasticsearch.project.ElasticsearchProjectAsyncClient; +import co.elastic.clients.elasticsearch.prometheus.ElasticsearchPrometheusAsyncClient; import co.elastic.clients.elasticsearch.query_rules.ElasticsearchQueryRulesAsyncClient; import co.elastic.clients.elasticsearch.rollup.ElasticsearchRollupAsyncClient; import co.elastic.clients.elasticsearch.search_application.ElasticsearchSearchApplicationAsyncClient; @@ -319,6 +320,10 @@ public ElasticsearchProjectAsyncClient project() { return new ElasticsearchProjectAsyncClient(this.transport, this.transportOptions); } + public ElasticsearchPrometheusAsyncClient prometheus() { + return new ElasticsearchPrometheusAsyncClient(this.transport, this.transportOptions); + } + public ElasticsearchQueryRulesAsyncClient queryRules() { return new ElasticsearchQueryRulesAsyncClient(this.transport, this.transportOptions); } 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 77f9e67844..4b3e9d957f 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 @@ -135,6 +135,7 @@ import co.elastic.clients.elasticsearch.monitoring.ElasticsearchMonitoringClient; import co.elastic.clients.elasticsearch.nodes.ElasticsearchNodesClient; import co.elastic.clients.elasticsearch.project.ElasticsearchProjectClient; +import co.elastic.clients.elasticsearch.prometheus.ElasticsearchPrometheusClient; import co.elastic.clients.elasticsearch.query_rules.ElasticsearchQueryRulesClient; import co.elastic.clients.elasticsearch.rollup.ElasticsearchRollupClient; import co.elastic.clients.elasticsearch.search_application.ElasticsearchSearchApplicationClient; @@ -319,6 +320,10 @@ public ElasticsearchProjectClient project() { return new ElasticsearchProjectClient(this.transport, this.transportOptions); } + public ElasticsearchPrometheusClient prometheus() { + return new ElasticsearchPrometheusClient(this.transport, this.transportOptions); + } + public ElasticsearchQueryRulesClient queryRules() { return new ElasticsearchQueryRulesClient(this.transport, this.transportOptions); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/MoreLikeThisQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/MoreLikeThisQuery.java index 31e809cab6..b10e6eddb1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/MoreLikeThisQuery.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/MoreLikeThisQuery.java @@ -19,7 +19,6 @@ package co.elastic.clients.elasticsearch._types.query_dsl; -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; @@ -31,7 +30,6 @@ import java.lang.Boolean; import java.lang.Double; import java.lang.Integer; -import java.lang.Long; import java.lang.String; import java.util.List; import java.util.Objects; @@ -100,19 +98,10 @@ public class MoreLikeThisQuery extends QueryBase implements QueryVariant { @Nullable private final Integer minWordLength; - @Nullable - private final String routing; - private final List stopWords; private final List unlike; - @Nullable - private final Long version; - - @Nullable - private final VersionType versionType; - // --------------------------------------------------------------------------------------------- private MoreLikeThisQuery(Builder builder) { @@ -131,11 +120,8 @@ private MoreLikeThisQuery(Builder builder) { this.minimumShouldMatch = builder.minimumShouldMatch; this.minTermFreq = builder.minTermFreq; this.minWordLength = builder.minWordLength; - this.routing = builder.routing; this.stopWords = ApiTypeHelper.unmodifiable(builder.stopWords); this.unlike = ApiTypeHelper.unmodifiable(builder.unlike); - this.version = builder.version; - this.versionType = builder.versionType; } @@ -293,14 +279,6 @@ public final Integer minWordLength() { return this.minWordLength; } - /** - * API name: {@code routing} - */ - @Nullable - public final String routing() { - return this.routing; - } - /** * An array of stop words. Any word in this set is ignored. *

@@ -320,22 +298,6 @@ public final List unlike() { return this.unlike; } - /** - * API name: {@code version} - */ - @Nullable - public final Long version() { - return this.version; - } - - /** - * API name: {@code version_type} - */ - @Nullable - public final VersionType versionType() { - return this.versionType; - } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { super.serializeInternal(generator, mapper); @@ -413,11 +375,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("min_word_length"); generator.write(this.minWordLength); - } - if (this.routing != null) { - generator.writeKey("routing"); - generator.write(this.routing); - } if (ApiTypeHelper.isDefined(this.stopWords)) { generator.writeKey("stop_words"); @@ -439,15 +396,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - if (this.version != null) { - generator.writeKey("version"); - generator.write(this.version); - - } - if (this.versionType != null) { - generator.writeKey("version_type"); - this.versionType.serialize(generator, mapper); - } } @@ -496,21 +444,12 @@ public static class Builder extends QueryBase.AbstractBuilder implement @Nullable private Integer minWordLength; - @Nullable - private String routing; - @Nullable private List stopWords; @Nullable private List unlike; - @Nullable - private Long version; - - @Nullable - private VersionType versionType; - public Builder() { } private Builder(MoreLikeThisQuery instance) { @@ -528,11 +467,8 @@ private Builder(MoreLikeThisQuery instance) { this.minimumShouldMatch = instance.minimumShouldMatch; this.minTermFreq = instance.minTermFreq; this.minWordLength = instance.minWordLength; - this.routing = instance.routing; this.stopWords = instance.stopWords; this.unlike = instance.unlike; - this.version = instance.version; - this.versionType = instance.versionType; } /** @@ -722,14 +658,6 @@ public final Builder minWordLength(@Nullable Integer value) { return this; } - /** - * API name: {@code routing} - */ - public final Builder routing(@Nullable String value) { - this.routing = value; - return this; - } - /** * An array of stop words. Any word in this set is ignored. *

@@ -792,22 +720,6 @@ public final Builder unlike(Function> fn) { return unlike(fn.apply(new Like.Builder()).build()); } - /** - * API name: {@code version} - */ - public final Builder version(@Nullable Long value) { - this.version = value; - return this; - } - - /** - * API name: {@code version_type} - */ - public final Builder versionType(@Nullable VersionType value) { - this.versionType = value; - return this; - } - @Override protected Builder self() { return this; @@ -855,12 +767,9 @@ protected static void setupMoreLikeThisQueryDeserializer(ObjectDeserializer builder) { @@ -89,8 +82,6 @@ protected BulkOperationBase(AbstractBuilder builder) { this.routing = builder.routing; this.ifPrimaryTerm = builder.ifPrimaryTerm; this.ifSeqNo = builder.ifSeqNo; - this.version = builder.version; - this.versionType = builder.versionType; } @@ -141,22 +132,6 @@ public final Long ifSeqNo() { return this.ifSeqNo; } - /** - * API name: {@code version} - */ - @Nullable - public final Long version() { - return this.version; - } - - /** - * API name: {@code version_type} - */ - @Nullable - public final VersionType versionType() { - return this.versionType; - } - /** * Serialize this object to JSON. */ @@ -193,15 +168,6 @@ 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); - } } @@ -228,12 +194,6 @@ public abstract static class AbstractBuilder @@ -281,22 +241,6 @@ public final BuilderT ifSeqNo(@Nullable Long value) { return self(); } - /** - * API name: {@code version} - */ - public final BuilderT version(@Nullable Long value) { - this.version = value; - return self(); - } - - /** - * API name: {@code version_type} - */ - public final BuilderT versionType(@Nullable VersionType value) { - this.versionType = value; - return self(); - } - protected AbstractBuilder() { } @@ -306,8 +250,6 @@ protected AbstractBuilder(BulkOperationBase instance) { this.routing = instance.routing; this.ifPrimaryTerm = instance.ifPrimaryTerm; this.ifSeqNo = instance.ifSeqNo; - this.version = instance.version; - this.versionType = instance.versionType; } @@ -324,8 +266,6 @@ 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/BulkResponseItem.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/BulkResponseItem.java index 1a218a01c7..a3213595fb 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/BulkResponseItem.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/BulkResponseItem.java @@ -137,7 +137,15 @@ public final OperationType operationType() { } /** - * The document ID associated with the operation. + * The document ID associated with the operation. It is null when + * an index or create operation without an explicit + * _id fails before Elasticsearch generates an ID for the document. + * Elasticsearch generates the ID when it routes the document to a shard, so the + * ID is still null for failures that happen earlier, such as an + * ingest pipeline error, a missing or closed target index, a failed + * require_alias or require_data_stream check, or + * missing required routing. update and delete + * operations always include an ID. *

* API name: {@code _id} */ @@ -405,7 +413,15 @@ private Builder(BulkResponseItem instance) { } /** - * The document ID associated with the operation. + * The document ID associated with the operation. It is null when + * an index or create operation without an explicit + * _id fails before Elasticsearch generates an ID for the document. + * Elasticsearch generates the ID when it routes the document to a shard, so the + * ID is still null for failures that happen earlier, such as an + * ingest pipeline error, a missing or closed target index, a failed + * require_alias or require_data_stream check, or + * missing required routing. update and delete + * operations always include an ID. *

* API name: {@code _id} */ 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 d845ffd834..efaaee0aea 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,14 +19,18 @@ 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. @@ -52,11 +56,20 @@ */ @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) { @@ -71,6 +84,44 @@ 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); + } + + } + // --------------------------------------------------------------------------------------------- /** @@ -80,12 +131,43 @@ public BulkOperation.Kind _bulkOperationKind() { 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; @@ -120,6 +202,8 @@ 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/IndexOperation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/IndexOperation.java index fc5e52a716..94065475b1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/IndexOperation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/IndexOperation.java @@ -19,8 +19,10 @@ package co.elastic.clients.elasticsearch.core.bulk; +import co.elastic.clients.elasticsearch._types.OpType; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; import co.elastic.clients.json.JsonpSerializer; import co.elastic.clients.json.NdJsonpSerializable; import co.elastic.clients.json.ObjectBuilderDeserializer; @@ -60,6 +62,9 @@ public class IndexOperation extends WriteOperation implements NdJsonpSerializable, BulkOperationVariant { private final TDocument document; + @Nullable + private final OpType opType; + @Nullable private final JsonpSerializer tDocumentSerializer; @@ -69,6 +74,7 @@ private IndexOperation(Builder builder) { super(builder); this.document = ApiTypeHelper.requireNonNull(builder.document, this, "document"); + this.opType = builder.opType; this.tDocumentSerializer = builder.tDocumentSerializer; } @@ -98,6 +104,27 @@ public Iterator _serializables() { return Arrays.asList(this, this.document).iterator(); } + /** + * Set to create to only index the document if it does not already + * exist. + *

+ * API name: {@code op_type} + */ + @Nullable + public final OpType opType() { + return this.opType; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + if (this.opType != null) { + generator.writeKey("op_type"); + this.opType.serialize(generator, mapper); + } + + } + // --------------------------------------------------------------------------------------------- /** @@ -117,6 +144,9 @@ public final Builder document(TDocument value) { return this; } + @Nullable + private OpType opType; + @Nullable private JsonpSerializer tDocumentSerializer; @@ -124,10 +154,22 @@ public Builder() { } private Builder(IndexOperation instance) { super(instance); + this.opType = instance.opType; this.tDocumentSerializer = instance.tDocumentSerializer; this.document = instance.document; } + /** + * Set to create to only index the document if it does not already + * exist. + *

+ * API name: {@code op_type} + */ + public final Builder opType(@Nullable OpType value) { + this.opType = value; + return this; + } + /** * Serializer for TDocument. If not set, an attempt will be made to find a * serializer from the JSON context. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/UpdateAction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/UpdateAction.java index 53090e1446..9d78c03828 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/UpdateAction.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/UpdateAction.java @@ -34,6 +34,7 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; +import java.lang.Long; import java.util.Objects; import java.util.function.Function; import java.util.function.Supplier; @@ -81,6 +82,12 @@ public class UpdateAction implements JsonpSerializa @Nullable private final Boolean scriptedUpsert; + @Nullable + private final Long ifSeqNo; + + @Nullable + private final Long ifPrimaryTerm; + @Nullable private final SourceConfig source; @@ -102,6 +109,8 @@ private UpdateAction(Builder builder) { this.docAsUpsert = builder.docAsUpsert; this.script = builder.script; this.scriptedUpsert = builder.scriptedUpsert; + this.ifSeqNo = builder.ifSeqNo; + this.ifPrimaryTerm = builder.ifPrimaryTerm; this.source = builder.source; this.upsert = builder.upsert; this.tDocumentSerializer = builder.tDocumentSerializer; @@ -167,6 +176,26 @@ public final Boolean scriptedUpsert() { return this.scriptedUpsert; } + /** + * Only perform the update if the document has this sequence number. + *

+ * API name: {@code if_seq_no} + */ + @Nullable + public final Long ifSeqNo() { + return this.ifSeqNo; + } + + /** + * Only perform the update if the document has this primary term. + *

+ * API name: {@code if_primary_term} + */ + @Nullable + public final Long ifPrimaryTerm() { + return this.ifPrimaryTerm; + } + /** * If false, source retrieval is turned off. You can also specify a * comma-separated list of the fields you want to retrieve. @@ -225,6 +254,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("scripted_upsert"); generator.write(this.scriptedUpsert); + } + if (this.ifSeqNo != null) { + generator.writeKey("if_seq_no"); + generator.write(this.ifSeqNo); + + } + if (this.ifPrimaryTerm != null) { + generator.writeKey("if_primary_term"); + generator.write(this.ifPrimaryTerm); + } if (this.source != null) { generator.writeKey("_source"); @@ -270,6 +309,12 @@ public static class Builder @Nullable private Boolean scriptedUpsert; + @Nullable + private Long ifSeqNo; + + @Nullable + private Long ifPrimaryTerm; + @Nullable private SourceConfig source; @@ -290,6 +335,8 @@ private Builder(UpdateAction instance) { this.docAsUpsert = instance.docAsUpsert; this.script = instance.script; this.scriptedUpsert = instance.scriptedUpsert; + this.ifSeqNo = instance.ifSeqNo; + this.ifPrimaryTerm = instance.ifPrimaryTerm; this.source = instance.source; this.upsert = instance.upsert; this.tDocumentSerializer = instance.tDocumentSerializer; @@ -358,6 +405,26 @@ public final Builder scriptedUpsert(@Nullable Boole return this; } + /** + * Only perform the update if the document has this sequence number. + *

+ * API name: {@code if_seq_no} + */ + public final Builder ifSeqNo(@Nullable Long value) { + this.ifSeqNo = value; + return this; + } + + /** + * Only perform the update if the document has this primary term. + *

+ * API name: {@code if_primary_term} + */ + public final Builder ifPrimaryTerm(@Nullable Long value) { + this.ifPrimaryTerm = value; + return this; + } + /** * If false, source retrieval is turned off. You can also specify a * comma-separated list of the fields you want to retrieve. @@ -469,6 +536,8 @@ protected static void setupUpdateActionDeserialize op.add(Builder::docAsUpsert, JsonpDeserializer.booleanDeserializer(), "doc_as_upsert"); op.add(Builder::script, Script._DESERIALIZER, "script"); op.add(Builder::scriptedUpsert, JsonpDeserializer.booleanDeserializer(), "scripted_upsert"); + op.add(Builder::ifSeqNo, JsonpDeserializer.longDeserializer(), "if_seq_no"); + op.add(Builder::ifPrimaryTerm, JsonpDeserializer.longDeserializer(), "if_primary_term"); op.add(Builder::source, SourceConfig._DESERIALIZER, "_source"); op.add(Builder::upsert, tDocumentDeserializer, "upsert"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/UpdateOperation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/UpdateOperation.java index 926099baa0..2514e26baf 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/UpdateOperation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/bulk/UpdateOperation.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch.core.bulk; +import co.elastic.clients.elasticsearch.core.search.SourceConfig; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -31,6 +32,7 @@ import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.lang.Integer; +import java.lang.String; import java.util.Arrays; import java.util.Iterator; import java.util.Objects; @@ -76,6 +78,15 @@ public class UpdateOperation extends BulkOperationB @Nullable private final Integer retryOnConflict; + @Nullable + private final String pipeline; + + @Nullable + private final Boolean listExecutedPipelines; + + @Nullable + private final SourceConfig source; + @Nullable private final JsonpSerializer tDocumentSerializer; @@ -91,6 +102,9 @@ private UpdateOperation(Builder builder) { this.requireAlias = builder.requireAlias; this.retryOnConflict = builder.retryOnConflict; + this.pipeline = builder.pipeline; + this.listExecutedPipelines = builder.listExecutedPipelines; + this.source = builder.source; this.tDocumentSerializer = builder.tDocumentSerializer; this.tPartialDocumentSerializer = builder.tPartialDocumentSerializer; @@ -157,6 +171,43 @@ public final Integer retryOnConflict() { return this.retryOnConflict; } + /** + * The ID of the pipeline to use to preprocess the upsert document, + * if one is created. If the index has a default ingest pipeline specified, + * setting the value to _none turns off the default ingest pipeline + * for this request. If a final pipeline is configured, it will always run + * regardless of the value of this parameter. + *

+ * API name: {@code pipeline} + */ + @Nullable + public final String pipeline() { + return this.pipeline; + } + + /** + * If true, the response includes the ingest pipelines that were + * run for the upsert document, if one is created. + *

+ * API name: {@code list_executed_pipelines} + */ + @Nullable + public final Boolean listExecutedPipelines() { + return this.listExecutedPipelines; + } + + /** + * If false, source retrieval is turned off. You can also specify a + * comma-separated list of the fields you want to retrieve. If set, it overrides + * the _source value in the update source line. + *

+ * API name: {@code _source} + */ + @Nullable + public final SourceConfig source() { + return this.source; + } + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { super.serializeInternal(generator, mapper); @@ -170,6 +221,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.retryOnConflict); } + if (this.pipeline != null) { + generator.writeKey("pipeline"); + generator.write(this.pipeline); + + } + if (this.listExecutedPipelines != null) { + generator.writeKey("list_executed_pipelines"); + generator.write(this.listExecutedPipelines); + + } + if (this.source != null) { + generator.writeKey("_source"); + this.source.serialize(generator, mapper); + + } } @@ -229,6 +295,15 @@ public final Builder binaryAction(@Nullable BinaryD @Nullable private Integer retryOnConflict; + @Nullable + private String pipeline; + + @Nullable + private Boolean listExecutedPipelines; + + @Nullable + private SourceConfig source; + @Nullable private JsonpSerializer tDocumentSerializer; @@ -241,6 +316,9 @@ private Builder(UpdateOperation instance) { super(instance); this.requireAlias = instance.requireAlias; this.retryOnConflict = instance.retryOnConflict; + this.pipeline = instance.pipeline; + this.listExecutedPipelines = instance.listExecutedPipelines; + this.source = instance.source; this.tDocumentSerializer = instance.tDocumentSerializer; this.tPartialDocumentSerializer = instance.tPartialDocumentSerializer; this.action = instance.action; @@ -268,6 +346,55 @@ public final Builder retryOnConflict(@Nullable Inte return this; } + /** + * The ID of the pipeline to use to preprocess the upsert document, + * if one is created. If the index has a default ingest pipeline specified, + * setting the value to _none turns off the default ingest pipeline + * for this request. If a final pipeline is configured, it will always run + * regardless of the value of this parameter. + *

+ * API name: {@code pipeline} + */ + public final Builder pipeline(@Nullable String value) { + this.pipeline = value; + return this; + } + + /** + * If true, the response includes the ingest pipelines that were + * run for the upsert document, if one is created. + *

+ * API name: {@code list_executed_pipelines} + */ + public final Builder listExecutedPipelines(@Nullable Boolean value) { + this.listExecutedPipelines = value; + return this; + } + + /** + * If false, source retrieval is turned off. You can also specify a + * comma-separated list of the fields you want to retrieve. If set, it overrides + * the _source value in the update source line. + *

+ * API name: {@code _source} + */ + public final Builder source(@Nullable SourceConfig value) { + this.source = value; + return this; + } + + /** + * If false, source retrieval is turned off. You can also specify a + * comma-separated list of the fields you want to retrieve. If set, it overrides + * the _source value in the update source line. + *

+ * API name: {@code _source} + */ + public final Builder source( + Function> fn) { + return this.source(fn.apply(new SourceConfig.Builder()).build()); + } + /** * Serializer for TDocument. If not set, an attempt will be made to find a * serializer from the JSON context. 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 6b5d799a10..1675ce6dd6 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,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; @@ -29,6 +30,7 @@ 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; @@ -58,23 +60,65 @@ */ public abstract class WriteOperation extends BulkOperationBase { + @Nullable + private final Long version; + + @Nullable + private final VersionType versionType; + private final Map dynamicTemplates; + private final Map> dynamicTemplateParams; + @Nullable private final String pipeline; @Nullable private final Boolean requireAlias; + @Nullable + private final Boolean requireDataStream; + + @Nullable + private final Boolean listExecutedPipelines; + // --------------------------------------------------------------------------------------------- protected WriteOperation(AbstractBuilder builder) { super(builder); + this.version = builder.version; + this.versionType = builder.versionType; this.dynamicTemplates = ApiTypeHelper.unmodifiable(builder.dynamicTemplates); + this.dynamicTemplateParams = ApiTypeHelper.unmodifiable(builder.dynamicTemplateParams); this.pipeline = builder.pipeline; this.requireAlias = builder.requireAlias; + this.requireDataStream = builder.requireDataStream; + this.listExecutedPipelines = builder.listExecutedPipelines; + + } + + /** + * 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; } /** @@ -90,6 +134,19 @@ public final Map dynamicTemplates() { return this.dynamicTemplates; } + /** + * A map from the full name of fields to the parameters to pass to the dynamic + * template selected for that field in dynamic_templates. Each + * value is a map from parameter names to parameter values. The dynamic template + * can reference a parameter with a placeholder such as {unit:}, + * where the text after the colon is the default value. + *

+ * API name: {@code dynamic_template_params} + */ + public final Map> dynamicTemplateParams() { + return this.dynamicTemplateParams; + } + /** * The ID of the pipeline to use to preprocess incoming documents. If the index * has a default ingest pipeline specified, setting the value to @@ -114,9 +171,40 @@ public final Boolean requireAlias() { return this.requireAlias; } + /** + * If true, the action must target a data stream (existing or to be + * created). + *

+ * API name: {@code require_data_stream} + */ + @Nullable + public final Boolean requireDataStream() { + return this.requireDataStream; + } + + /** + * If true, the response includes the ingest pipelines that were + * run for this action. + *

+ * API name: {@code list_executed_pipelines} + */ + @Nullable + public final Boolean listExecutedPipelines() { + return this.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(); @@ -127,6 +215,25 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (ApiTypeHelper.isDefined(this.dynamicTemplateParams)) { + generator.writeKey("dynamic_template_params"); + generator.writeStartObject(); + for (Map.Entry> item0 : this.dynamicTemplateParams.entrySet()) { + generator.writeKey(item0.getKey()); + generator.writeStartObject(); + if (item0.getValue() != null) { + for (Map.Entry item1 : item0.getValue().entrySet()) { + generator.writeKey(item1.getKey()); + generator.write(item1.getValue()); + + } + } + generator.writeEnd(); + + } + generator.writeEnd(); + } if (this.pipeline != null) { generator.writeKey("pipeline"); @@ -138,21 +245,69 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.requireAlias); } + if (this.requireDataStream != null) { + generator.writeKey("require_data_stream"); + generator.write(this.requireDataStream); + + } + if (this.listExecutedPipelines != null) { + generator.writeKey("list_executed_pipelines"); + generator.write(this.listExecutedPipelines); + + } } public abstract static class AbstractBuilder> extends BulkOperationBase.AbstractBuilder { + @Nullable + private Long version; + + @Nullable + private VersionType versionType; + @Nullable private Map dynamicTemplates; + @Nullable + private Map> dynamicTemplateParams; + @Nullable private String pipeline; @Nullable private Boolean requireAlias; + @Nullable + private Boolean requireDataStream; + + @Nullable + private Boolean listExecutedPipelines; + + /** + * 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(); + } + /** * 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 @@ -185,6 +340,38 @@ public final BuilderT dynamicTemplates(String key, String value) { return self(); } + /** + * A map from the full name of fields to the parameters to pass to the dynamic + * template selected for that field in dynamic_templates. Each + * value is a map from parameter names to parameter values. The dynamic template + * can reference a parameter with a placeholder such as {unit:}, + * where the text after the colon is the default value. + *

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

+ * Adds all entries of map to dynamicTemplateParams. + */ + public final BuilderT dynamicTemplateParams(Map> map) { + this.dynamicTemplateParams = _mapPutAll(this.dynamicTemplateParams, map); + return self(); + } + + /** + * A map from the full name of fields to the parameters to pass to the dynamic + * template selected for that field in dynamic_templates. Each + * value is a map from parameter names to parameter values. The dynamic template + * can reference a parameter with a placeholder such as {unit:}, + * where the text after the colon is the default value. + *

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

+ * Adds an entry to dynamicTemplateParams. + */ + public final BuilderT dynamicTemplateParams(String key, Map value) { + this.dynamicTemplateParams = _mapPut(this.dynamicTemplateParams, key, value); + return self(); + } + /** * The ID of the pipeline to use to preprocess incoming documents. If the index * has a default ingest pipeline specified, setting the value to @@ -209,14 +396,41 @@ public final BuilderT requireAlias(@Nullable Boolean value) { return self(); } + /** + * If true, the action must target a data stream (existing or to be + * created). + *

+ * API name: {@code require_data_stream} + */ + public final BuilderT requireDataStream(@Nullable Boolean value) { + this.requireDataStream = value; + return self(); + } + + /** + * If true, the response includes the ingest pipelines that were + * run for this action. + *

+ * API name: {@code list_executed_pipelines} + */ + public final BuilderT listExecutedPipelines(@Nullable Boolean value) { + this.listExecutedPipelines = value; + return self(); + } + protected AbstractBuilder() { } protected AbstractBuilder(WriteOperation instance) { super(instance); + this.version = instance.version; + this.versionType = instance.versionType; this.dynamicTemplates = instance.dynamicTemplates; + this.dynamicTemplateParams = instance.dynamicTemplateParams; this.pipeline = instance.pipeline; this.requireAlias = instance.requireAlias; + this.requireDataStream = instance.requireDataStream; + this.listExecutedPipelines = instance.listExecutedPipelines; } @@ -226,10 +440,19 @@ 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::dynamicTemplateParams, + JsonpDeserializer.stringMapDeserializer( + JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer())), + "dynamic_template_params"); op.add(AbstractBuilder::pipeline, JsonpDeserializer.stringDeserializer(), "pipeline"); op.add(AbstractBuilder::requireAlias, JsonpDeserializer.booleanDeserializer(), "require_alias"); + op.add(AbstractBuilder::requireDataStream, JsonpDeserializer.booleanDeserializer(), "require_data_stream"); + op.add(AbstractBuilder::listExecutedPipelines, JsonpDeserializer.booleanDeserializer(), + "list_executed_pipelines"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html index a4962ca949..46126d11c2 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html @@ -4,19 +4,19 @@ Elasticsearch API specification - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ExplainLifecycleRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ExplainLifecycleRequest.java index 2d15ccf989..0d63a5ff9a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ExplainLifecycleRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ExplainLifecycleRequest.java @@ -20,6 +20,7 @@ package co.elastic.clients.elasticsearch.ilm; import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.ExpandWildcard; import co.elastic.clients.elasticsearch._types.RequestBase; import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; @@ -34,9 +35,11 @@ import java.lang.Boolean; import java.lang.String; 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; //---------------------------------------------------------------- @@ -71,6 +74,8 @@ */ public class ExplainLifecycleRequest extends RequestBase { + private final List expandWildcards; + private final String index; @Nullable @@ -86,6 +91,7 @@ public class ExplainLifecycleRequest extends RequestBase { private ExplainLifecycleRequest(Builder builder) { + this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); this.masterTimeout = builder.masterTimeout; this.onlyErrors = builder.onlyErrors; @@ -97,6 +103,18 @@ public static ExplainLifecycleRequest of(Function

+ * API name: {@code expand_wildcards} + */ + public final List expandWildcards() { + return this.expandWildcards; + } + /** * Required - Comma-separated list of data streams, indices, and aliases to * target. Supports wildcards (*). To target all data streams and @@ -150,6 +168,9 @@ public final Boolean onlyManaged() { public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { + @Nullable + private List expandWildcards; + private String index; @Nullable @@ -164,12 +185,43 @@ public static class Builder extends RequestBase.AbstractBuilder public Builder() { } private Builder(ExplainLifecycleRequest instance) { + this.expandWildcards = instance.expandWildcards; this.index = instance.index; this.masterTimeout = instance.masterTimeout; this.onlyErrors = instance.onlyErrors; this.onlyManaged = instance.onlyManaged; } + /** + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. + *

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

+ * Adds all elements of list to expandWildcards. + */ + public final Builder expandWildcards(List list) { + this.expandWildcards = _listAddAll(this.expandWildcards, list); + return this; + } + + /** + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. + *

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

+ * Adds one or more values to expandWildcards. + */ + public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { + this.expandWildcards = _listAdd(this.expandWildcards, value, values); + return this; + } + /** * Required - Comma-separated list of data streams, indices, and aliases to * target. Supports wildcards (*). To target all data streams and @@ -310,6 +362,10 @@ public Builder rebuild() { if (request.onlyManaged != null) { params.put("only_managed", String.valueOf(request.onlyManaged)); } + if (ApiTypeHelper.isDefined(request.expandWildcards)) { + params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()) + .filter(Objects::nonNull).collect(Collectors.joining(","))); + } return params; }, SimpleEndpoint.emptyMap(), false, ExplainLifecycleResponse._DESERIALIZER); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/SearchableSnapshotAction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/SearchableSnapshotAction.java index 338973b577..545f2ec6ff 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/SearchableSnapshotAction.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/SearchableSnapshotAction.java @@ -68,6 +68,9 @@ public class SearchableSnapshotAction implements JsonpSerializable { @Nullable private final Boolean forceMergeIndex; + @Nullable + private final Boolean forceMergeOnClone; + @Nullable private final Integer totalShardsPerNode; @@ -80,6 +83,7 @@ private SearchableSnapshotAction(Builder builder) { this.snapshotRepository = ApiTypeHelper.requireNonNull(builder.snapshotRepository, this, "snapshotRepository"); this.forceMergeIndex = builder.forceMergeIndex; + this.forceMergeOnClone = builder.forceMergeOnClone; this.totalShardsPerNode = builder.totalShardsPerNode; this.replicateFor = builder.replicateFor; @@ -104,6 +108,20 @@ public final Boolean forceMergeIndex() { return this.forceMergeIndex; } + /** + * If true, and the index has replicas, ILM first clones the index + * with zero replicas and force merges the clone, so that replicas are not + * merged redundantly. If false, the managed index is force merged + * directly. Not allowed when force_merge_index is + * false. + *

+ * API name: {@code force_merge_on_clone} + */ + @Nullable + public final Boolean forceMergeOnClone() { + return this.forceMergeOnClone; + } + /** * The maximum number of shards, including primaries and replicas, that can be * allocated to any single node for the mounted index. Must be at least 1. @@ -148,6 +166,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("force_merge_index"); generator.write(this.forceMergeIndex); + } + if (this.forceMergeOnClone != null) { + generator.writeKey("force_merge_on_clone"); + generator.write(this.forceMergeOnClone); + } if (this.totalShardsPerNode != null) { generator.writeKey("total_shards_per_node"); @@ -181,6 +204,9 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private Boolean forceMergeIndex; + @Nullable + private Boolean forceMergeOnClone; + @Nullable private Integer totalShardsPerNode; @@ -192,6 +218,7 @@ public Builder() { private Builder(SearchableSnapshotAction instance) { this.snapshotRepository = instance.snapshotRepository; this.forceMergeIndex = instance.forceMergeIndex; + this.forceMergeOnClone = instance.forceMergeOnClone; this.totalShardsPerNode = instance.totalShardsPerNode; this.replicateFor = instance.replicateFor; @@ -212,6 +239,20 @@ public final Builder forceMergeIndex(@Nullable Boolean value) { return this; } + /** + * If true, and the index has replicas, ILM first clones the index + * with zero replicas and force merges the clone, so that replicas are not + * merged redundantly. If false, the managed index is force merged + * directly. Not allowed when force_merge_index is + * false. + *

+ * API name: {@code force_merge_on_clone} + */ + public final Builder forceMergeOnClone(@Nullable Boolean value) { + this.forceMergeOnClone = value; + return this; + } + /** * The maximum number of shards, including primaries and replicas, that can be * allocated to any single node for the mounted index. Must be at least 1. @@ -289,6 +330,7 @@ protected static void setupSearchableSnapshotActionDeserializer( op.add(Builder::snapshotRepository, JsonpDeserializer.stringDeserializer(), "snapshot_repository"); op.add(Builder::forceMergeIndex, JsonpDeserializer.booleanDeserializer(), "force_merge_index"); + op.add(Builder::forceMergeOnClone, JsonpDeserializer.booleanDeserializer(), "force_merge_on_clone"); op.add(Builder::totalShardsPerNode, JsonpDeserializer.integerDeserializer(), "total_shards_per_node"); op.add(Builder::replicateFor, Time._DESERIALIZER, "replicate_for"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/CacheRequests.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/CacheRequests.java new file mode 100644 index 0000000000..3f370f4d0a --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/CacheRequests.java @@ -0,0 +1,176 @@ +/* + * 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.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.lang.Boolean; +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._types.CacheRequests + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class CacheRequests implements JsonpSerializable { + @Nullable + private final Boolean enable; + + // --------------------------------------------------------------------------------------------- + + private CacheRequests(Builder builder) { + + this.enable = builder.enable; + + } + + public static CacheRequests of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Whether the shard request cache is enabled for the index. This setting is + * dynamic and can be updated on an existing index. + *

+ * API name: {@code enable} + */ + @Nullable + public final Boolean enable() { + return this.enable; + } + + /** + * 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.enable != null) { + generator.writeKey("enable"); + generator.write(this.enable); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link CacheRequests}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private Boolean enable; + + public Builder() { + } + private Builder(CacheRequests instance) { + this.enable = instance.enable; + + } + /** + * Whether the shard request cache is enabled for the index. This setting is + * dynamic and can be updated on an existing index. + *

+ * API name: {@code enable} + */ + public final Builder enable(@Nullable Boolean value) { + this.enable = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link CacheRequests}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public CacheRequests build() { + _checkSingleUse(); + + return new CacheRequests(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CacheRequests} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + CacheRequests::setupCacheRequestsDeserializer); + + protected static void setupCacheRequestsDeserializer(ObjectDeserializer op) { + + op.add(Builder::enable, JsonpDeserializer.booleanDeserializer(), "enable"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStream.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStream.java index ffd355ffb3..d4962865e9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStream.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStream.java @@ -107,6 +107,7 @@ public class DataStream implements JsonpSerializable { @Nullable private final Boolean system; + @Nullable private final String template; private final DataStreamTimestampField timestampField; @@ -136,7 +137,7 @@ private DataStream(Builder builder) { this.mappings = builder.mappings; this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); this.system = builder.system; - this.template = ApiTypeHelper.requireNonNull(builder.template, this, "template"); + this.template = builder.template; this.timestampField = ApiTypeHelper.requireNonNull(builder.timestampField, this, "timestampField"); this.indexMode = builder.indexMode; @@ -328,12 +329,18 @@ public final Boolean system() { } /** - * Required - Name of the index template used to create the data stream’s - * backing indices. The template’s index pattern must match the name of this - * data stream. + * Name of the index template used to create the data stream’s backing indices. + * The template’s index pattern must match the name of this data stream. This + * property is omitted if no index template currently matches the data stream, + * for example on a cross-cluster replication follower cluster that has no + * matching local template. For replicated data streams (replicated + * is true), the value is the local index template that matches the + * data stream name, which might not be the template that created the backing + * indices on the leader cluster. *

* API name: {@code template} */ + @Nullable public final String template() { return this.template; } @@ -448,9 +455,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.system); } - generator.writeKey("template"); - generator.write(this.template); + if (this.template != null) { + generator.writeKey("template"); + generator.write(this.template); + } generator.writeKey("timestamp_field"); this.timestampField.serialize(generator, mapper); @@ -515,6 +524,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private Boolean system; + @Nullable private String template; private DataStreamTimestampField timestampField; @@ -823,13 +833,18 @@ public final Builder system(@Nullable Boolean value) { } /** - * Required - Name of the index template used to create the data stream’s - * backing indices. The template’s index pattern must match the name of this - * data stream. + * Name of the index template used to create the data stream’s backing indices. + * The template’s index pattern must match the name of this data stream. This + * property is omitted if no index template currently matches the data stream, + * for example on a cross-cluster replication follower cluster that has no + * matching local template. For replicated data streams (replicated + * is true), the value is the local index template that matches the + * data stream name, which might not be the template that created the backing + * indices on the leader cluster. *

* API name: {@code template} */ - public final Builder template(String value) { + public final Builder template(@Nullable String value) { this.template = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettings.java index 5d4394eee8..78e86c8ddd 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettings.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettings.java @@ -230,6 +230,9 @@ public class IndexSettings implements JsonpSerializable { @Nullable private final Queries queries; + @Nullable + private final Requests requests; + private final Map similarity; @Nullable @@ -303,6 +306,7 @@ private IndexSettings(Builder builder) { this.settings = builder.settings; this.timeSeries = builder.timeSeries; this.queries = builder.queries; + this.requests = builder.requests; this.similarity = ApiTypeHelper.unmodifiable(builder.similarity); this.mapping = builder.mapping; this.indexingSlowlog = builder.indexingSlowlog; @@ -744,6 +748,14 @@ public final Queries queries() { return this.queries; } + /** + * API name: {@code requests} + */ + @Nullable + public final Requests requests() { + return this.requests; + } + /** * Configure custom similarity settings to customize how search results are * scored. @@ -1078,6 +1090,11 @@ else if (isExpNullAutoExpandReplicas) { generator.writeKey("queries"); this.queries.serialize(generator, mapper); + } + if (this.requests != null) { + generator.writeKey("requests"); + this.requests.serialize(generator, mapper); + } if (ApiTypeHelper.isDefined(this.similarity)) { generator.writeKey("similarity"); @@ -1312,6 +1329,9 @@ public final Builder otherSettings(String key, JsonData value) { @Nullable private Queries queries; + @Nullable + private Requests requests; + @Nullable private Map similarity; @@ -1383,6 +1403,7 @@ private Builder(IndexSettings instance) { this.settings = instance.settings; this.timeSeries = instance.timeSeries; this.queries = instance.queries; + this.requests = instance.requests; this.similarity = instance.similarity; this.mapping = instance.mapping; this.indexingSlowlog = instance.indexingSlowlog; @@ -1981,6 +2002,21 @@ public final Builder queries(Function> f return this.queries(fn.apply(new Queries.Builder()).build()); } + /** + * API name: {@code requests} + */ + public final Builder requests(@Nullable Requests value) { + this.requests = value; + return this; + } + + /** + * API name: {@code requests} + */ + public final Builder requests(Function> fn) { + return this.requests(fn.apply(new Requests.Builder()).build()); + } + /** * Configure custom similarity settings to customize how search results are * scored. @@ -2183,6 +2219,7 @@ protected static void setupIndexSettingsDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class Requests implements JsonpSerializable { + @Nullable + private final CacheRequests cache; + + // --------------------------------------------------------------------------------------------- + + private Requests(Builder builder) { + + this.cache = builder.cache; + + } + + public static Requests of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code cache} + */ + @Nullable + public final CacheRequests cache() { + return this.cache; + } + + /** + * 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.cache != null) { + generator.writeKey("cache"); + this.cache.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Requests}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private CacheRequests cache; + + public Builder() { + } + private Builder(Requests instance) { + this.cache = instance.cache; + + } + /** + * API name: {@code cache} + */ + public final Builder cache(@Nullable CacheRequests value) { + this.cache = value; + return this; + } + + /** + * API name: {@code cache} + */ + public final Builder cache(Function> fn) { + return this.cache(fn.apply(new CacheRequests.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link Requests}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public Requests build() { + _checkSingleUse(); + + return new Requests(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Requests} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Requests::setupRequestsDeserializer); + + protected static void setupRequestsDeserializer(ObjectDeserializer op) { + + op.add(Builder::cache, CacheRequests._DESERIALIZER, "cache"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ContentObject.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ContentObject.java index 0f6be0fe24..89ec34bef2 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ContentObject.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ContentObject.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch.inference; +import co.elastic.clients.json.JsonEnum; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -28,9 +29,10 @@ 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.String; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -53,29 +55,68 @@ // typedef: inference._types.ContentObject /** - * An object style representation of a single portion of a conversation. + * One part of a chat message. The type field selects which + * property is present. Not all services and models support content types other + * than text. * * @see API * specification */ @JsonpDeserializable -public class ContentObject implements JsonpSerializable { - private final ContentType type; +public class ContentObject implements TaggedUnion, JsonpSerializable { - private final String text; + /** + * {@link ContentObject} variant kinds. + * + * @see API + * specification + */ + + public enum Kind implements JsonEnum { + File("file"), + + ImageUrl("image_url"), + + Text("text"), + + ; + + private final String jsonValue; - private final ImageUrl imageUrl; + Kind(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } - private final FileContent file; + } - // --------------------------------------------------------------------------------------------- + private final Kind _kind; + private final ContentObjectVariant _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final ContentObjectVariant _get() { + return _value; + } + + public ContentObject(ContentObjectVariant value) { + + this._kind = ApiTypeHelper.requireNonNull(value._contentObjectKind(), this, ""); + this._value = ApiTypeHelper.requireNonNull(value, this, ""); + + } private ContentObject(Builder builder) { - this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - this.text = ApiTypeHelper.requireNonNull(builder.text, this, "text"); - this.imageUrl = ApiTypeHelper.requireNonNull(builder.imageUrl, this, "imageUrl"); - this.file = ApiTypeHelper.requireNonNull(builder.file, this, "file"); + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); } @@ -84,65 +125,60 @@ public static ContentObject of(Function> f } /** - * Required - The type of content. Must be one of text, - * image_url or file. Not all services/models support - * content types other than "text" - *

- * API name: {@code type} + * Is this variant instance of kind {@code file}? */ - public final ContentType type() { - return this.type; + public boolean isFile() { + return _kind == Kind.File; } /** - * Required - The text content. Only applicable for the text type - *

- * API name: {@code text} + * Get the {@code file} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code file} kind. */ - public final String text() { - return this.text; + public FileContentPart file() { + return TaggedUnionUtils.get(this, Kind.File); } /** - * Required - The image content. Only applicable for the image_url - * type - *

- * API name: {@code image_url} + * Is this variant instance of kind {@code image_url}? */ - public final ImageUrl imageUrl() { - return this.imageUrl; + public boolean isImageUrl() { + return _kind == Kind.ImageUrl; } /** - * Required - The file content. Only applicable for the file type - *

- * API name: {@code file} + * Get the {@code image_url} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code image_url} kind. */ - public final FileContent file() { - return this.file; + public ImageUrlContent imageUrl() { + return TaggedUnionUtils.get(this, Kind.ImageUrl); } /** - * Serialize this object to JSON. + * Is this variant instance of kind {@code text}? */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); + public boolean isText() { + return _kind == Kind.Text; } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("type"); - this.type.serialize(generator, mapper); - generator.writeKey("text"); - generator.write(this.text); + /** + * Get the {@code text} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code text} kind. + */ + public TextContent text() { + return TaggedUnionUtils.get(this, Kind.Text); + } - generator.writeKey("image_url"); - this.imageUrl.serialize(generator, mapper); + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("file"); - this.file.serialize(generator, mapper); + mapper.serialize(_value, generator); } @@ -151,131 +187,62 @@ public String toString() { return JsonpUtils.toString(this); } - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ContentObject}. - */ - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private ContentType type; - - private String text; - - private ImageUrl imageUrl; - - private FileContent file; - - public Builder() { - } - private Builder(ContentObject instance) { - this.type = instance.type; - this.text = instance.text; - this.imageUrl = instance.imageUrl; - this.file = instance.file; + private Kind _kind; + private ContentObjectVariant _value; + @Override + protected Builder self() { + return this; } - /** - * Required - The type of content. Must be one of text, - * image_url or file. Not all services/models support - * content types other than "text" - *

- * API name: {@code type} - */ - public final Builder type(ContentType value) { - this.type = value; + public ObjectBuilder file(FileContentPart v) { + this._kind = Kind.File; + this._value = v; return this; } - /** - * Required - The text content. Only applicable for the text type - *

- * API name: {@code text} - */ - public final Builder text(String value) { - this.text = value; - return this; + public ObjectBuilder file(Function> fn) { + return this.file(fn.apply(new FileContentPart.Builder()).build()); } - /** - * Required - The image content. Only applicable for the image_url - * type - *

- * API name: {@code image_url} - */ - public final Builder imageUrl(ImageUrl value) { - this.imageUrl = value; + public ObjectBuilder imageUrl(ImageUrlContent v) { + this._kind = Kind.ImageUrl; + this._value = v; return this; } - /** - * Required - The image content. Only applicable for the image_url - * type - *

- * API name: {@code image_url} - */ - public final Builder imageUrl(Function> fn) { - return this.imageUrl(fn.apply(new ImageUrl.Builder()).build()); + public ObjectBuilder imageUrl( + Function> fn) { + return this.imageUrl(fn.apply(new ImageUrlContent.Builder()).build()); } - /** - * Required - The file content. Only applicable for the file type - *

- * API name: {@code file} - */ - public final Builder file(FileContent value) { - this.file = value; + public ObjectBuilder text(TextContent v) { + this._kind = Kind.Text; + this._value = v; return this; } - /** - * Required - The file content. Only applicable for the file type - *

- * API name: {@code file} - */ - public final Builder file(Function> fn) { - return this.file(fn.apply(new FileContent.Builder()).build()); + public ObjectBuilder text(Function> fn) { + return this.text(fn.apply(new TextContent.Builder()).build()); } - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link ContentObject}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ public ContentObject build() { _checkSingleUse(); - return new ContentObject(this); } - } - /** - * @return New {@link Builder} initialized with field values of this instance - */ - public Builder rebuild() { - return new Builder(this); } - // --------------------------------------------------------------------------------------------- - /** - * Json deserializer for {@link ContentObject} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ContentObject::setupContentObjectDeserializer); + protected static void setupContentObjectDeserializer(ObjectDeserializer op) { - protected static void setupContentObjectDeserializer(ObjectDeserializer op) { + op.add(Builder::file, FileContentPart._DESERIALIZER, "file"); + op.add(Builder::imageUrl, ImageUrlContent._DESERIALIZER, "image_url"); + op.add(Builder::text, TextContent._DESERIALIZER, "text"); - op.add(Builder::type, ContentType._DESERIALIZER, "type"); - op.add(Builder::text, JsonpDeserializer.stringDeserializer(), "text"); - op.add(Builder::imageUrl, ImageUrl._DESERIALIZER, "image_url"); - op.add(Builder::file, FileContent._DESERIALIZER, "file"); + op.setTypeProperty("type", null); } + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + ContentObject::setupContentObjectDeserializer, Builder::build); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ContentObjectBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ContentObjectBuilders.java new file mode 100644 index 0000000000..f588dfb516 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ContentObjectBuilders.java @@ -0,0 +1,101 @@ +/* + * 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.inference; + +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 ContentObject} variants. + */ +public class ContentObjectBuilders { + private ContentObjectBuilders() { + } + + /** + * Creates a builder for the {@link FileContentPart file} {@code ContentObject} + * variant. + */ + public static FileContentPart.Builder file() { + return new FileContentPart.Builder(); + } + + /** + * Creates a ContentObject of the {@link FileContentPart file} + * {@code ContentObject} variant. + */ + public static ContentObject file(Function> fn) { + ContentObject.Builder builder = new ContentObject.Builder(); + builder.file(fn.apply(new FileContentPart.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link ImageUrlContent image_url} + * {@code ContentObject} variant. + */ + public static ImageUrlContent.Builder imageUrl() { + return new ImageUrlContent.Builder(); + } + + /** + * Creates a ContentObject of the {@link ImageUrlContent image_url} + * {@code ContentObject} variant. + */ + public static ContentObject imageUrl(Function> fn) { + ContentObject.Builder builder = new ContentObject.Builder(); + builder.imageUrl(fn.apply(new ImageUrlContent.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link TextContent text} {@code ContentObject} + * variant. + */ + public static TextContent.Builder text() { + return new TextContent.Builder(); + } + + /** + * Creates a ContentObject of the {@link TextContent text} {@code ContentObject} + * variant. + */ + public static ContentObject text(Function> fn) { + ContentObject.Builder builder = new ContentObject.Builder(); + builder.text(fn.apply(new TextContent.Builder()).build()); + return builder.build(); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ContentType.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ContentObjectVariant.java similarity index 69% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ContentType.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ContentObjectVariant.java index 9eda687e89..b1d124fe8b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ContentType.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ContentObjectVariant.java @@ -19,9 +19,7 @@ package co.elastic.clients.elasticsearch.inference; -import co.elastic.clients.json.JsonEnum; -import co.elastic.clients.json.JsonpDeserializable; -import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpSerializable; //---------------------------------------------------------------- // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. @@ -39,30 +37,14 @@ //---------------------------------------------------------------- /** - * - * @see API - * specification + * Base interface for {@link ContentObject} variants. */ -@JsonpDeserializable -public enum ContentType implements JsonEnum { - Text("text"), - - ImageUrl("image_url"), - - File("file"), +public interface ContentObjectVariant extends JsonpSerializable { - ; - - private final String jsonValue; - - ContentType(String jsonValue) { - this.jsonValue = jsonValue; - } + ContentObject.Kind _contentObjectKind(); - public String jsonValue() { - return this.jsonValue; + default ContentObject _toContentObject() { + return new ContentObject(this); } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - ContentType.values()); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/FileContentPart.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/FileContentPart.java new file mode 100644 index 0000000000..4c581b024d --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/FileContentPart.java @@ -0,0 +1,189 @@ +/* + * 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.inference; + +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.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: inference._types.FileContentPart + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class FileContentPart implements ContentObjectVariant, JsonpSerializable { + private final FileContent file; + + // --------------------------------------------------------------------------------------------- + + private FileContentPart(Builder builder) { + + this.file = ApiTypeHelper.requireNonNull(builder.file, this, "file"); + + } + + public static FileContentPart of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * ContentObject variant kind. + */ + @Override + public ContentObject.Kind _contentObjectKind() { + return ContentObject.Kind.File; + } + + /** + * Required - The file content. + *

+ * API name: {@code file} + */ + public final FileContent file() { + return this.file; + } + + /** + * 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.write("type", "file"); + + generator.writeKey("file"); + this.file.serialize(generator, mapper); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link FileContentPart}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private FileContent file; + + public Builder() { + } + private Builder(FileContentPart instance) { + this.file = instance.file; + + } + /** + * Required - The file content. + *

+ * API name: {@code file} + */ + public final Builder file(FileContent value) { + this.file = value; + return this; + } + + /** + * Required - The file content. + *

+ * API name: {@code file} + */ + public final Builder file(Function> fn) { + return this.file(fn.apply(new FileContent.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link FileContentPart}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public FileContentPart build() { + _checkSingleUse(); + + return new FileContentPart(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link FileContentPart} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + FileContentPart::setupFileContentPartDeserializer); + + protected static void setupFileContentPartDeserializer(ObjectDeserializer op) { + + op.add(Builder::file, FileContent._DESERIALIZER, "file"); + + op.ignore("type"); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ImageUrlContent.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ImageUrlContent.java new file mode 100644 index 0000000000..208954cc45 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ImageUrlContent.java @@ -0,0 +1,189 @@ +/* + * 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.inference; + +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.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: inference._types.ImageUrlContent + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ImageUrlContent implements ContentObjectVariant, JsonpSerializable { + private final ImageUrl imageUrl; + + // --------------------------------------------------------------------------------------------- + + private ImageUrlContent(Builder builder) { + + this.imageUrl = ApiTypeHelper.requireNonNull(builder.imageUrl, this, "imageUrl"); + + } + + public static ImageUrlContent of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * ContentObject variant kind. + */ + @Override + public ContentObject.Kind _contentObjectKind() { + return ContentObject.Kind.ImageUrl; + } + + /** + * Required - The image content. + *

+ * API name: {@code image_url} + */ + public final ImageUrl imageUrl() { + return this.imageUrl; + } + + /** + * 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.write("type", "image_url"); + + generator.writeKey("image_url"); + this.imageUrl.serialize(generator, mapper); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ImageUrlContent}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private ImageUrl imageUrl; + + public Builder() { + } + private Builder(ImageUrlContent instance) { + this.imageUrl = instance.imageUrl; + + } + /** + * Required - The image content. + *

+ * API name: {@code image_url} + */ + public final Builder imageUrl(ImageUrl value) { + this.imageUrl = value; + return this; + } + + /** + * Required - The image content. + *

+ * API name: {@code image_url} + */ + public final Builder imageUrl(Function> fn) { + return this.imageUrl(fn.apply(new ImageUrl.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ImageUrlContent}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ImageUrlContent build() { + _checkSingleUse(); + + return new ImageUrlContent(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ImageUrlContent} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + ImageUrlContent::setupImageUrlContentDeserializer); + + protected static void setupImageUrlContentDeserializer(ObjectDeserializer op) { + + op.add(Builder::imageUrl, ImageUrl._DESERIALIZER, "image_url"); + + op.ignore("type"); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/TextContent.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/TextContent.java new file mode 100644 index 0000000000..a172800ea9 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/TextContent.java @@ -0,0 +1,180 @@ +/* + * 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.inference; + +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: inference._types.TextContent + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class TextContent implements ContentObjectVariant, JsonpSerializable { + private final String text; + + // --------------------------------------------------------------------------------------------- + + private TextContent(Builder builder) { + + this.text = ApiTypeHelper.requireNonNull(builder.text, this, "text"); + + } + + public static TextContent of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * ContentObject variant kind. + */ + @Override + public ContentObject.Kind _contentObjectKind() { + return ContentObject.Kind.Text; + } + + /** + * Required - The text content. + *

+ * API name: {@code text} + */ + public final String text() { + return this.text; + } + + /** + * 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.write("type", "text"); + + generator.writeKey("text"); + generator.write(this.text); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link TextContent}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private String text; + + public Builder() { + } + private Builder(TextContent instance) { + this.text = instance.text; + + } + /** + * Required - The text content. + *

+ * API name: {@code text} + */ + public final Builder text(String value) { + this.text = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link TextContent}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public TextContent build() { + _checkSingleUse(); + + return new TextContent(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TextContent} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + TextContent::setupTextContentDeserializer); + + protected static void setupTextContentDeserializer(ObjectDeserializer op) { + + op.add(Builder::text, JsonpDeserializer.stringDeserializer(), "text"); + + op.ignore("type"); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/ElasticsearchPrometheusAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/ElasticsearchPrometheusAsyncClient.java new file mode 100644 index 0000000000..d9c7e03544 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/ElasticsearchPrometheusAsyncClient.java @@ -0,0 +1,131 @@ +/* + * 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.prometheus; + +import co.elastic.clients.ApiClient; +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.transport.ElasticsearchTransport; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.JsonEndpoint; +import co.elastic.clients.transport.Transport; +import co.elastic.clients.transport.TransportOptions; +import co.elastic.clients.util.ObjectBuilder; +import java.util.concurrent.CompletableFuture; +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. +// +//---------------------------------------------------------------- + +/** + * Client for the prometheus namespace. + */ +public class ElasticsearchPrometheusAsyncClient + extends + ApiClient { + + public ElasticsearchPrometheusAsyncClient(ElasticsearchTransport transport) { + super(transport, null); + } + + public ElasticsearchPrometheusAsyncClient(ElasticsearchTransport transport, + @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + @Override + public ElasticsearchPrometheusAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new ElasticsearchPrometheusAsyncClient(this.transport, transportOptions); + } + + // ----- Endpoint: prometheus.status_buildinfo + + /** + * Get Prometheus build information. + *

+ * Get Elasticsearch build information in the format of the Prometheus + * /api/v1/status/buildinfo endpoint. Prometheus-compatible + * clients, such as Grafana, call this endpoint to identify the backend and the + * features it supports. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture statusBuildinfo(StatusBuildinfoRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) StatusBuildinfoRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Get Prometheus build information. + *

+ * Get Elasticsearch build information in the format of the Prometheus + * /api/v1/status/buildinfo endpoint. Prometheus-compatible + * clients, such as Grafana, call this endpoint to identify the backend and the + * features it supports. + * + * @param fn + * a function that initializes a builder to create the + * {@link StatusBuildinfoRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture statusBuildinfo( + Function> fn) { + return statusBuildinfo(fn.apply(new StatusBuildinfoRequest.Builder()).build()); + } + + /** + * Get Prometheus build information. + *

+ * Get Elasticsearch build information in the format of the Prometheus + * /api/v1/status/buildinfo endpoint. Prometheus-compatible + * clients, such as Grafana, call this endpoint to identify the backend and the + * features it supports. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture statusBuildinfo() { + return this.transport.performRequestAsync(new StatusBuildinfoRequest.Builder().build(), + StatusBuildinfoRequest._ENDPOINT, this.transportOptions); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/ElasticsearchPrometheusClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/ElasticsearchPrometheusClient.java new file mode 100644 index 0000000000..5c099b673e --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/ElasticsearchPrometheusClient.java @@ -0,0 +1,132 @@ +/* + * 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.prometheus; + +import co.elastic.clients.ApiClient; +import co.elastic.clients.elasticsearch._types.ElasticsearchException; +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.transport.ElasticsearchTransport; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.JsonEndpoint; +import co.elastic.clients.transport.Transport; +import co.elastic.clients.transport.TransportOptions; +import co.elastic.clients.util.ObjectBuilder; +import java.io.IOException; +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. +// +//---------------------------------------------------------------- + +/** + * Client for the prometheus namespace. + */ +public class ElasticsearchPrometheusClient extends ApiClient { + + public ElasticsearchPrometheusClient(ElasticsearchTransport transport) { + super(transport, null); + } + + public ElasticsearchPrometheusClient(ElasticsearchTransport transport, + @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + @Override + public ElasticsearchPrometheusClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new ElasticsearchPrometheusClient(this.transport, transportOptions); + } + + // ----- Endpoint: prometheus.status_buildinfo + + /** + * Get Prometheus build information. + *

+ * Get Elasticsearch build information in the format of the Prometheus + * /api/v1/status/buildinfo endpoint. Prometheus-compatible + * clients, such as Grafana, call this endpoint to identify the backend and the + * features it supports. + * + * @see Documentation + * on elastic.co + */ + + public StatusBuildinfoResponse statusBuildinfo(StatusBuildinfoRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) StatusBuildinfoRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Get Prometheus build information. + *

+ * Get Elasticsearch build information in the format of the Prometheus + * /api/v1/status/buildinfo endpoint. Prometheus-compatible + * clients, such as Grafana, call this endpoint to identify the backend and the + * features it supports. + * + * @param fn + * a function that initializes a builder to create the + * {@link StatusBuildinfoRequest} + * @see Documentation + * on elastic.co + */ + + public final StatusBuildinfoResponse statusBuildinfo( + Function> fn) + throws IOException, ElasticsearchException { + return statusBuildinfo(fn.apply(new StatusBuildinfoRequest.Builder()).build()); + } + + /** + * Get Prometheus build information. + *

+ * Get Elasticsearch build information in the format of the Prometheus + * /api/v1/status/buildinfo endpoint. Prometheus-compatible + * clients, such as Grafana, call this endpoint to identify the backend and the + * features it supports. + * + * @see Documentation + * on elastic.co + */ + + public StatusBuildinfoResponse statusBuildinfo() throws IOException, ElasticsearchException { + return this.transport.performRequest(new StatusBuildinfoRequest.Builder().build(), + StatusBuildinfoRequest._ENDPOINT, this.transportOptions); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/StatusBuildinfoRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/StatusBuildinfoRequest.java new file mode 100644 index 0000000000..9ac0baace7 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/StatusBuildinfoRequest.java @@ -0,0 +1,220 @@ +/* + * 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.prometheus; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +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: prometheus.status_buildinfo.Request + +/** + * Get Prometheus build information. + *

+ * Get Elasticsearch build information in the format of the Prometheus + * /api/v1/status/buildinfo endpoint. Prometheus-compatible + * clients, such as Grafana, call this endpoint to identify the backend and the + * features it supports. + * + * @see API + * specification + */ + +public class StatusBuildinfoRequest extends RequestBase { + @Nullable + private final String index; + + // --------------------------------------------------------------------------------------------- + + private StatusBuildinfoRequest(Builder builder) { + + this.index = builder.index; + + } + + public static StatusBuildinfoRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * An index pattern, accepted for consistency with the other Prometheus + * endpoints. The response doesn't depend on it. + *

+ * API name: {@code index} + */ + @Nullable + public final String index() { + return this.index; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link StatusBuildinfoRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private String index; + + public Builder() { + } + private Builder(StatusBuildinfoRequest instance) { + this.index = instance.index; + + } + /** + * An index pattern, accepted for consistency with the other Prometheus + * endpoints. The response doesn't depend on it. + *

+ * API name: {@code index} + */ + public final Builder index(@Nullable String value) { + this.index = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link StatusBuildinfoRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public StatusBuildinfoRequest build() { + _checkSingleUse(); + + return new StatusBuildinfoRequest(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code prometheus.status_buildinfo}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/prometheus.status_buildinfo", + + // Request method + request -> { + return "GET"; + + }, + + // Request path + request -> { + final int _index = 1 << 0; + + int propsSet = 0; + + if (request.index() != null) + propsSet |= _index; + + if (propsSet == 0) { + StringBuilder buf = new StringBuilder(); + buf.append("/_prometheus"); + buf.append("/api"); + buf.append("/v1"); + buf.append("/status"); + buf.append("/buildinfo"); + return buf.toString(); + } + if (propsSet == (_index)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_prometheus"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.index, buf); + buf.append("/api"); + buf.append("/v1"); + buf.append("/status"); + buf.append("/buildinfo"); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Path parameters + request -> { + Map params = new HashMap<>(); + final int _index = 1 << 0; + + int propsSet = 0; + + if (request.index() != null) + propsSet |= _index; + + if (propsSet == 0) { + } + if (propsSet == (_index)) { + params.put("index", request.index); + } + return params; + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), false, StatusBuildinfoResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/StatusBuildinfoResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/StatusBuildinfoResponse.java new file mode 100644 index 0000000000..70e4b49256 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/StatusBuildinfoResponse.java @@ -0,0 +1,199 @@ +/* + * 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.prometheus; + +import co.elastic.clients.elasticsearch.prometheus.status_buildinfo.BuildInfo; +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: prometheus.status_buildinfo.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class StatusBuildinfoResponse implements JsonpSerializable { + private final String status; + + private final BuildInfo data; + + // --------------------------------------------------------------------------------------------- + + private StatusBuildinfoResponse(Builder builder) { + + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + this.data = ApiTypeHelper.requireNonNull(builder.data, this, "data"); + + } + + public static StatusBuildinfoResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The status of the request. It is always success. + *

+ * API name: {@code status} + */ + public final String status() { + return this.status; + } + + /** + * Required - The Elasticsearch build information. + *

+ * API name: {@code data} + */ + public final BuildInfo data() { + return this.data; + } + + /** + * 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"); + generator.write(this.status); + + generator.writeKey("data"); + this.data.serialize(generator, mapper); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link StatusBuildinfoResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private String status; + + private BuildInfo data; + + /** + * Required - The status of the request. It is always success. + *

+ * API name: {@code status} + */ + public final Builder status(String value) { + this.status = value; + return this; + } + + /** + * Required - The Elasticsearch build information. + *

+ * API name: {@code data} + */ + public final Builder data(BuildInfo value) { + this.data = value; + return this; + } + + /** + * Required - The Elasticsearch build information. + *

+ * API name: {@code data} + */ + public final Builder data(Function> fn) { + return this.data(fn.apply(new BuildInfo.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link StatusBuildinfoResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public StatusBuildinfoResponse build() { + _checkSingleUse(); + + return new StatusBuildinfoResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link StatusBuildinfoResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, StatusBuildinfoResponse::setupStatusBuildinfoResponseDeserializer); + + protected static void setupStatusBuildinfoResponseDeserializer( + ObjectDeserializer op) { + + op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status"); + op.add(Builder::data, BuildInfo._DESERIALIZER, "data"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/status_buildinfo/BuildInfo.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/status_buildinfo/BuildInfo.java new file mode 100644 index 0000000000..af697b6536 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/prometheus/status_buildinfo/BuildInfo.java @@ -0,0 +1,260 @@ +/* + * 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.prometheus.status_buildinfo; + +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.DateTime; +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: prometheus.status_buildinfo.BuildInfo + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class BuildInfo implements JsonpSerializable { + private final String application; + + private final String version; + + private final String revision; + + private final DateTime builddate; + + // --------------------------------------------------------------------------------------------- + + private BuildInfo(Builder builder) { + + this.application = ApiTypeHelper.requireNonNull(builder.application, this, "application"); + this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); + this.revision = ApiTypeHelper.requireNonNull(builder.revision, this, "revision"); + this.builddate = ApiTypeHelper.requireNonNull(builder.builddate, this, "builddate"); + + } + + public static BuildInfo of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The name of the application. It is always + * Elasticsearch. + *

+ * API name: {@code application} + */ + public final String application() { + return this.application; + } + + /** + * Required - The Elasticsearch version. + *

+ * API name: {@code version} + */ + public final String version() { + return this.version; + } + + /** + * Required - The commit hash of the Elasticsearch build. + *

+ * API name: {@code revision} + */ + public final String revision() { + return this.revision; + } + + /** + * Required - The date of the Elasticsearch build. + *

+ * API name: {@code buildDate} + */ + public final DateTime builddate() { + return this.builddate; + } + + /** + * 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("application"); + generator.write(this.application); + + generator.writeKey("version"); + generator.write(this.version); + + generator.writeKey("revision"); + generator.write(this.revision); + + generator.writeKey("buildDate"); + this.builddate.serialize(generator, mapper); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link BuildInfo}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private String application; + + private String version; + + private String revision; + + private DateTime builddate; + + public Builder() { + } + private Builder(BuildInfo instance) { + this.application = instance.application; + this.version = instance.version; + this.revision = instance.revision; + this.builddate = instance.builddate; + + } + /** + * Required - The name of the application. It is always + * Elasticsearch. + *

+ * API name: {@code application} + */ + public final Builder application(String value) { + this.application = value; + return this; + } + + /** + * Required - The Elasticsearch version. + *

+ * API name: {@code version} + */ + public final Builder version(String value) { + this.version = value; + return this; + } + + /** + * Required - The commit hash of the Elasticsearch build. + *

+ * API name: {@code revision} + */ + public final Builder revision(String value) { + this.revision = value; + return this; + } + + /** + * Required - The date of the Elasticsearch build. + *

+ * API name: {@code buildDate} + */ + public final Builder builddate(DateTime value) { + this.builddate = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link BuildInfo}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public BuildInfo build() { + _checkSingleUse(); + + return new BuildInfo(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link BuildInfo} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + BuildInfo::setupBuildInfoDeserializer); + + protected static void setupBuildInfoDeserializer(ObjectDeserializer op) { + + op.add(Builder::application, JsonpDeserializer.stringDeserializer(), "application"); + op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); + op.add(Builder::revision, JsonpDeserializer.stringDeserializer(), "revision"); + op.add(Builder::builddate, DateTime._DESERIALIZER, "buildDate"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/rollup/Groupings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/rollup/Groupings.java index fac799d6cc..6de7a4740a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/rollup/Groupings.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/rollup/Groupings.java @@ -26,6 +26,7 @@ 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; @@ -57,7 +58,6 @@ */ @JsonpDeserializable public class Groupings implements JsonpSerializable { - @Nullable private final DateHistogramGrouping dateHistogram; @Nullable @@ -70,7 +70,7 @@ public class Groupings implements JsonpSerializable { private Groupings(Builder builder) { - this.dateHistogram = builder.dateHistogram; + this.dateHistogram = ApiTypeHelper.requireNonNull(builder.dateHistogram, this, "dateHistogram"); this.histogram = builder.histogram; this.terms = builder.terms; @@ -81,13 +81,12 @@ public static Groupings of(Function> fn) { } /** - * A date histogram group aggregates a date field into time-based buckets. This - * group is mandatory; you currently cannot roll up documents without a - * timestamp and a date_histogram group. + * Required - A date histogram group aggregates a date field into time-based + * buckets. This group is mandatory; you currently cannot roll up documents + * without a timestamp and a date_histogram group. *

* API name: {@code date_histogram} */ - @Nullable public final DateHistogramGrouping dateHistogram() { return this.dateHistogram; } @@ -128,11 +127,9 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.dateHistogram != null) { - generator.writeKey("date_histogram"); - this.dateHistogram.serialize(generator, mapper); + generator.writeKey("date_histogram"); + this.dateHistogram.serialize(generator, mapper); - } if (this.histogram != null) { generator.writeKey("histogram"); this.histogram.serialize(generator, mapper); @@ -158,7 +155,6 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable private DateHistogramGrouping dateHistogram; @Nullable @@ -176,21 +172,21 @@ private Builder(Groupings instance) { } /** - * A date histogram group aggregates a date field into time-based buckets. This - * group is mandatory; you currently cannot roll up documents without a - * timestamp and a date_histogram group. + * Required - A date histogram group aggregates a date field into time-based + * buckets. This group is mandatory; you currently cannot roll up documents + * without a timestamp and a date_histogram group. *

* API name: {@code date_histogram} */ - public final Builder dateHistogram(@Nullable DateHistogramGrouping value) { + public final Builder dateHistogram(DateHistogramGrouping value) { this.dateHistogram = value; return this; } /** - * A date histogram group aggregates a date field into time-based buckets. This - * group is mandatory; you currently cannot roll up documents without a - * timestamp and a date_histogram group. + * Required - A date histogram group aggregates a date field into time-based + * buckets. This group is mandatory; you currently cannot roll up documents + * without a timestamp and a date_histogram group. *

* API name: {@code date_histogram} */ From 666b1d1a363a28f072f32c96c994b468c24ac856 Mon Sep 17 00:00:00 2001 From: Laura Trotta <153528055+l-trotta@users.noreply.github.com> Date: Mon, 16 Nov 2026 15:28:39 +0100 Subject: [PATCH 2/4] Fix bulk ingester operation fields after the spec update (#1388) (#1390) * remove unsupported params from bulk ingest op * Keep all bulk operation fields in the bulk ingester --- .../_helpers/bulk/IngesterOperation.java | 77 ++++++++----------- .../_helpers/bulk/BulkIngesterTest.java | 62 +++++++++++++++ 2 files changed, 94 insertions(+), 45 deletions(-) diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_helpers/bulk/IngesterOperation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_helpers/bulk/IngesterOperation.java index 36d51642ca..5c4561f8b9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_helpers/bulk/IngesterOperation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_helpers/bulk/IngesterOperation.java @@ -24,7 +24,9 @@ import co.elastic.clients.elasticsearch.core.bulk.CreateOperation; import co.elastic.clients.elasticsearch.core.bulk.DeleteOperation; import co.elastic.clients.elasticsearch.core.bulk.IndexOperation; +import co.elastic.clients.elasticsearch.core.bulk.UpdateAction; import co.elastic.clients.elasticsearch.core.bulk.UpdateOperation; +import co.elastic.clients.elasticsearch.core.bulk.WriteOperation; import co.elastic.clients.json.JsonEnum; import co.elastic.clients.json.JsonpMapper; import co.elastic.clients.util.BinaryData; @@ -83,11 +85,12 @@ public boolean canRetry() { return repeatableOp.canRetry(); } + @SuppressWarnings("unchecked") private static IngesterOperation createOperation(RetryableBulkOperation repeatableOp, JsonpMapper mapper) { CreateOperation create = repeatableOp.operation().create(); RetryableBulkOperation newOperation; - long size = basePropertiesSize(create); + long size = writePropertiesSize(create); if (create.document() instanceof BinaryData) { newOperation = repeatableOp; @@ -96,20 +99,21 @@ private static IngesterOperation createOperation(RetryableBul } else { BinaryData binaryDoc = BinaryData.of(create.document(), mapper); size += binaryDoc.size(); - newOperation = new RetryableBulkOperation<>(BulkOperation.of(bo -> bo.create(idx -> { - copyCreateProperties(create, idx); - return idx.document(binaryDoc); - })),repeatableOp.context(),repeatableOp.retries()); + newOperation = new RetryableBulkOperation<>( + BulkOperation.of(bo -> bo.create(create.rebuild().document(binaryDoc).build())), + repeatableOp.context(), repeatableOp.retries()); } return new IngesterOperation<>(newOperation, size); } + @SuppressWarnings("unchecked") private static IngesterOperation indexOperation(RetryableBulkOperation repeatableOp, JsonpMapper mapper) { IndexOperation index = repeatableOp.operation().index(); RetryableBulkOperation newOperation; - long size = basePropertiesSize(index); + long size = writePropertiesSize(index) + + size("op_type", index.opType()); if (index.document() instanceof BinaryData) { newOperation = repeatableOp; @@ -118,22 +122,24 @@ private static IngesterOperation indexOperation(RetryableBulk } else { BinaryData binaryDoc = BinaryData.of(index.document(), mapper); size += binaryDoc.size(); - newOperation = new RetryableBulkOperation<>(BulkOperation.of(bo -> bo.index(idx -> { - copyIndexProperties(index, idx); - return idx.document(binaryDoc); - })),repeatableOp.context(),repeatableOp.retries()); + newOperation = new RetryableBulkOperation<>( + BulkOperation.of(bo -> bo.index(index.rebuild().document(binaryDoc).build())), + repeatableOp.context(), repeatableOp.retries()); } return new IngesterOperation<>(newOperation, size); } + @SuppressWarnings("unchecked") private static IngesterOperation updateOperation(RetryableBulkOperation repeatableOp, JsonpMapper mapper) { UpdateOperation update = repeatableOp.operation().update(); RetryableBulkOperation newOperation; long size = basePropertiesSize(update) + size("retry_on_conflict", update.retryOnConflict()) + - size("require_alias", update.requireAlias()); + size("require_alias", update.requireAlias()) + + size("pipeline", update.pipeline()) + + size("list_executed_pipelines", update.listExecutedPipelines()); if (update.binaryAction() != null) { newOperation = repeatableOp; @@ -142,13 +148,9 @@ private static IngesterOperation updateOperation(RetryableBul } else { BinaryData action = BinaryData.of(update.action(), mapper); size += action.size(); - newOperation = new RetryableBulkOperation<>(BulkOperation.of(bo -> bo.update(u -> { - copyBaseProperties(update, u); - return u - .binaryAction(action) - .requireAlias(update.requireAlias()) - .retryOnConflict(update.retryOnConflict()); - })),repeatableOp.context(),repeatableOp.retries()); + newOperation = new RetryableBulkOperation<>( + BulkOperation.of(bo -> bo.update(update.rebuild().action((UpdateAction) null).binaryAction(action).build())), + repeatableOp.context(), repeatableOp.retries()); } return new IngesterOperation<>(newOperation, size); @@ -156,31 +158,10 @@ private static IngesterOperation updateOperation(RetryableBul private static IngesterOperation deleteOperation(RetryableBulkOperation repeatableOp) { DeleteOperation delete = repeatableOp.operation().delete(); - return new IngesterOperation<>(repeatableOp, basePropertiesSize(delete)); - } - - - private static void copyBaseProperties(BulkOperationBase op, BulkOperationBase.AbstractBuilder builder) { - builder - .id(op.id()) - .index(op.index()) - .ifPrimaryTerm(op.ifPrimaryTerm()) - .ifSeqNo(op.ifSeqNo()) - .routing(op.routing()) - .version(op.version()) - .versionType(op.versionType()); - } - - private static void copyIndexProperties(IndexOperation op, IndexOperation.Builder builder) { - copyBaseProperties(op, builder); - builder.pipeline(op.pipeline()); - builder.requireAlias(op.requireAlias()); - } - - private static void copyCreateProperties(CreateOperation op, CreateOperation.Builder builder) { - copyBaseProperties(op, builder); - builder.pipeline(op.pipeline()); - builder.requireAlias(op.requireAlias()); + long size = basePropertiesSize(delete) + + size("version", delete.version()) + + size("version_type", delete.versionType()); + return new IngesterOperation<>(repeatableOp, size); } private static int size(String name, @Nullable Boolean value) { @@ -253,8 +234,14 @@ private static int basePropertiesSize(BulkOperationBase op) { size("if_primary_term", op.ifPrimaryTerm()) + size("if_seq_no", op.ifSeqNo()) + size("routing", op.routing()) + - size("version", op.version()) + - size("version_type", op.versionType()) + 4; // Open/closing brace, 2 newlines } + + private static int writePropertiesSize(WriteOperation op) { + return basePropertiesSize(op) + + size("version", op.version()) + + size("version_type", op.versionType()) + + size("require_data_stream", op.requireDataStream()) + + size("list_executed_pipelines", op.listExecutedPipelines()); + } } diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/_helpers/bulk/BulkIngesterTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/_helpers/bulk/BulkIngesterTest.java index 106417b071..d920c9470b 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/_helpers/bulk/BulkIngesterTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/_helpers/bulk/BulkIngesterTest.java @@ -22,11 +22,14 @@ import co.elastic.clients.elasticsearch.ElasticsearchAsyncClient; import co.elastic.clients.elasticsearch.ElasticsearchClient; import co.elastic.clients.elasticsearch.ElasticsearchTestServer; +import co.elastic.clients.elasticsearch._types.OpType; +import co.elastic.clients.elasticsearch._types.VersionType; import co.elastic.clients.elasticsearch.core.BulkRequest; import co.elastic.clients.elasticsearch.core.BulkResponse; import co.elastic.clients.elasticsearch.core.bulk.BulkOperation; import co.elastic.clients.elasticsearch.core.bulk.BulkResponseItem; import co.elastic.clients.elasticsearch.core.bulk.OperationType; +import co.elastic.clients.elasticsearch.core.bulk.UpdateOperation; import co.elastic.clients.elasticsearch.end_to_end.RequestTest; import co.elastic.clients.elasticsearch.indices.IndicesStatsResponse; import co.elastic.clients.json.JsonpMapper; @@ -45,6 +48,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; @@ -458,6 +462,64 @@ public void pipelineTest() { assertEquals(json, create1Str); } + @Test + public void allPropertiesKeptTest() { + JsonpMapper mapper = new SimpleJsonpMapper(); + + BulkOperation index = BulkOperation.of(o -> o.index(i -> i + .index("some_idx") + .id("some_id") + .routing("r") + .ifSeqNo(1L) + .ifPrimaryTerm(2L) + .version(3L) + .versionType(VersionType.External) + .dynamicTemplates("field", "template") + .dynamicTemplateParams("field", Map.of("unit", "cm")) + .pipeline("pipe") + .requireAlias(true) + .requireDataStream(false) + .listExecutedPipelines(true) + .opType(OpType.Create) + .document("Some doc") + )); + + BulkOperation create = BulkOperation.of(o -> o.create(c -> c + .index("some_idx") + .id("some_id") + .version(3L) + .versionType(VersionType.External) + .dynamicTemplates("field", "template") + .requireDataStream(true) + .listExecutedPipelines(true) + .document("Some doc") + )); + + BulkOperation update = BulkOperation.of(o -> o.update(u -> u + .index("some_idx") + .id("some_id") + .ifSeqNo(1L) + .ifPrimaryTerm(2L) + .retryOnConflict(3) + .requireAlias(true) + .pipeline("pipe") + .listExecutedPipelines(true) + .source(s -> s.fetch(false)) + .action(a -> a.doc("Some doc")) + )); + + for (BulkOperation op : List.of(index, create, update)) { + BulkOperation ingested = IngesterOperation.of(new RetryableBulkOperation<>(op, null, null), mapper) + .repeatableOperation().operation(); + assertEquals(JsonpUtils.toJsonString(op, mapper), JsonpUtils.toJsonString(ingested, mapper)); + } + + UpdateOperation ingestedUpdate = IngesterOperation.of(new RetryableBulkOperation<>(update, null, null), mapper) + .repeatableOperation().operation().update(); + assertNull(ingestedUpdate.action()); + assertNotNull(ingestedUpdate.binaryAction()); + } + @Test public void endToEndTest() throws Exception { String index = "bulk-ingester-test"; From 3f255568aac57972b62fbb9e46cc407ef3043e38 Mon Sep 17 00:00:00 2001 From: Laura Trotta <153528055+l-trotta@users.noreply.github.com> Date: Mon, 16 Nov 2026 16:19:07 +0100 Subject: [PATCH 3/4] Include all action line fields in bulk ingester size estimates (#1392) (#1394) (cherry picked from commit 1fb0cbeb148b3fb775d7310a7e1f9501a591eedb) Without the _slice field, which doesn't exist on this branch. --- .../_helpers/bulk/IngesterOperation.java | 2 ++ .../_helpers/bulk/BulkIngesterTest.java | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_helpers/bulk/IngesterOperation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_helpers/bulk/IngesterOperation.java index 5c4561f8b9..ddd752aa89 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_helpers/bulk/IngesterOperation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_helpers/bulk/IngesterOperation.java @@ -241,6 +241,8 @@ private static int writePropertiesSize(WriteOperation op) { return basePropertiesSize(op) + size("version", op.version()) + size("version_type", op.versionType()) + + size("pipeline", op.pipeline()) + + size("require_alias", op.requireAlias()) + size("require_data_stream", op.requireDataStream()) + size("list_executed_pipelines", op.listExecutedPipelines()); } diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/_helpers/bulk/BulkIngesterTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/_helpers/bulk/BulkIngesterTest.java index d920c9470b..dc49519edd 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/_helpers/bulk/BulkIngesterTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/_helpers/bulk/BulkIngesterTest.java @@ -462,6 +462,24 @@ public void pipelineTest() { assertEquals(json, create1Str); } + @Test + public void sizeIncludesPropertiesTest() { + JsonpMapper mapper = new SimpleJsonpMapper(); + + BulkOperation plain = BulkOperation.of(o -> o.index(i -> i.index("some_idx").document("Some doc"))); + long plainSize = IngesterOperation.of(new RetryableBulkOperation<>(plain, null, null), mapper).size(); + + List withProperty = List.of( + BulkOperation.of(o -> o.index(i -> i.index("some_idx").pipeline("pipe").document("Some doc"))), + BulkOperation.of(o -> o.index(i -> i.index("some_idx").requireAlias(true).document("Some doc"))) + ); + + for (BulkOperation op : withProperty) { + long size = IngesterOperation.of(new RetryableBulkOperation<>(op, null, null), mapper).size(); + assertTrue(size > plainSize, JsonpUtils.toJsonString(op, mapper)); + } + } + @Test public void allPropertiesKeptTest() { JsonpMapper mapper = new SimpleJsonpMapper(); From 58373acebe76c4d47aa3d0b677592d100975ed4d Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Mon, 16 Nov 2026 16:42:07 +0000 Subject: [PATCH 4/4] [codegen] update to latest spec --- .../core/bulk/BulkOperationBase.java | 74 ++++++++++++++++ .../core/bulk/DeleteOperation.java | 84 ------------------- .../core/bulk/WriteOperation.java | 75 ----------------- 3 files changed, 74 insertions(+), 159 deletions(-) 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 704cc6d39a..c043396115 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; } @@ -132,6 +141,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. */ @@ -168,6 +200,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); + } } @@ -194,6 +235,12 @@ public abstract static class AbstractBuilder @@ -241,6 +288,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() { } @@ -250,6 +320,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; } @@ -266,6 +338,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 efaaee0aea..d845ffd834 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 1675ce6dd6..02356c5547 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; private final Map> dynamicTemplateParams; @@ -87,8 +79,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.dynamicTemplateParams = ApiTypeHelper.unmodifiable(builder.dynamicTemplateParams); this.pipeline = builder.pipeline; @@ -98,29 +88,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 @@ -196,15 +163,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(); @@ -261,12 +219,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; @@ -285,29 +237,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 @@ -423,8 +352,6 @@ protected AbstractBuilder() { protected AbstractBuilder(WriteOperation instance) { super(instance); - this.version = instance.version; - this.versionType = instance.versionType; this.dynamicTemplates = instance.dynamicTemplates; this.dynamicTemplateParams = instance.dynamicTemplateParams; this.pipeline = instance.pipeline; @@ -440,8 +367,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::dynamicTemplateParams,