From 4d4473fdc471c49fa6f16185932878da40062112 Mon Sep 17 00:00:00 2001 From: Sylvain Wallez Date: Tue, 21 Jun 2022 18:13:50 +0200 Subject: [PATCH 1/2] Add API spec validation tests --- .../DateHistogramAggregation.java | 41 ++- .../aggregations/HistogramAggregation.java | 42 ++- .../aggregations/MultiTermsAggregation.java | 226 ++++++++++++++++ .../_types/aggregations/TermsAggregation.java | 25 +- .../_types/mapping/FieldMapping.java | 27 -- .../elasticsearch/doc-files/api-spec.html | 181 ++++++------- .../get_field_mapping/TypeFieldMappings.java | 47 +++- .../ingest/PutPipelineRequest.java | 30 +++ .../ml/ElasticsearchMlAsyncClient.java | 36 +++ .../ml/ElasticsearchMlClient.java | 37 +++ .../GetModelSnapshotUpgradeStatsRequest.java | 249 ++++++++++++++++++ .../GetModelSnapshotUpgradeStatsResponse.java | 205 ++++++++++++++ .../ml/ModelSnapshotUpgrade.java | 247 +++++++++++++++++ .../ml/SnapshotUpgradeState.java | 59 +++++ .../security/ClusterPrivilege.java | 2 + .../security/CreateServiceTokenRequest.java | 62 ++++- .../security/GetUserPrivilegesResponse.java | 24 +- .../UpdateUserProfileDataRequest.java | 98 +++---- .../elasticsearch/security/UserProfile.java | 18 +- .../security/UserProfileUser.java | 61 +++-- .../security/UserProfileWithMetadata.java | 20 +- .../co/elastic/clients/util/NamedValue.java | 73 +++++ .../ElasticsearchTestServer.java | 33 +++ .../elasticsearch/model/BehaviorsTest.java | 3 + .../model/ClassStructureTest.java | 17 ++ .../spec_issues/SpecIssuesTest.java | 87 +++++- 26 files changed, 1665 insertions(+), 285 deletions(-) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetModelSnapshotUpgradeStatsRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetModelSnapshotUpgradeStatsResponse.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ModelSnapshotUpgrade.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/ml/SnapshotUpgradeState.java create mode 100644 java-client/src/main/java/co/elastic/clients/util/NamedValue.java diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DateHistogramAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DateHistogramAggregation.java index 1ddc8e49d..a4c7fc1ac 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DateHistogramAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DateHistogramAggregation.java @@ -24,6 +24,7 @@ package co.elastic.clients.elasticsearch._types.aggregations; import co.elastic.clients.elasticsearch._types.Script; +import co.elastic.clients.elasticsearch._types.SortOrder; import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.elasticsearch.transform.PivotGroupBy; import co.elastic.clients.elasticsearch.transform.PivotGroupByVariant; @@ -35,11 +36,13 @@ import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.DateTime; +import co.elastic.clients.util.NamedValue; import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.lang.Integer; import java.lang.String; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Function; @@ -85,8 +88,7 @@ public class DateHistogramAggregation extends BucketAggregationBase implements A @Nullable private final Time offset; - @Nullable - private final HistogramOrder order; + private final List> order; private final Map params; @@ -114,7 +116,7 @@ private DateHistogramAggregation(Builder builder) { this.minDocCount = builder.minDocCount; this.missing = builder.missing; this.offset = builder.offset; - this.order = builder.order; + this.order = ApiTypeHelper.unmodifiable(builder.order); this.params = ApiTypeHelper.unmodifiable(builder.params); this.script = builder.script; this.timeZone = builder.timeZone; @@ -225,8 +227,7 @@ public final Time offset() { /** * API name: {@code order} */ - @Nullable - public final HistogramOrder order() { + public final List> order() { return this.order; } @@ -312,9 +313,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.offset.serialize(generator, mapper); } - if (this.order != null) { + if (ApiTypeHelper.isDefined(this.order)) { generator.writeKey("order"); - this.order.serialize(generator, mapper); + generator.writeStartArray(); + for (NamedValue item0 : this.order) { + generator.writeStartObject(); + generator.writeKey(item0.name()); + item0.value().serialize(generator, mapper); + generator.writeEnd(); + + } + generator.writeEnd(); } if (ApiTypeHelper.isDefined(this.params)) { @@ -386,7 +395,7 @@ public static class Builder extends BucketAggregationBase.AbstractBuilder> order; @Nullable private Map params; @@ -519,17 +528,22 @@ public final Builder offset(Function> fn) { /** * API name: {@code order} + *

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

+ * Adds one or more values to order. */ - public final Builder order(Function> fn) { - return this.order(fn.apply(new HistogramOrder.Builder()).build()); + public final Builder order(NamedValue value, NamedValue... values) { + this.order = _listAdd(this.order, value, values); + return this; } /** @@ -624,7 +638,8 @@ protected static void setupDateHistogramAggregationDeserializer( op.add(Builder::minDocCount, JsonpDeserializer.integerDeserializer(), "min_doc_count"); op.add(Builder::missing, DateTime._DESERIALIZER, "missing"); op.add(Builder::offset, Time._DESERIALIZER, "offset"); - op.add(Builder::order, HistogramOrder._DESERIALIZER, "order"); + op.add(Builder::order, + JsonpDeserializer.arrayDeserializer(NamedValue.deserializer(() -> SortOrder._DESERIALIZER)), "order"); op.add(Builder::params, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "params"); op.add(Builder::script, Script._DESERIALIZER, "script"); op.add(Builder::timeZone, JsonpDeserializer.stringDeserializer(), "time_zone"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/HistogramAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/HistogramAggregation.java index 4ea4c5dff..959cf5604 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/HistogramAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/HistogramAggregation.java @@ -24,6 +24,7 @@ package co.elastic.clients.elasticsearch._types.aggregations; import co.elastic.clients.elasticsearch._types.Script; +import co.elastic.clients.elasticsearch._types.SortOrder; import co.elastic.clients.elasticsearch.transform.PivotGroupBy; import co.elastic.clients.elasticsearch.transform.PivotGroupByVariant; import co.elastic.clients.json.JsonpDeserializable; @@ -31,12 +32,15 @@ import co.elastic.clients.json.JsonpMapper; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.NamedValue; import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.lang.Double; import java.lang.Integer; import java.lang.String; +import java.util.List; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -72,8 +76,7 @@ public class HistogramAggregation extends BucketAggregationBase implements Aggre @Nullable private final Double offset; - @Nullable - private final HistogramOrder order; + private final List> order; @Nullable private final Script script; @@ -96,7 +99,7 @@ private HistogramAggregation(Builder builder) { this.minDocCount = builder.minDocCount; this.missing = builder.missing; this.offset = builder.offset; - this.order = builder.order; + this.order = ApiTypeHelper.unmodifiable(builder.order); this.script = builder.script; this.format = builder.format; this.keyed = builder.keyed; @@ -182,8 +185,7 @@ public final Double offset() { /** * API name: {@code order} */ - @Nullable - public final HistogramOrder order() { + public final List> order() { return this.order; } @@ -249,9 +251,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.offset); } - if (this.order != null) { + if (ApiTypeHelper.isDefined(this.order)) { generator.writeKey("order"); - this.order.serialize(generator, mapper); + generator.writeStartArray(); + for (NamedValue item0 : this.order) { + generator.writeStartObject(); + generator.writeKey(item0.name()); + item0.value().serialize(generator, mapper); + generator.writeEnd(); + + } + generator.writeEnd(); } if (this.script != null) { @@ -303,7 +313,7 @@ public static class Builder extends BucketAggregationBase.AbstractBuilder> order; @Nullable private Script script; @@ -388,17 +398,22 @@ public final Builder offset(@Nullable Double value) { /** * API name: {@code order} + *

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

+ * Adds one or more values to order. */ - public final Builder order(Function> fn) { - return this.order(fn.apply(new HistogramOrder.Builder()).build()); + public final Builder order(NamedValue value, NamedValue... values) { + this.order = _listAdd(this.order, value, values); + return this; } /** @@ -470,7 +485,8 @@ protected static void setupHistogramAggregationDeserializer(ObjectDeserializer SortOrder._DESERIALIZER)), "order"); op.add(Builder::script, Script._DESERIALIZER, "script"); op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); op.add(Builder::keyed, JsonpDeserializer.booleanDeserializer(), "keyed"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MultiTermsAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MultiTermsAggregation.java index 2d8803d78..d2c10f31f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MultiTermsAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MultiTermsAggregation.java @@ -23,14 +23,19 @@ package co.elastic.clients.elasticsearch._types.aggregations; +import co.elastic.clients.elasticsearch._types.SortOrder; 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.ApiTypeHelper; +import co.elastic.clients.util.NamedValue; import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.Integer; +import java.lang.Long; import java.util.List; import java.util.Objects; import java.util.function.Function; @@ -46,6 +51,26 @@ */ @JsonpDeserializable public class MultiTermsAggregation extends BucketAggregationBase implements AggregationVariant { + @Nullable + private final TermsAggregationCollectMode collectMode; + + private final List> order; + + @Nullable + private final Long minDocCount; + + @Nullable + private final Long shardMinDocCount; + + @Nullable + private final Integer shardSize; + + @Nullable + private final Boolean showTermDocCountError; + + @Nullable + private final Integer size; + private final List terms; // --------------------------------------------------------------------------------------------- @@ -53,6 +78,13 @@ public class MultiTermsAggregation extends BucketAggregationBase implements Aggr private MultiTermsAggregation(Builder builder) { super(builder); + this.collectMode = builder.collectMode; + this.order = ApiTypeHelper.unmodifiable(builder.order); + this.minDocCount = builder.minDocCount; + this.shardMinDocCount = builder.shardMinDocCount; + this.shardSize = builder.shardSize; + this.showTermDocCountError = builder.showTermDocCountError; + this.size = builder.size; this.terms = ApiTypeHelper.unmodifiableRequired(builder.terms, this, "terms"); } @@ -69,6 +101,61 @@ public Aggregation.Kind _aggregationKind() { return Aggregation.Kind.MultiTerms; } + /** + * API name: {@code collect_mode} + */ + @Nullable + public final TermsAggregationCollectMode collectMode() { + return this.collectMode; + } + + /** + * API name: {@code order} + */ + public final List> order() { + return this.order; + } + + /** + * API name: {@code min_doc_count} + */ + @Nullable + public final Long minDocCount() { + return this.minDocCount; + } + + /** + * API name: {@code shard_min_doc_count} + */ + @Nullable + public final Long shardMinDocCount() { + return this.shardMinDocCount; + } + + /** + * API name: {@code shard_size} + */ + @Nullable + public final Integer shardSize() { + return this.shardSize; + } + + /** + * API name: {@code show_term_doc_count_error} + */ + @Nullable + public final Boolean showTermDocCountError() { + return this.showTermDocCountError; + } + + /** + * API name: {@code size} + */ + @Nullable + public final Integer size() { + return this.size; + } + /** * Required - API name: {@code terms} */ @@ -79,6 +166,48 @@ public final List terms() { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { super.serializeInternal(generator, mapper); + if (this.collectMode != null) { + generator.writeKey("collect_mode"); + this.collectMode.serialize(generator, mapper); + } + if (ApiTypeHelper.isDefined(this.order)) { + generator.writeKey("order"); + generator.writeStartArray(); + for (NamedValue item0 : this.order) { + generator.writeStartObject(); + generator.writeKey(item0.name()); + item0.value().serialize(generator, mapper); + generator.writeEnd(); + + } + generator.writeEnd(); + + } + if (this.minDocCount != null) { + generator.writeKey("min_doc_count"); + generator.write(this.minDocCount); + + } + if (this.shardMinDocCount != null) { + generator.writeKey("shard_min_doc_count"); + generator.write(this.shardMinDocCount); + + } + if (this.shardSize != null) { + generator.writeKey("shard_size"); + generator.write(this.shardSize); + + } + if (this.showTermDocCountError != null) { + generator.writeKey("show_term_doc_count_error"); + generator.write(this.showTermDocCountError); + + } + if (this.size != null) { + generator.writeKey("size"); + generator.write(this.size); + + } if (ApiTypeHelper.isDefined(this.terms)) { generator.writeKey("terms"); generator.writeStartArray(); @@ -101,8 +230,97 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends BucketAggregationBase.AbstractBuilder implements ObjectBuilder { + @Nullable + private TermsAggregationCollectMode collectMode; + + @Nullable + private List> order; + + @Nullable + private Long minDocCount; + + @Nullable + private Long shardMinDocCount; + + @Nullable + private Integer shardSize; + + @Nullable + private Boolean showTermDocCountError; + + @Nullable + private Integer size; + private List terms; + /** + * API name: {@code collect_mode} + */ + public final Builder collectMode(@Nullable TermsAggregationCollectMode value) { + this.collectMode = value; + return this; + } + + /** + * API name: {@code order} + *

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

+ * Adds one or more values to order. + */ + public final Builder order(NamedValue value, NamedValue... values) { + this.order = _listAdd(this.order, value, values); + return this; + } + + /** + * API name: {@code min_doc_count} + */ + public final Builder minDocCount(@Nullable Long value) { + this.minDocCount = value; + return this; + } + + /** + * API name: {@code shard_min_doc_count} + */ + public final Builder shardMinDocCount(@Nullable Long value) { + this.shardMinDocCount = value; + return this; + } + + /** + * API name: {@code shard_size} + */ + public final Builder shardSize(@Nullable Integer value) { + this.shardSize = value; + return this; + } + + /** + * API name: {@code show_term_doc_count_error} + */ + public final Builder showTermDocCountError(@Nullable Boolean value) { + this.showTermDocCountError = value; + return this; + } + + /** + * API name: {@code size} + */ + public final Builder size(@Nullable Integer value) { + this.size = value; + return this; + } + /** * Required - API name: {@code terms} *

@@ -160,6 +378,14 @@ public MultiTermsAggregation build() { protected static void setupMultiTermsAggregationDeserializer(ObjectDeserializer op) { BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::collectMode, TermsAggregationCollectMode._DESERIALIZER, "collect_mode"); + op.add(Builder::order, + JsonpDeserializer.arrayDeserializer(NamedValue.deserializer(() -> SortOrder._DESERIALIZER)), "order"); + op.add(Builder::minDocCount, JsonpDeserializer.longDeserializer(), "min_doc_count"); + op.add(Builder::shardMinDocCount, JsonpDeserializer.longDeserializer(), "shard_min_doc_count"); + op.add(Builder::shardSize, JsonpDeserializer.integerDeserializer(), "shard_size"); + op.add(Builder::showTermDocCountError, JsonpDeserializer.booleanDeserializer(), "show_term_doc_count_error"); + op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); op.add(Builder::terms, JsonpDeserializer.arrayDeserializer(MultiTermLookup._DESERIALIZER), "terms"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TermsAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TermsAggregation.java index b33e039ea..c40d6b851 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TermsAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TermsAggregation.java @@ -34,13 +34,13 @@ import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.NamedValue; import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.lang.Integer; import java.lang.String; import java.util.List; -import java.util.Map; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -85,7 +85,7 @@ public class TermsAggregation extends BucketAggregationBase implements Aggregati @Nullable private final String valueType; - private final List> order; + private final List> order; @Nullable private final Script script; @@ -229,7 +229,7 @@ public final String valueType() { /** * API name: {@code order} */ - public final List> order() { + public final List> order() { return this.order; } @@ -326,14 +326,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.order)) { generator.writeKey("order"); generator.writeStartArray(); - for (Map item0 : this.order) { + for (NamedValue item0 : this.order) { generator.writeStartObject(); - if (item0 != null) { - for (Map.Entry item1 : item0.entrySet()) { - generator.writeKey(item1.getKey()); - item1.getValue().serialize(generator, mapper); - } - } + generator.writeKey(item0.name()); + item0.value().serialize(generator, mapper); generator.writeEnd(); } @@ -408,7 +404,7 @@ public static class Builder extends BucketAggregationBase.AbstractBuilder> order; + private List> order; @Nullable private Script script; @@ -563,7 +559,7 @@ public final Builder valueType(@Nullable String value) { *

* Adds all elements of list to order. */ - public final Builder order(List> list) { + public final Builder order(List> list) { this.order = _listAddAll(this.order, list); return this; } @@ -573,7 +569,7 @@ public final Builder order(List> list) { *

* Adds one or more values to order. */ - public final Builder order(Map value, Map... values) { + public final Builder order(NamedValue value, NamedValue... values) { this.order = _listAdd(this.order, value, values); return this; } @@ -664,8 +660,7 @@ protected static void setupTermsAggregationDeserializer(ObjectDeserializer SortOrder._DESERIALIZER)), "order"); op.add(Builder::script, Script._DESERIALIZER, "script"); op.add(Builder::shardSize, JsonpDeserializer.integerDeserializer(), "shard_size"); op.add(Builder::showTermDocCountError, JsonpDeserializer.booleanDeserializer(), "show_term_doc_count_error"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/FieldMapping.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/FieldMapping.java index 88f80aeeb..5c699b03d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/FieldMapping.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/FieldMapping.java @@ -49,9 +49,6 @@ */ @JsonpDeserializable public class FieldMapping implements JsonpSerializable { - // Single key dictionary - private final String field; - private final String fullName; private final Map mapping; @@ -60,8 +57,6 @@ public class FieldMapping implements JsonpSerializable { private FieldMapping(Builder builder) { - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.fullName = ApiTypeHelper.requireNonNull(builder.fullName, this, "fullName"); this.mapping = ApiTypeHelper.unmodifiableRequired(builder.mapping, this, "mapping"); @@ -71,13 +66,6 @@ public static FieldMapping of(Function> fn) return fn.apply(new Builder()).build(); } - /** - * Required - The target field - */ - public final String field() { - return this.field; - } - /** * Required - API name: {@code full_name} */ @@ -102,7 +90,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(this.field); generator.writeKey("full_name"); generator.write(this.fullName); @@ -119,8 +106,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } - generator.writeEnd(); - } @Override @@ -135,16 +120,6 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String field; - - /** - * Required - The target field - */ - public final Builder field(String value) { - this.field = value; - return this; - } - private String fullName; private Map mapping; @@ -217,8 +192,6 @@ protected static void setupFieldMappingDeserializer(ObjectDeserializer 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/da53b6e6dc15c9a721c96aee24c4d25c0747fd6a/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/8338d2cd458f9bdc08fdc840f86e314b4d755d11/specification/" + (paths[hash] || ""); - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_field_mapping/TypeFieldMappings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_field_mapping/TypeFieldMappings.java index daa565905..95dadf988 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_field_mapping/TypeFieldMappings.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_field_mapping/TypeFieldMappings.java @@ -35,6 +35,8 @@ import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Map; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -49,13 +51,13 @@ */ @JsonpDeserializable public class TypeFieldMappings implements JsonpSerializable { - private final FieldMapping mappings; + private final Map mappings; // --------------------------------------------------------------------------------------------- private TypeFieldMappings(Builder builder) { - this.mappings = ApiTypeHelper.requireNonNull(builder.mappings, this, "mappings"); + this.mappings = ApiTypeHelper.unmodifiableRequired(builder.mappings, this, "mappings"); } @@ -66,7 +68,7 @@ public static TypeFieldMappings of(Function mappings() { return this.mappings; } @@ -81,8 +83,17 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("mappings"); - this.mappings.serialize(generator, mapper); + if (ApiTypeHelper.isDefined(this.mappings)) { + generator.writeKey("mappings"); + generator.writeStartObject(); + for (Map.Entry item0 : this.mappings.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } } @@ -98,21 +109,35 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private FieldMapping mappings; + private Map mappings; + + /** + * Required - API name: {@code mappings} + *

+ * Adds all entries of map to mappings. + */ + public final Builder mappings(Map map) { + this.mappings = _mapPutAll(this.mappings, map); + return this; + } /** * Required - API name: {@code mappings} + *

+ * Adds an entry to mappings. */ - public final Builder mappings(FieldMapping value) { - this.mappings = value; + public final Builder mappings(String key, FieldMapping value) { + this.mappings = _mapPut(this.mappings, key, value); return this; } /** * Required - API name: {@code mappings} + *

+ * Adds an entry to mappings using a builder lambda. */ - public final Builder mappings(Function> fn) { - return this.mappings(fn.apply(new FieldMapping.Builder()).build()); + public final Builder mappings(String key, Function> fn) { + return mappings(key, fn.apply(new FieldMapping.Builder()).build()); } @Override @@ -143,7 +168,7 @@ public TypeFieldMappings build() { protected static void setupTypeFieldMappingsDeserializer(ObjectDeserializer op) { - op.add(Builder::mappings, FieldMapping._DESERIALIZER, "mappings"); + op.add(Builder::mappings, JsonpDeserializer.stringMapDeserializer(FieldMapping._DESERIALIZER), "mappings"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/PutPipelineRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/PutPipelineRequest.java index a9b329410..aab8938ac 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/PutPipelineRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/PutPipelineRequest.java @@ -65,6 +65,9 @@ public class PutPipelineRequest extends RequestBase implements JsonpSerializable private final String id; + @Nullable + private final Long ifVersion; + @Nullable private final Time masterTimeout; @@ -85,6 +88,7 @@ private PutPipelineRequest(Builder builder) { this.meta = ApiTypeHelper.unmodifiable(builder.meta); this.description = builder.description; this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); + this.ifVersion = builder.ifVersion; this.masterTimeout = builder.masterTimeout; this.onFailure = ApiTypeHelper.unmodifiable(builder.onFailure); this.processors = ApiTypeHelper.unmodifiable(builder.processors); @@ -126,6 +130,16 @@ public final String id() { return this.id; } + /** + * Required version for optimistic concurrency control for pipeline updates + *

+ * API name: {@code if_version} + */ + @Nullable + public final Long ifVersion() { + return this.ifVersion; + } + /** * Period to wait for a connection to the master node. If no response is * received before the timeout expires, the request fails and returns an error. @@ -256,6 +270,9 @@ public static class Builder extends WithJsonObjectBuilderBase private String id; + @Nullable + private Long ifVersion; + @Nullable private Time masterTimeout; @@ -317,6 +334,16 @@ public final Builder id(String value) { return this; } + /** + * Required version for optimistic concurrency control for pipeline updates + *

+ * API name: {@code if_version} + */ + public final Builder ifVersion(@Nullable Long value) { + this.ifVersion = value; + return this; + } + /** * Period to wait for a connection to the master node. If no response is * received before the timeout expires, the request fails and returns an error. @@ -538,6 +565,9 @@ protected static void setupPutPipelineRequestDeserializer(ObjectDeserializer getMemoryStats() { GetMemoryStatsRequest._ENDPOINT, this.transportOptions); } + // ----- Endpoint: ml.get_model_snapshot_upgrade_stats + + /** + * Gets stats for anomaly detection job model snapshot upgrades that are in + * progress. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture getModelSnapshotUpgradeStats( + GetModelSnapshotUpgradeStatsRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetModelSnapshotUpgradeStatsRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Gets stats for anomaly detection job model snapshot upgrades that are in + * progress. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetModelSnapshotUpgradeStatsRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture getModelSnapshotUpgradeStats( + Function> fn) { + return getModelSnapshotUpgradeStats(fn.apply(new GetModelSnapshotUpgradeStatsRequest.Builder()).build()); + } + // ----- Endpoint: ml.get_model_snapshots /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlClient.java index b3c424588..ba2b638d7 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlClient.java @@ -1284,6 +1284,43 @@ public GetMemoryStatsResponse getMemoryStats() throws IOException, Elasticsearch GetMemoryStatsRequest._ENDPOINT, this.transportOptions); } + // ----- Endpoint: ml.get_model_snapshot_upgrade_stats + + /** + * Gets stats for anomaly detection job model snapshot upgrades that are in + * progress. + * + * @see Documentation + * on elastic.co + */ + + public GetModelSnapshotUpgradeStatsResponse getModelSnapshotUpgradeStats( + GetModelSnapshotUpgradeStatsRequest request) throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetModelSnapshotUpgradeStatsRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Gets stats for anomaly detection job model snapshot upgrades that are in + * progress. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetModelSnapshotUpgradeStatsRequest} + * @see Documentation + * on elastic.co + */ + + public final GetModelSnapshotUpgradeStatsResponse getModelSnapshotUpgradeStats( + Function> fn) + throws IOException, ElasticsearchException { + return getModelSnapshotUpgradeStats(fn.apply(new GetModelSnapshotUpgradeStatsRequest.Builder()).build()); + } + // ----- Endpoint: ml.get_model_snapshots /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetModelSnapshotUpgradeStatsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetModelSnapshotUpgradeStatsRequest.java new file mode 100644 index 000000000..08d541e18 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetModelSnapshotUpgradeStatsRequest.java @@ -0,0 +1,249 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.ml; + +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.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.String; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: ml.get_model_snapshot_upgrade_stats.Request + +/** + * Retrieves usage information for anomaly detection job model snapshot + * upgrades. + * + * @see API + * specification + */ + +public class GetModelSnapshotUpgradeStatsRequest extends RequestBase { + @Nullable + private final Boolean allowNoMatch; + + private final String jobId; + + @Nullable + private final String snapshotId; + + // --------------------------------------------------------------------------------------------- + + private GetModelSnapshotUpgradeStatsRequest(Builder builder) { + + this.allowNoMatch = builder.allowNoMatch; + this.jobId = ApiTypeHelper.requireNonNull(builder.jobId, this, "jobId"); + this.snapshotId = builder.snapshotId; + + } + + public static GetModelSnapshotUpgradeStatsRequest of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Specifies what to do when the request: + *

    + *
  • Contains wildcard expressions and there are no jobs that match.
  • + *
  • Contains the _all string or no identifiers and there are no matches.
  • + *
  • Contains wildcard expressions and there are only partial matches.
  • + *
+ *

+ * The default value is true, which returns an empty jobs array when there are + * no matches and the subset of results when there are partial matches. If this + * parameter is false, the request returns a 404 status code when there are no + * matches or only partial matches. + *

+ * API name: {@code allow_no_match} + */ + @Nullable + public final Boolean allowNoMatch() { + return this.allowNoMatch; + } + + /** + * Required - Identifier for the anomaly detection job. + *

+ * API name: {@code job_id} + */ + public final String jobId() { + return this.jobId; + } + + /** + * A numerical character string that uniquely identifies the model snapshot. You + * can get information for multiple snapshots by using a comma-separated list or + * a wildcard expression. You can get all snapshots by using _all, + * by specifying * as the snapshot ID, or by omitting the snapshot + * ID. + *

+ * API name: {@code snapshot_id} + */ + @Nullable + public final String snapshotId() { + return this.snapshotId; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetModelSnapshotUpgradeStatsRequest}. + */ + + public static class Builder extends ObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private Boolean allowNoMatch; + + private String jobId; + + @Nullable + private String snapshotId; + + /** + * Specifies what to do when the request: + *

    + *
  • Contains wildcard expressions and there are no jobs that match.
  • + *
  • Contains the _all string or no identifiers and there are no matches.
  • + *
  • Contains wildcard expressions and there are only partial matches.
  • + *
+ *

+ * The default value is true, which returns an empty jobs array when there are + * no matches and the subset of results when there are partial matches. If this + * parameter is false, the request returns a 404 status code when there are no + * matches or only partial matches. + *

+ * API name: {@code allow_no_match} + */ + public final Builder allowNoMatch(@Nullable Boolean value) { + this.allowNoMatch = value; + return this; + } + + /** + * Required - Identifier for the anomaly detection job. + *

+ * API name: {@code job_id} + */ + public final Builder jobId(String value) { + this.jobId = value; + return this; + } + + /** + * A numerical character string that uniquely identifies the model snapshot. You + * can get information for multiple snapshots by using a comma-separated list or + * a wildcard expression. You can get all snapshots by using _all, + * by specifying * as the snapshot ID, or by omitting the snapshot + * ID. + *

+ * API name: {@code snapshot_id} + */ + public final Builder snapshotId(@Nullable String value) { + this.snapshotId = value; + return this; + } + + /** + * Builds a {@link GetModelSnapshotUpgradeStatsRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetModelSnapshotUpgradeStatsRequest build() { + _checkSingleUse(); + + return new GetModelSnapshotUpgradeStatsRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.get_model_snapshot_upgrade_stats}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/ml.get_model_snapshot_upgrade_stats", + + // Request method + request -> { + return "GET"; + + }, + + // Request path + request -> { + final int _snapshotId = 1 << 0; + final int _jobId = 1 << 1; + + int propsSet = 0; + + if (request.snapshotId() != null) + propsSet |= _snapshotId; + propsSet |= _jobId; + + if (propsSet == (_jobId | _snapshotId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_ml"); + buf.append("/anomaly_detectors"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.jobId, buf); + buf.append("/model_snapshots"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.snapshotId, buf); + buf.append("/_upgrade"); + buf.append("/_stats"); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.allowNoMatch != null) { + params.put("allow_no_match", String.valueOf(request.allowNoMatch)); + } + return params; + + }, SimpleEndpoint.emptyMap(), false, GetModelSnapshotUpgradeStatsResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetModelSnapshotUpgradeStatsResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetModelSnapshotUpgradeStatsResponse.java new file mode 100644 index 000000000..8e624d6bc --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetModelSnapshotUpgradeStatsResponse.java @@ -0,0 +1,205 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.ml; + +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.Long; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: ml.get_model_snapshot_upgrade_stats.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class GetModelSnapshotUpgradeStatsResponse implements JsonpSerializable { + private final long count; + + private final List modelSnapshotUpgrades; + + // --------------------------------------------------------------------------------------------- + + private GetModelSnapshotUpgradeStatsResponse(Builder builder) { + + this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); + this.modelSnapshotUpgrades = ApiTypeHelper.unmodifiableRequired(builder.modelSnapshotUpgrades, this, + "modelSnapshotUpgrades"); + + } + + public static GetModelSnapshotUpgradeStatsResponse of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code count} + */ + public final long count() { + return this.count; + } + + /** + * Required - API name: {@code model_snapshot_upgrades} + */ + public final List modelSnapshotUpgrades() { + return this.modelSnapshotUpgrades; + } + + /** + * 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("count"); + generator.write(this.count); + + if (ApiTypeHelper.isDefined(this.modelSnapshotUpgrades)) { + generator.writeKey("model_snapshot_upgrades"); + generator.writeStartArray(); + for (ModelSnapshotUpgrade item0 : this.modelSnapshotUpgrades) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetModelSnapshotUpgradeStatsResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private Long count; + + private List modelSnapshotUpgrades; + + /** + * Required - API name: {@code count} + */ + public final Builder count(long value) { + this.count = value; + return this; + } + + /** + * Required - API name: {@code model_snapshot_upgrades} + *

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

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

+ * Adds a value to modelSnapshotUpgrades using a builder lambda. + */ + public final Builder modelSnapshotUpgrades( + Function> fn) { + return modelSnapshotUpgrades(fn.apply(new ModelSnapshotUpgrade.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link GetModelSnapshotUpgradeStatsResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetModelSnapshotUpgradeStatsResponse build() { + _checkSingleUse(); + + return new GetModelSnapshotUpgradeStatsResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetModelSnapshotUpgradeStatsResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, + GetModelSnapshotUpgradeStatsResponse::setupGetModelSnapshotUpgradeStatsResponseDeserializer); + + protected static void setupGetModelSnapshotUpgradeStatsResponseDeserializer( + ObjectDeserializer op) { + + op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); + op.add(Builder::modelSnapshotUpgrades, JsonpDeserializer.arrayDeserializer(ModelSnapshotUpgrade._DESERIALIZER), + "model_snapshot_upgrades"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ModelSnapshotUpgrade.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ModelSnapshotUpgrade.java new file mode 100644 index 000000000..9512751a8 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ModelSnapshotUpgrade.java @@ -0,0 +1,247 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.ml; + +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; + +// typedef: ml._types.ModelSnapshotUpgrade + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ModelSnapshotUpgrade implements JsonpSerializable { + private final String jobId; + + private final String snapshotId; + + private final SnapshotUpgradeState state; + + private final DiscoveryNode node; + + private final String assignmentExplanation; + + // --------------------------------------------------------------------------------------------- + + private ModelSnapshotUpgrade(Builder builder) { + + this.jobId = ApiTypeHelper.requireNonNull(builder.jobId, this, "jobId"); + this.snapshotId = ApiTypeHelper.requireNonNull(builder.snapshotId, this, "snapshotId"); + this.state = ApiTypeHelper.requireNonNull(builder.state, this, "state"); + this.node = ApiTypeHelper.requireNonNull(builder.node, this, "node"); + this.assignmentExplanation = ApiTypeHelper.requireNonNull(builder.assignmentExplanation, this, + "assignmentExplanation"); + + } + + public static ModelSnapshotUpgrade of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code job_id} + */ + public final String jobId() { + return this.jobId; + } + + /** + * Required - API name: {@code snapshot_id} + */ + public final String snapshotId() { + return this.snapshotId; + } + + /** + * Required - API name: {@code state} + */ + public final SnapshotUpgradeState state() { + return this.state; + } + + /** + * Required - API name: {@code node} + */ + public final DiscoveryNode node() { + return this.node; + } + + /** + * Required - API name: {@code assignment_explanation} + */ + public final String assignmentExplanation() { + return this.assignmentExplanation; + } + + /** + * 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("job_id"); + generator.write(this.jobId); + + generator.writeKey("snapshot_id"); + generator.write(this.snapshotId); + + generator.writeKey("state"); + this.state.serialize(generator, mapper); + generator.writeKey("node"); + this.node.serialize(generator, mapper); + + generator.writeKey("assignment_explanation"); + generator.write(this.assignmentExplanation); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ModelSnapshotUpgrade}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private String jobId; + + private String snapshotId; + + private SnapshotUpgradeState state; + + private DiscoveryNode node; + + private String assignmentExplanation; + + /** + * Required - API name: {@code job_id} + */ + public final Builder jobId(String value) { + this.jobId = value; + return this; + } + + /** + * Required - API name: {@code snapshot_id} + */ + public final Builder snapshotId(String value) { + this.snapshotId = value; + return this; + } + + /** + * Required - API name: {@code state} + */ + public final Builder state(SnapshotUpgradeState value) { + this.state = value; + return this; + } + + /** + * Required - API name: {@code node} + */ + public final Builder node(DiscoveryNode value) { + this.node = value; + return this; + } + + /** + * Required - API name: {@code node} + */ + public final Builder node(Function> fn) { + return this.node(fn.apply(new DiscoveryNode.Builder()).build()); + } + + /** + * Required - API name: {@code assignment_explanation} + */ + public final Builder assignmentExplanation(String value) { + this.assignmentExplanation = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ModelSnapshotUpgrade}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ModelSnapshotUpgrade build() { + _checkSingleUse(); + + return new ModelSnapshotUpgrade(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ModelSnapshotUpgrade} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, ModelSnapshotUpgrade::setupModelSnapshotUpgradeDeserializer); + + protected static void setupModelSnapshotUpgradeDeserializer(ObjectDeserializer op) { + + op.add(Builder::jobId, JsonpDeserializer.stringDeserializer(), "job_id"); + op.add(Builder::snapshotId, JsonpDeserializer.stringDeserializer(), "snapshot_id"); + op.add(Builder::state, SnapshotUpgradeState._DESERIALIZER, "state"); + op.add(Builder::node, DiscoveryNode._DESERIALIZER, "node"); + op.add(Builder::assignmentExplanation, JsonpDeserializer.stringDeserializer(), "assignment_explanation"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/SnapshotUpgradeState.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/SnapshotUpgradeState.java new file mode 100644 index 000000000..e6b73fa45 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/SnapshotUpgradeState.java @@ -0,0 +1,59 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.ml; + +import co.elastic.clients.json.JsonEnum; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public enum SnapshotUpgradeState implements JsonEnum { + LoadingOldState("loading_old_state"), + + SavingNewState("saving_new_state"), + + Stopped("stopped"), + + Failed("failed"), + + ; + + private final String jsonValue; + + SnapshotUpgradeState(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + SnapshotUpgradeState.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ClusterPrivilege.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ClusterPrivilege.java index ca6d3d6e3..61313bd61 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ClusterPrivilege.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ClusterPrivilege.java @@ -49,6 +49,8 @@ public enum ClusterPrivilege implements JsonEnum { ManageCcr("manage_ccr"), + ManageEnrich("manage_enrich"), + ManageIlm("manage_ilm"), ManageIndexTemplates("manage_index_templates"), diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/CreateServiceTokenRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/CreateServiceTokenRequest.java index 15e04fab8..62151f37a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/CreateServiceTokenRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/CreateServiceTokenRequest.java @@ -24,6 +24,7 @@ package co.elastic.clients.elasticsearch.security; import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.Refresh; import co.elastic.clients.elasticsearch._types.RequestBase; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; @@ -36,7 +37,8 @@ import co.elastic.clients.util.ObjectBuilderBase; 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; @@ -44,7 +46,7 @@ // typedef: security.create_service_token.Request /** - * Creates a service account token for access without requiring basic + * Creates a service accounts token for access without requiring basic * authentication. * * @see * API name: {@code name} */ + @Nullable public final String name() { return this.name; } @@ -91,6 +99,19 @@ public final String namespace() { return this.namespace; } + /** + * If true then refresh the affected shards to make this operation + * visible to search, if wait_for (the default) then wait for a + * refresh to make this operation visible to search, if false then + * do nothing with refreshes. + *

+ * API name: {@code refresh} + */ + @Nullable + public final Refresh refresh() { + return this.refresh; + } + /** * Required - An identifier for the service name *

@@ -107,18 +128,22 @@ public final String service() { */ public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable private String name; private String namespace; + @Nullable + private Refresh refresh; + private String service; /** - * Required - An identifier for the token name + * An identifier for the token name *

* API name: {@code name} */ - public final Builder name(String value) { + public final Builder name(@Nullable String value) { this.name = value; return this; } @@ -133,6 +158,19 @@ public final Builder namespace(String value) { return this; } + /** + * If true then refresh the affected shards to make this operation + * visible to search, if wait_for (the default) then wait for a + * refresh to make this operation visible to search, if false then + * do nothing with refreshes. + *

+ * API name: {@code refresh} + */ + public final Builder refresh(@Nullable Refresh value) { + this.refresh = value; + return this; + } + /** * Required - An identifier for the service name *

@@ -174,7 +212,8 @@ public CreateServiceTokenRequest build() { propsSet |= _service; propsSet |= _namespace; - propsSet |= _name; + if (request.name() != null) + propsSet |= _name; if (propsSet == (_namespace | _service | _name)) return "PUT"; @@ -194,7 +233,8 @@ public CreateServiceTokenRequest build() { propsSet |= _service; propsSet |= _namespace; - propsSet |= _name; + if (request.name() != null) + propsSet |= _name; if (propsSet == (_namespace | _service | _name)) { StringBuilder buf = new StringBuilder(); @@ -228,7 +268,11 @@ public CreateServiceTokenRequest build() { // Request parameters request -> { - return Collections.emptyMap(); + Map params = new HashMap<>(); + if (request.refresh != null) { + params.put("refresh", request.refresh.jsonValue()); + } + return params; }, SimpleEndpoint.emptyMap(), false, CreateServiceTokenResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GetUserPrivilegesResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GetUserPrivilegesResponse.java index 253ef0498..faa664b77 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GetUserPrivilegesResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GetUserPrivilegesResponse.java @@ -98,7 +98,11 @@ public final List global() { } /** - * Required - API name: {@code indices} + * Required - In this context IndicesPrivileges.query property can + * only be a string, see IndicesPrivileges documentation for + * detail. + *

+ * API name: {@code indices} */ public final List indices() { return this.indices; @@ -279,7 +283,11 @@ public final Builder global(FunctionIndicesPrivileges.query property can + * only be a string, see IndicesPrivileges documentation for + * detail. + *

+ * API name: {@code indices} *

* Adds all elements of list to indices. */ @@ -289,7 +297,11 @@ public final Builder indices(List list) { } /** - * Required - API name: {@code indices} + * Required - In this context IndicesPrivileges.query property can + * only be a string, see IndicesPrivileges documentation for + * detail. + *

+ * API name: {@code indices} *

* Adds one or more values to indices. */ @@ -299,7 +311,11 @@ public final Builder indices(IndicesPrivileges value, IndicesPrivileges... value } /** - * Required - API name: {@code indices} + * Required - In this context IndicesPrivileges.query property can + * only be a string, see IndicesPrivileges documentation for + * detail. + *

+ * API name: {@code indices} *

* Adds a value to indices using a builder lambda. */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UpdateUserProfileDataRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UpdateUserProfileDataRequest.java index 7ec80f87f..7c7c822f2 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UpdateUserProfileDataRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UpdateUserProfileDataRequest.java @@ -59,8 +59,6 @@ */ @JsonpDeserializable public class UpdateUserProfileDataRequest extends RequestBase implements JsonpSerializable { - private final Map access; - private final Map data; @Nullable @@ -69,6 +67,8 @@ public class UpdateUserProfileDataRequest extends RequestBase implements JsonpSe @Nullable private final Long ifSeqNo; + private final Map labels; + @Nullable private final Refresh refresh; @@ -78,10 +78,10 @@ public class UpdateUserProfileDataRequest extends RequestBase implements JsonpSe private UpdateUserProfileDataRequest(Builder builder) { - this.access = ApiTypeHelper.unmodifiable(builder.access); this.data = ApiTypeHelper.unmodifiable(builder.data); this.ifPrimaryTerm = builder.ifPrimaryTerm; this.ifSeqNo = builder.ifSeqNo; + this.labels = ApiTypeHelper.unmodifiable(builder.labels); this.refresh = builder.refresh; this.uid = ApiTypeHelper.requireNonNull(builder.uid, this, "uid"); @@ -91,16 +91,6 @@ public static UpdateUserProfileDataRequest of(Function - * API name: {@code access} - */ - public final Map access() { - return this.access; - } - /** * Non-searchable data that you want to associate with the user profile. This * field supports a nested data structure. @@ -131,6 +121,16 @@ public final Long ifSeqNo() { return this.ifSeqNo; } + /** + * Searchable data that you want to associate with the user profile. This field + * supports a nested data structure. + *

+ * API name: {@code labels} + */ + public final Map labels() { + return this.labels; + } + /** * If 'true', Elasticsearch refreshes the affected shards to make this operation * visible to search, if 'wait_for' then wait for a refresh to make this @@ -163,10 +163,10 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.access)) { - generator.writeKey("access"); + if (ApiTypeHelper.isDefined(this.data)) { + generator.writeKey("data"); generator.writeStartObject(); - for (Map.Entry item0 : this.access.entrySet()) { + for (Map.Entry item0 : this.data.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); @@ -174,10 +174,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - if (ApiTypeHelper.isDefined(this.data)) { - generator.writeKey("data"); + if (ApiTypeHelper.isDefined(this.labels)) { + generator.writeKey("labels"); generator.writeStartObject(); - for (Map.Entry item0 : this.data.entrySet()) { + for (Map.Entry item0 : this.labels.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); @@ -197,9 +197,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable - private Map access; - @Nullable private Map data; @@ -209,37 +206,14 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private Long ifSeqNo; + @Nullable + private Map labels; + @Nullable private Refresh refresh; private String uid; - /** - * Searchable data that you want to associate with the user profile. This field - * supports a nested data structure. - *

- * API name: {@code access} - *

- * Adds all entries of map to access. - */ - public final Builder access(Map map) { - this.access = _mapPutAll(this.access, map); - return this; - } - - /** - * Searchable data that you want to associate with the user profile. This field - * supports a nested data structure. - *

- * API name: {@code access} - *

- * Adds an entry to access. - */ - public final Builder access(String key, JsonData value) { - this.access = _mapPut(this.access, key, value); - return this; - } - /** * Non-searchable data that you want to associate with the user profile. This * field supports a nested data structure. @@ -286,6 +260,32 @@ public final Builder ifSeqNo(@Nullable Long value) { return this; } + /** + * Searchable data that you want to associate with the user profile. This field + * supports a nested data structure. + *

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

+ * Adds all entries of map to labels. + */ + public final Builder labels(Map map) { + this.labels = _mapPutAll(this.labels, map); + return this; + } + + /** + * Searchable data that you want to associate with the user profile. This field + * supports a nested data structure. + *

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

+ * Adds an entry to labels. + */ + public final Builder labels(String key, JsonData value) { + this.labels = _mapPut(this.labels, key, value); + return this; + } + /** * If 'true', Elasticsearch refreshes the affected shards to make this operation * visible to search, if 'wait_for' then wait for a refresh to make this @@ -337,8 +337,8 @@ public UpdateUserProfileDataRequest build() { protected static void setupUpdateUserProfileDataRequestDeserializer( ObjectDeserializer op) { - op.add(Builder::access, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "access"); op.add(Builder::data, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "data"); + op.add(Builder::labels, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "labels"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UserProfile.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UserProfile.java index fd6a981ac..b7ae944a5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UserProfile.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UserProfile.java @@ -68,8 +68,8 @@ protected UserProfile(AbstractBuilder builder) { this.uid = ApiTypeHelper.requireNonNull(builder.uid, this, "uid"); this.user = ApiTypeHelper.requireNonNull(builder.user, this, "user"); - this.data = ApiTypeHelper.unmodifiable(builder.data); - this.labels = ApiTypeHelper.unmodifiable(builder.labels); + this.data = ApiTypeHelper.unmodifiableRequired(builder.data, this, "data"); + this.labels = ApiTypeHelper.unmodifiableRequired(builder.labels, this, "labels"); this.enabled = builder.enabled; } @@ -93,14 +93,14 @@ public final UserProfileUser user() { } /** - * API name: {@code data} + * Required - API name: {@code data} */ public final Map data() { return this.data; } /** - * API name: {@code labels} + * Required - API name: {@code labels} */ public final Map labels() { return this.labels; @@ -198,10 +198,8 @@ protected abstract static class AbstractBuilder data; - @Nullable private Map labels; @Nullable @@ -231,7 +229,7 @@ public final BuilderT user(Function * Adds all entries of map to data. */ @@ -241,7 +239,7 @@ public final BuilderT data(Map map) { } /** - * API name: {@code data} + * Required - API name: {@code data} *

* Adds an entry to data. */ @@ -251,7 +249,7 @@ public final BuilderT data(String key, JsonData value) { } /** - * API name: {@code labels} + * Required - API name: {@code labels} *

* Adds all entries of map to labels. */ @@ -261,7 +259,7 @@ public final BuilderT labels(Map map) { } /** - * API name: {@code labels} + * Required - API name: {@code labels} *

* Adds an entry to labels. */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UserProfileUser.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UserProfileUser.java index 9fbbacb80..2c617383e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UserProfileUser.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/UserProfileUser.java @@ -23,7 +23,6 @@ package co.elastic.clients.elasticsearch.security; -import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -37,7 +36,6 @@ import jakarta.json.stream.JsonGenerator; import java.lang.String; import java.util.List; -import java.util.Map; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -57,7 +55,10 @@ public class UserProfileUser implements JsonpSerializable { @Nullable private final String fullName; - private final Map metadata; + private final String realmName; + + @Nullable + private final String realmDomain; private final List roles; @@ -69,7 +70,8 @@ private UserProfileUser(Builder builder) { this.email = builder.email; this.fullName = builder.fullName; - this.metadata = ApiTypeHelper.unmodifiableRequired(builder.metadata, this, "metadata"); + this.realmName = ApiTypeHelper.requireNonNull(builder.realmName, this, "realmName"); + this.realmDomain = builder.realmDomain; this.roles = ApiTypeHelper.unmodifiableRequired(builder.roles, this, "roles"); this.username = ApiTypeHelper.requireNonNull(builder.username, this, "username"); @@ -96,10 +98,18 @@ public final String fullName() { } /** - * Required - API name: {@code metadata} + * Required - API name: {@code realm_name} */ - public final Map metadata() { - return this.metadata; + public final String realmName() { + return this.realmName; + } + + /** + * API name: {@code realm_domain} + */ + @Nullable + public final String realmDomain() { + return this.realmDomain; } /** @@ -137,15 +147,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.fullName); } - if (ApiTypeHelper.isDefined(this.metadata)) { - generator.writeKey("metadata"); - generator.writeStartObject(); - for (Map.Entry item0 : this.metadata.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); + generator.writeKey("realm_name"); + generator.write(this.realmName); - } - generator.writeEnd(); + if (this.realmDomain != null) { + generator.writeKey("realm_domain"); + generator.write(this.realmDomain); } if (ApiTypeHelper.isDefined(this.roles)) { @@ -181,7 +188,10 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private String fullName; - private Map metadata; + private String realmName; + + @Nullable + private String realmDomain; private List roles; @@ -204,22 +214,18 @@ public final Builder fullName(@Nullable String value) { } /** - * Required - API name: {@code metadata} - *

- * Adds all entries of map to metadata. + * Required - API name: {@code realm_name} */ - public final Builder metadata(Map map) { - this.metadata = _mapPutAll(this.metadata, map); + public final Builder realmName(String value) { + this.realmName = value; return this; } /** - * Required - API name: {@code metadata} - *

- * Adds an entry to metadata. + * API name: {@code realm_domain} */ - public final Builder metadata(String key, JsonData value) { - this.metadata = _mapPut(this.metadata, key, value); + public final Builder realmDomain(@Nullable String value) { + this.realmDomain = value; return this; } @@ -281,7 +287,8 @@ protected static void setupUserProfileUserDeserializer(ObjectDeserializer builder) { super(builder); this.lastSynchronized = ApiTypeHelper.requireNonNull(builder.lastSynchronized, this, "lastSynchronized"); - this.doc = builder.doc; + this.doc = ApiTypeHelper.requireNonNull(builder.doc, this, "doc"); } @@ -75,9 +74,8 @@ public final long lastSynchronized() { } /** - * API name: {@code _doc} + * Required - API name: {@code _doc} */ - @Nullable public final UserProfileHitMetadata doc() { return this.doc; } @@ -88,11 +86,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("last_synchronized"); generator.write(this.lastSynchronized); - if (this.doc != null) { - generator.writeKey("_doc"); - this.doc.serialize(generator, mapper); - - } + generator.writeKey("_doc"); + this.doc.serialize(generator, mapper); } @@ -128,7 +123,6 @@ protected abstract static class AbstractBuilder { private Long lastSynchronized; - @Nullable private UserProfileHitMetadata doc; /** @@ -140,15 +134,15 @@ public final BuilderT lastSynchronized(long value) { } /** - * API name: {@code _doc} + * Required - API name: {@code _doc} */ - public final BuilderT doc(@Nullable UserProfileHitMetadata value) { + public final BuilderT doc(UserProfileHitMetadata value) { this.doc = value; return self(); } /** - * API name: {@code _doc} + * Required - API name: {@code _doc} */ public final BuilderT doc(Function> fn) { return this.doc(fn.apply(new UserProfileHitMetadata.Builder()).build()); diff --git a/java-client/src/main/java/co/elastic/clients/util/NamedValue.java b/java-client/src/main/java/co/elastic/clients/util/NamedValue.java new file mode 100644 index 000000000..654ff8d02 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/util/NamedValue.java @@ -0,0 +1,73 @@ +/* + * 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.util; + +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpDeserializerBase; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpMappingException; +import co.elastic.clients.json.JsonpUtils; +import jakarta.json.stream.JsonParser; + +import java.util.EnumSet; +import java.util.function.Supplier; + +public class NamedValue { + + private final String name; + private final T value; + + public NamedValue(String name, T value) { + this.name = name; + this.value = value; + } + + public String name() { + return this.name; + } + + public T value() { + return this.value; + } + + public static NamedValue of(String name, T value) { + return new NamedValue<>(name, value); + } + + public static JsonpDeserializer> deserializer(Supplier> valueParserBuilder) { + return new JsonpDeserializerBase>(EnumSet.of(JsonParser.Event.START_OBJECT)) { + @Override + public NamedValue deserialize(JsonParser parser, JsonpMapper mapper, JsonParser.Event event) { + + JsonpUtils.expectNextEvent(parser, JsonParser.Event.KEY_NAME); + String name = parser.getString(); + + try { + T value = valueParserBuilder.get().deserialize(parser, mapper); + JsonpUtils.expectNextEvent(parser, JsonParser.Event.END_OBJECT); + + return new NamedValue<>(name, value); + } catch (Exception e) { + throw JsonpMappingException.from(e, null, name, parser); + } + } + }; + } +} diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/ElasticsearchTestServer.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/ElasticsearchTestServer.java index 635164522..4edf3de9a 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/ElasticsearchTestServer.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/ElasticsearchTestServer.java @@ -19,9 +19,14 @@ package co.elastic.clients.elasticsearch; +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.json.JsonData; +import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; import co.elastic.clients.json.jsonb.JsonbJsonpMapper; import co.elastic.clients.transport.ElasticsearchTransport; +import co.elastic.clients.transport.JsonEndpoint; +import co.elastic.clients.transport.endpoints.DelegatingJsonEndpoint; import co.elastic.clients.transport.rest_client.RestClientTransport; import org.apache.http.HttpHost; import org.apache.http.auth.AuthScope; @@ -30,6 +35,7 @@ import org.elasticsearch.client.RestClient; import org.testcontainers.elasticsearch.ElasticsearchContainer; +import java.io.IOException; import java.time.Duration; public class ElasticsearchTestServer implements AutoCloseable { @@ -76,6 +82,33 @@ AuthScope.ANY, new UsernamePasswordCredentials("elastic", "changeme") client = new ElasticsearchClient(transport); } + /** + * Send a request to a server and return the response as JSON. Useful to debug response format issues. + */ + public static JsonData getJsonResponse(ElasticsearchClient client, Req request) throws IOException { + + JsonEndpoint endpoint; + + try { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint0 = (JsonEndpoint) request.getClass() + .getDeclaredField("_ENDPOINT").get(null); + endpoint = endpoint0; + } catch (IllegalAccessException|NoSuchFieldException e) { + throw new RuntimeException(e); + } + + DelegatingJsonEndpoint jsonEndpoint = + new DelegatingJsonEndpoint(endpoint) { + @Override + public JsonpDeserializer responseDeserializer() { + return JsonData._DESERIALIZER; + } + }; + + return client._transport().performRequest(request, jsonEndpoint, client._transportOptions()); + } + @Override public void close() { if (this == global) { diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/BehaviorsTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/BehaviorsTest.java index a23d387bc..692302077 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/BehaviorsTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/BehaviorsTest.java @@ -35,6 +35,9 @@ public class BehaviorsTest extends ModelTestCase { + /** + * Test for SingleKeyDictionary transformed to a behavior. For regular fields, see NamedValue tests in {@link ClassStructureTest} + */ @Test public void testSingleKeyDictionary() { TermQuery q = new TermQuery.Builder() diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/ClassStructureTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/ClassStructureTest.java index 68e8f899c..861af5bd4 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/ClassStructureTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/ClassStructureTest.java @@ -20,12 +20,15 @@ package co.elastic.clients.elasticsearch.model; import co.elastic.clients.elasticsearch._types.ErrorCause; +import co.elastic.clients.elasticsearch._types.SortOrder; import co.elastic.clients.elasticsearch._types.aggregations.Aggregate; import co.elastic.clients.elasticsearch._types.aggregations.Aggregation; import co.elastic.clients.elasticsearch._types.aggregations.Buckets; import co.elastic.clients.elasticsearch._types.aggregations.CardinalityAggregate; import co.elastic.clients.elasticsearch._types.aggregations.DateRangeAggregate; +import co.elastic.clients.elasticsearch._types.aggregations.HistogramAggregation; import co.elastic.clients.elasticsearch._types.aggregations.RangeBucket; +import co.elastic.clients.elasticsearch._types.aggregations.TermsAggregation; import co.elastic.clients.elasticsearch._types.aggregations.ValueCountAggregation; import co.elastic.clients.elasticsearch._types.query_dsl.FieldAndFormat; import co.elastic.clients.elasticsearch._types.query_dsl.IntervalsQuery; @@ -37,6 +40,7 @@ import co.elastic.clients.json.JsonData; import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.MissingRequiredPropertyException; +import co.elastic.clients.util.NamedValue; import co.elastic.clients.util.ObjectBuilder; import org.junit.jupiter.api.Test; @@ -319,6 +323,19 @@ public void testRequiredProperty() { assertEquals("id", ex.getPropertyName()); } + /** + * Tests SingleKeyDictionary fields that are not transformed into a behavior. + */ + @Test + public void testNamedValue() { + TermsAggregation termsAgg = TermsAggregation.of(ta -> ta + .order(NamedValue.of("a", SortOrder.Asc)) + .order(NamedValue.of("b", SortOrder.Desc)) + ); + + checkJsonRoundtrip(termsAgg, "{\"order\":[{\"a\":\"asc\"},{\"b\":\"desc\"}]}"); + } + private void assertAncestorCount(int count, Object obj) { Class clazz = obj.getClass(); while(count-- >= 0) { diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/spec_issues/SpecIssuesTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/spec_issues/SpecIssuesTest.java index 6b9826b35..6e7973fd0 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/spec_issues/SpecIssuesTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/spec_issues/SpecIssuesTest.java @@ -22,18 +22,22 @@ import co.elastic.clients.elasticsearch.ElasticsearchClient; import co.elastic.clients.elasticsearch.ElasticsearchTestServer; import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.analysis.LimitTokenCountTokenFilter; import co.elastic.clients.elasticsearch.cluster.ClusterStatsResponse; import co.elastic.clients.elasticsearch.core.SearchRequest; import co.elastic.clients.elasticsearch.core.SearchResponse; +import co.elastic.clients.elasticsearch.indices.CreateIndexRequest; import co.elastic.clients.elasticsearch.indices.GetFieldMappingRequest; import co.elastic.clients.elasticsearch.indices.GetFieldMappingResponse; import co.elastic.clients.elasticsearch.model.ModelTestCase; +import co.elastic.clients.elasticsearch.snapshot.RestoreResponse; import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializer; import jakarta.json.stream.JsonParser; import org.junit.jupiter.api.Test; import java.io.InputStream; +import java.io.StringReader; /** * Test issues related to the API specifications. @@ -43,14 +47,87 @@ public class SpecIssuesTest extends ModelTestCase { @Test - public void i066_multiFieldMapping() throws Exception { + public void i0201_restoreResponse() throws Exception { + RestoreResponse restoreResponse = fromJson("{\"acknowledged\":true}", RestoreResponse.class); + } + + @Test + public void i0297_mappingSettings() { + + CreateIndexRequest request = CreateIndexRequest.of(r -> r + .index("name") + .settings(s -> s + // This is "mapping" and not "mappings" + .mapping(m -> m.totalFields(totalFields -> totalFields.limit(1001))) + .otherSettings("foo", JsonData.of("bar")) + ) + ); + + assertEquals("{\"settings\":{\"foo\":\"bar\",\"mapping\":{\"total_fields\":{\"limit\":1001}}}}", toJson(request)); + } + + @Test + public void i0295_mappingSettings() { + String json = "{\n" + + " \"mappings\": {\n" + + " \"properties\": {\n" + + " \"myfield\": {\n" + + " \"type\": \"text\"\n" + + " }\n" + + " }\n" + + " },\n" + + " \"settings\": {\n" + + " \"index\": {\n" + + " \"max_result_window\": 1000000,\n" + + " \"mapping\": {\n" + + " \"nested_objects\": {\n" + + " \"limit\": 10000\n" + + " }\n" + + " },\n" + + " \"requests\": {\n" + + " \"cache\": {\n" + + " \"enable\": true\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + "}"; + + CreateIndexRequest request = CreateIndexRequest.of(r -> r + .index("name") + .withJson(new StringReader(json)) + ); + } + + @Test + public void i0199_consumeAllTokensOptional() { + // https://github.com/elastic/elasticsearch-java/issues/199 + // Most filter properties are optional + LimitTokenCountTokenFilter filter = LimitTokenCountTokenFilter.of(b -> b); + } + + @Test + public void i0166_multiFieldMapping() throws Exception { + // https://github.com/elastic/elasticsearch-java/issues/166 ElasticsearchClient client = ElasticsearchTestServer.global().client(); - GetFieldMappingRequest gfmRequest = new GetFieldMappingRequest.Builder() - .index("*") - .fields("*") - .build(); + String indexName = "i0166_multi_field_mapping"; + + client.index(r -> r + .index(indexName) + .withJson(new StringReader("{\"a\":1,\"b\":2}")) + ); + + GetFieldMappingRequest gfmRequest = GetFieldMappingRequest.of (b -> b + .index(indexName) + .fields("a", "b") + ); + GetFieldMappingResponse gfmResponse = client.indices().getFieldMapping(gfmRequest); + + assertEquals(2, gfmResponse.get(indexName).mappings().size()); + assertEquals("a", gfmResponse.get(indexName).mappings().get("a").fullName()); + assertEquals("b", gfmResponse.get(indexName).mappings().get("b").fullName()); } @Test From e6ca15843616999d45344e0313add5ab8f94ba8f Mon Sep 17 00:00:00 2001 From: Sylvain Wallez Date: Tue, 12 Jul 2022 14:42:17 +0200 Subject: [PATCH 2/2] [codegen] Update API spec, fix some spec-related java client issues --- .../ElasticsearchAsyncClient.java | 20 +- .../elasticsearch/ElasticsearchClient.java | 20 +- .../elasticsearch/_types/BulkStats.java | 38 +- .../elasticsearch/_types/FlushStats.java | 20 +- .../elasticsearch/_types/GetStats.java | 58 +- .../elasticsearch/_types/IndexingStats.java | 57 +- .../elasticsearch/_types/MergesStats.java | 57 +- .../elasticsearch/_types/RecoveryStats.java | 20 +- .../elasticsearch/_types/RefreshStats.java | 20 +- .../elasticsearch/_types/SearchStats.java | 144 +++ .../elasticsearch/_types/SortOptions.java | 2 +- .../clients/elasticsearch/_types/Time.java | 7 +- .../elasticsearch/_types/WarmerStats.java | 20 +- .../AutoDateHistogramAggregate.java | 14 +- .../DateHistogramAggregation.java | 12 + .../aggregations/DateHistogramBucket.java | 14 +- .../analysis/AsciiFoldingTokenFilter.java | 24 +- .../analysis/DelimitedPayloadTokenFilter.java | 35 +- .../_types/analysis/EdgeNGramTokenFilter.java | 43 +- .../_types/analysis/ElisionTokenFilter.java | 60 +- .../analysis/FingerprintTokenFilter.java | 40 +- .../_types/analysis/HunspellTokenFilter.java | 60 +- .../_types/analysis/LengthTokenFilter.java | 45 +- .../analysis/LimitTokenCountTokenFilter.java | 45 +- .../analysis/MultiplexerTokenFilter.java | 22 +- .../analysis/NoriPartOfSpeechTokenFilter.java | 9 +- .../_types/analysis/Normalizer.java | 2 +- .../analysis/PatternCaptureTokenFilter.java | 22 +- .../analysis/PatternReplaceTokenFilter.java | 65 +- .../_types/analysis/StopTokenFilter.java | 9 +- .../_types/analysis/TruncateTokenFilter.java | 24 +- .../_types/mapping/GeoShapeProperty.java | 2 +- .../_types/mapping/ShapeProperty.java | 2 +- .../elasticsearch/_types/query_dsl/Like.java | 2 +- .../elasticsearch/_types/query_dsl/Query.java | 2 +- .../query_dsl/SimpleQueryStringFlags.java | 2 +- .../async_search/AsyncSearchResponseBase.java | 83 +- .../ElasticsearchAsyncSearchAsyncClient.java | 16 +- .../ElasticsearchAsyncSearchClient.java | 16 +- .../ElasticsearchAutoscalingAsyncClient.java | 14 +- .../ElasticsearchAutoscalingClient.java | 14 +- .../cat/ElasticsearchCatAsyncClient.java | 126 +-- .../cat/ElasticsearchCatClient.java | 126 +-- .../elasticsearch/cat/ThreadPoolRequest.java | 21 +- .../elasticsearch/cat/TransformsRequest.java | 21 +- .../elasticsearch/cat/count/CountRecord.java | 32 +- .../cat/health/HealthRecord.java | 32 +- .../cat/recovery/RecoveryRecord.java | 70 +- .../cat/snapshots/SnapshotsRecord.java | 62 +- .../ccr/ElasticsearchCcrAsyncClient.java | 52 +- .../ccr/ElasticsearchCcrClient.java | 52 +- .../clients/elasticsearch/ccr/ShardStats.java | 199 +++- .../ccr/stats/AutoFollowedCluster.java | 13 +- .../cluster/AllocationExplainResponse.java | 58 +- .../ElasticsearchClusterAsyncClient.java | 80 +- .../cluster/ElasticsearchClusterClient.java | 80 +- .../elasticsearch/cluster/HealthResponse.java | 59 +- .../cluster/pending_tasks/PendingTask.java | 44 +- .../reroute/CommandAllocateReplicaAction.java | 2 +- .../cluster/stats/ClusterProcessor.java | 38 + .../core/DeleteByQueryRequest.java | 9 +- .../core/DeleteByQueryResponse.java | 100 +- .../core/DeleteByQueryRethrottleRequest.java | 10 +- .../elasticsearch/core/ReindexRequest.java | 9 +- .../elasticsearch/core/ReindexResponse.java | 58 +- .../core/ReindexRethrottleRequest.java | 10 +- .../core/UpdateByQueryRequest.java | 9 +- .../core/UpdateByQueryResponse.java | 98 +- .../core/UpdateByQueryRethrottleRequest.java | 10 +- ...ankEvalMetricDiscountedCumulativeGain.java | 2 +- .../RankEvalMetricExpectedReciprocalRank.java | 2 +- .../RankEvalMetricMeanReciprocalRank.java | 2 +- .../rank_eval/RankEvalMetricPrecision.java | 2 +- .../core/rank_eval/RankEvalMetricRecall.java | 2 +- .../reindex_rethrottle/ReindexStatus.java | 73 ++ .../elasticsearch/core/search/Context.java | 2 +- .../list_dangling_indices/DanglingIndex.java | 15 +- .../elasticsearch/doc-files/api-spec.html | 985 +++++++++--------- .../eql/EqlSearchResponseBase.java | 12 +- .../eql/GetEqlStatusResponse.java | 28 +- .../LifecycleExplainManaged.java | 348 +++++-- .../LifecycleExplainPhaseExecution.java | 13 +- .../indices/DiskUsageRequest.java | 118 +-- .../elasticsearch/indices/IndexSettings.java | 104 +- .../indices/MappingLimitSettings.java | 2 +- .../field_usage_stats/UsageStatsShards.java | 14 +- .../indices/recovery/RecoveryIndexStatus.java | 76 +- .../indices/recovery/RecoveryStartStatus.java | 105 +- .../indices/recovery/ShardRecovery.java | 71 +- .../indices/recovery/TranslogStatus.java | 33 +- .../indices/recovery/VerifyIndex.java | 27 +- .../indices/rollover/RolloverConditions.java | 58 +- .../geo_ip_stats/GeoIpDownloadStatistics.java | 11 +- .../elasticsearch/license/License.java | 40 +- .../license/get/LicenseInformation.java | 38 +- .../elasticsearch/ml/AnalysisConfig.java | 29 +- .../elasticsearch/ml/AnalysisConfigRead.java | 29 +- .../clients/elasticsearch/ml/Anomaly.java | 35 +- .../elasticsearch/ml/BucketInfluencer.java | 47 +- .../elasticsearch/ml/BucketSummary.java | 84 +- .../clients/elasticsearch/ml/Datafeed.java | 38 +- .../elasticsearch/ml/DatafeedConfig.java | 54 +- .../elasticsearch/ml/DatafeedTimingStats.java | 13 +- ...ataframeAnalyticsStatsHyperparameters.java | 15 +- .../DataframeAnalyticsStatsMemoryUsage.java | 14 +- ...taframeAnalyticsStatsOutlierDetection.java | 15 +- .../ml/ElasticsearchMlAsyncClient.java | 28 +- .../ml/ElasticsearchMlClient.java | 28 +- .../ml/GetCalendarEventsRequest.java | 10 +- .../ml/GetModelSnapshotsRequest.java | 42 +- .../ml/GetOverallBucketsRequest.java | 41 +- .../clients/elasticsearch/ml/Influencer.java | 23 +- .../elastic/clients/elasticsearch/ml/Job.java | 28 +- .../elasticsearch/ml/ModelSizeStats.java | 20 +- .../elasticsearch/ml/OverallBucket.java | 40 +- .../elasticsearch/ml/PutJobRequest.java | 44 +- .../ml/RunningStateSearchInterval.java | 74 ++ .../ml/StartDatafeedRequest.java | 41 +- .../clients/elasticsearch/ml/TimingStats.java | 22 +- .../elasticsearch/ml/TrainedModelConfig.java | 22 +- .../ml/TrainedModelInferenceStats.java | 21 +- .../elasticsearch/ml/UpdateJobResponse.java | 27 +- .../elasticsearch/monitoring/BulkRequest.java | 20 +- .../nodes/ClusterStateUpdate.java | 157 ++- .../clients/elasticsearch/nodes/Cpu.java | 58 +- .../nodes/ElasticsearchNodesAsyncClient.java | 24 +- .../nodes/ElasticsearchNodesClient.java | 24 +- .../elasticsearch/nodes/Recording.java | 20 +- .../nodes/RepositoryMeteringInformation.java | 27 +- .../nodes/info/NodeOperatingSystemInfo.java | 11 +- .../nodes/info/NodeThreadPoolInfo.java | 20 +- .../elasticsearch/nodes/usage/NodeUsage.java | 28 +- .../security/ClusterPrivilege.java | 2 + .../ElasticsearchSecurityAsyncClient.java | 36 + .../security/ElasticsearchSecurityClient.java | 37 + .../security/GrantApiKeyResponse.java | 15 +- .../HasPrivilegesUserProfileRequest.java | 235 +++++ .../HasPrivilegesUserProfileResponse.java | 235 +++++ .../security/SuggestUserProfilesRequest.java | 73 +- .../PrivilegesCheck.java | 280 +++++ .../security/suggest_user_profiles/Hint.java | 234 +++++ .../shutdown/get_node/NodeShutdownStatus.java | 15 +- .../elasticsearch/slm/GetStatsResponse.java | 35 +- .../clients/elasticsearch/slm/InProgress.java | 15 +- .../elasticsearch/slm/SnapshotLifecycle.java | 26 +- .../clients/elasticsearch/slm/Statistics.java | 34 +- .../snapshot/ShardsStatsSummary.java | 37 + .../elasticsearch/snapshot/SnapshotInfo.java | 75 +- .../elasticsearch/snapshot/SnapshotStats.java | 37 + .../sql/GetAsyncStatusResponse.java | 25 +- .../elasticsearch/sql/TranslateResponse.java | 188 +++- .../tasks/ElasticsearchTasksAsyncClient.java | 16 +- .../tasks/ElasticsearchTasksClient.java | 16 +- .../clients/elasticsearch/tasks/TaskInfo.java | 20 +- .../get_transform/TransformSummary.java | 15 +- .../get_transform_stats/CheckpointStats.java | 26 +- .../TransformIndexerStats.java | 14 +- .../clients/elasticsearch/watcher/Action.java | 15 +- .../elasticsearch/watcher/DailySchedule.java | 18 +- .../watcher/ExecutionResult.java | 12 +- .../watcher/ScheduleTimeOfDay.java | 182 ++++ .../watcher/ScheduleTimeOfDayBuilders.java | 48 + .../watcher/SlackAttachment.java | 15 +- .../clients/elasticsearch/watcher/Watch.java | 79 +- .../xpack/info/MinimalLicenseInformation.java | 15 +- .../xpack/usage/WatcherActionTotals.java | 21 +- .../model/ClassStructureTest.java | 1 - .../spec_issues/SpecIssuesTest.java | 2 + 168 files changed, 5647 insertions(+), 2619 deletions(-) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/HasPrivilegesUserProfileRequest.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/HasPrivilegesUserProfileResponse.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/has_privileges_user_profile/PrivilegesCheck.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/suggest_user_profiles/Hint.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ScheduleTimeOfDay.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ScheduleTimeOfDayBuilders.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 a7004e804..88a57a2ec 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 @@ -305,7 +305,7 @@ public ElasticsearchXpackAsyncClient xpack() { * request. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/docs-bulk.html">Documentation * on elastic.co */ @@ -324,7 +324,7 @@ public CompletableFuture bulk(BulkRequest request) { * a function that initializes a builder to create the * {@link BulkRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/docs-bulk.html">Documentation * on elastic.co */ @@ -337,7 +337,7 @@ public final CompletableFuture bulk(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/docs-bulk.html">Documentation * on elastic.co */ @@ -352,7 +352,7 @@ public CompletableFuture bulk() { * Explicitly clears the search context for a scroll. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/clear-scroll-api.html">Documentation * on elastic.co */ @@ -370,7 +370,7 @@ public CompletableFuture clearScroll(ClearScrollRequest req * a function that initializes a builder to create the * {@link ClearScrollRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/clear-scroll-api.html">Documentation * on elastic.co */ @@ -383,7 +383,7 @@ public final CompletableFuture clearScroll( * Explicitly clears the search context for a scroll. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/clear-scroll-api.html">Documentation * on elastic.co */ @@ -398,7 +398,7 @@ public CompletableFuture clearScroll() { * Close a point in time * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/point-in-time-api.html">Documentation * on elastic.co */ @@ -416,7 +416,7 @@ public CompletableFuture closePointInTime(ClosePointIn * a function that initializes a builder to create the * {@link ClosePointInTimeRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/point-in-time-api.html">Documentation * on elastic.co */ @@ -1158,7 +1158,7 @@ public CompletableFuture mtermvectors() { * Open a point in time that can be used in subsequent searches * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/point-in-time-api.html">Documentation * on elastic.co */ @@ -1176,7 +1176,7 @@ public CompletableFuture openPointInTime(OpenPointInTim * a function that initializes a builder to create the * {@link OpenPointInTimeRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/point-in-time-api.html">Documentation * on elastic.co */ 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 fdd03d6af..00f1a763b 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 @@ -306,7 +306,7 @@ public ElasticsearchXpackClient xpack() { * request. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/docs-bulk.html">Documentation * on elastic.co */ @@ -325,7 +325,7 @@ public BulkResponse bulk(BulkRequest request) throws IOException, ElasticsearchE * a function that initializes a builder to create the * {@link BulkRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/docs-bulk.html">Documentation * on elastic.co */ @@ -339,7 +339,7 @@ public final BulkResponse bulk(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/docs-bulk.html">Documentation * on elastic.co */ @@ -354,7 +354,7 @@ public BulkResponse bulk() throws IOException, ElasticsearchException { * Explicitly clears the search context for a scroll. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/clear-scroll-api.html">Documentation * on elastic.co */ @@ -372,7 +372,7 @@ public ClearScrollResponse clearScroll(ClearScrollRequest request) throws IOExce * a function that initializes a builder to create the * {@link ClearScrollRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/clear-scroll-api.html">Documentation * on elastic.co */ @@ -386,7 +386,7 @@ public final ClearScrollResponse clearScroll( * Explicitly clears the search context for a scroll. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/clear-scroll-api.html">Documentation * on elastic.co */ @@ -401,7 +401,7 @@ public ClearScrollResponse clearScroll() throws IOException, ElasticsearchExcept * Close a point in time * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/point-in-time-api.html">Documentation * on elastic.co */ @@ -420,7 +420,7 @@ public ClosePointInTimeResponse closePointInTime(ClosePointInTimeRequest request * a function that initializes a builder to create the * {@link ClosePointInTimeRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/point-in-time-api.html">Documentation * on elastic.co */ @@ -1176,7 +1176,7 @@ public MtermvectorsResponse mtermvectors() throws IOException, ElasticsearchExce * Open a point in time that can be used in subsequent searches * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/point-in-time-api.html">Documentation * on elastic.co */ @@ -1195,7 +1195,7 @@ public OpenPointInTimeResponse openPointInTime(OpenPointInTimeRequest request) * a function that initializes a builder to create the * {@link OpenPointInTimeRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/point-in-time-api.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/BulkStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/BulkStats.java index 6ecddb52e..f3a749168 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/BulkStats.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/BulkStats.java @@ -52,7 +52,7 @@ public class BulkStats implements JsonpSerializable { private final long totalOperations; @Nullable - private final String totalTime; + private final Time totalTime; private final long totalTimeInMillis; @@ -62,7 +62,7 @@ public class BulkStats implements JsonpSerializable { private final long totalSizeInBytes; @Nullable - private final String avgTime; + private final Time avgTime; private final long avgTimeInMillis; @@ -102,7 +102,7 @@ public final long totalOperations() { * API name: {@code total_time} */ @Nullable - public final String totalTime() { + public final Time totalTime() { return this.totalTime; } @@ -132,7 +132,7 @@ public final long totalSizeInBytes() { * API name: {@code avg_time} */ @Nullable - public final String avgTime() { + public final Time avgTime() { return this.avgTime; } @@ -174,7 +174,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.totalTime != null) { generator.writeKey("total_time"); - generator.write(this.totalTime); + this.totalTime.serialize(generator, mapper); } generator.writeKey("total_time_in_millis"); @@ -190,7 +190,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.avgTime != null) { generator.writeKey("avg_time"); - generator.write(this.avgTime); + this.avgTime.serialize(generator, mapper); } generator.writeKey("avg_time_in_millis"); @@ -221,7 +221,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Long totalOperations; @Nullable - private String totalTime; + private Time totalTime; private Long totalTimeInMillis; @@ -231,7 +231,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Long totalSizeInBytes; @Nullable - private String avgTime; + private Time avgTime; private Long avgTimeInMillis; @@ -251,11 +251,18 @@ public final Builder totalOperations(long value) { /** * API name: {@code total_time} */ - public final Builder totalTime(@Nullable String value) { + public final Builder totalTime(@Nullable Time value) { this.totalTime = value; return this; } + /** + * API name: {@code total_time} + */ + public final Builder totalTime(Function> fn) { + return this.totalTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_time_in_millis} */ @@ -283,11 +290,18 @@ public final Builder totalSizeInBytes(long value) { /** * API name: {@code avg_time} */ - public final Builder avgTime(@Nullable String value) { + public final Builder avgTime(@Nullable Time value) { this.avgTime = value; return this; } + /** + * API name: {@code avg_time} + */ + public final Builder avgTime(Function> fn) { + return this.avgTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code avg_time_in_millis} */ @@ -341,11 +355,11 @@ public BulkStats build() { protected static void setupBulkStatsDeserializer(ObjectDeserializer op) { op.add(Builder::totalOperations, JsonpDeserializer.longDeserializer(), "total_operations"); - op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); + op.add(Builder::totalTime, Time._DESERIALIZER, "total_time"); op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); op.add(Builder::totalSize, JsonpDeserializer.stringDeserializer(), "total_size"); op.add(Builder::totalSizeInBytes, JsonpDeserializer.longDeserializer(), "total_size_in_bytes"); - op.add(Builder::avgTime, JsonpDeserializer.stringDeserializer(), "avg_time"); + op.add(Builder::avgTime, Time._DESERIALIZER, "avg_time"); op.add(Builder::avgTimeInMillis, JsonpDeserializer.longDeserializer(), "avg_time_in_millis"); op.add(Builder::avgSize, JsonpDeserializer.stringDeserializer(), "avg_size"); op.add(Builder::avgSizeInBytes, JsonpDeserializer.longDeserializer(), "avg_size_in_bytes"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/FlushStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/FlushStats.java index c1fb617be..24462f0c9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/FlushStats.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/FlushStats.java @@ -35,7 +35,6 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.Long; -import java.lang.String; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -54,7 +53,7 @@ public class FlushStats implements JsonpSerializable { private final long total; @Nullable - private final String totalTime; + private final Time totalTime; private final long totalTimeInMillis; @@ -91,7 +90,7 @@ public final long total() { * API name: {@code total_time} */ @Nullable - public final String totalTime() { + public final Time totalTime() { return this.totalTime; } @@ -121,7 +120,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.totalTime != null) { generator.writeKey("total_time"); - generator.write(this.totalTime); + this.totalTime.serialize(generator, mapper); } generator.writeKey("total_time_in_millis"); @@ -146,7 +145,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Long total; @Nullable - private String totalTime; + private Time totalTime; private Long totalTimeInMillis; @@ -169,11 +168,18 @@ public final Builder total(long value) { /** * API name: {@code total_time} */ - public final Builder totalTime(@Nullable String value) { + public final Builder totalTime(@Nullable Time value) { this.totalTime = value; return this; } + /** + * API name: {@code total_time} + */ + public final Builder totalTime(Function> fn) { + return this.totalTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_time_in_millis} */ @@ -212,7 +218,7 @@ protected static void setupFlushStatsDeserializer(ObjectDeserializer implement private Long current; @Nullable - private String existsTime; + private Time existsTime; private Long existsTimeInMillis; private Long existsTotal; @Nullable - private String missingTime; + private Time missingTime; private Long missingTimeInMillis; private Long missingTotal; @Nullable - private String time; + private Time time; private Long timeInMillis; @@ -262,11 +261,18 @@ public final Builder current(long value) { /** * API name: {@code exists_time} */ - public final Builder existsTime(@Nullable String value) { + public final Builder existsTime(@Nullable Time value) { this.existsTime = value; return this; } + /** + * API name: {@code exists_time} + */ + public final Builder existsTime(Function> fn) { + return this.existsTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code exists_time_in_millis} */ @@ -286,11 +292,18 @@ public final Builder existsTotal(long value) { /** * API name: {@code missing_time} */ - public final Builder missingTime(@Nullable String value) { + public final Builder missingTime(@Nullable Time value) { this.missingTime = value; return this; } + /** + * API name: {@code missing_time} + */ + public final Builder missingTime(Function> fn) { + return this.missingTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code missing_time_in_millis} */ @@ -310,11 +323,18 @@ public final Builder missingTotal(long value) { /** * API name: {@code time} */ - public final Builder time(@Nullable String value) { + public final Builder time(@Nullable Time value) { this.time = value; return this; } + /** + * API name: {@code time} + */ + public final Builder time(Function> fn) { + return this.time(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code time_in_millis} */ @@ -360,13 +380,13 @@ public GetStats build() { protected static void setupGetStatsDeserializer(ObjectDeserializer op) { op.add(Builder::current, JsonpDeserializer.longDeserializer(), "current"); - op.add(Builder::existsTime, JsonpDeserializer.stringDeserializer(), "exists_time"); + op.add(Builder::existsTime, Time._DESERIALIZER, "exists_time"); op.add(Builder::existsTimeInMillis, JsonpDeserializer.longDeserializer(), "exists_time_in_millis"); op.add(Builder::existsTotal, JsonpDeserializer.longDeserializer(), "exists_total"); - op.add(Builder::missingTime, JsonpDeserializer.stringDeserializer(), "missing_time"); + op.add(Builder::missingTime, Time._DESERIALIZER, "missing_time"); op.add(Builder::missingTimeInMillis, JsonpDeserializer.longDeserializer(), "missing_time_in_millis"); op.add(Builder::missingTotal, JsonpDeserializer.longDeserializer(), "missing_total"); - op.add(Builder::time, JsonpDeserializer.stringDeserializer(), "time"); + op.add(Builder::time, Time._DESERIALIZER, "time"); op.add(Builder::timeInMillis, JsonpDeserializer.longDeserializer(), "time_in_millis"); op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/IndexingStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/IndexingStats.java index d7448908e..1352a7344 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/IndexingStats.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/IndexingStats.java @@ -56,7 +56,7 @@ public class IndexingStats implements JsonpSerializable { private final long deleteCurrent; @Nullable - private final String deleteTime; + private final Time deleteTime; private final long deleteTimeInMillis; @@ -67,12 +67,12 @@ public class IndexingStats implements JsonpSerializable { private final long noopUpdateTotal; @Nullable - private final String throttleTime; + private final Time throttleTime; private final long throttleTimeInMillis; @Nullable - private final String indexTime; + private final Time indexTime; private final long indexTimeInMillis; @@ -126,7 +126,7 @@ public final long deleteCurrent() { * API name: {@code delete_time} */ @Nullable - public final String deleteTime() { + public final Time deleteTime() { return this.deleteTime; } @@ -162,7 +162,7 @@ public final long noopUpdateTotal() { * API name: {@code throttle_time} */ @Nullable - public final String throttleTime() { + public final Time throttleTime() { return this.throttleTime; } @@ -177,7 +177,7 @@ public final long throttleTimeInMillis() { * API name: {@code index_time} */ @Nullable - public final String indexTime() { + public final Time indexTime() { return this.indexTime; } @@ -228,7 +228,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.deleteTime != null) { generator.writeKey("delete_time"); - generator.write(this.deleteTime); + this.deleteTime.serialize(generator, mapper); } generator.writeKey("delete_time_in_millis"); @@ -245,7 +245,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.throttleTime != null) { generator.writeKey("throttle_time"); - generator.write(this.throttleTime); + this.throttleTime.serialize(generator, mapper); } generator.writeKey("throttle_time_in_millis"); @@ -253,7 +253,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.indexTime != null) { generator.writeKey("index_time"); - generator.write(this.indexTime); + this.indexTime.serialize(generator, mapper); } generator.writeKey("index_time_in_millis"); @@ -296,7 +296,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Long deleteCurrent; @Nullable - private String deleteTime; + private Time deleteTime; private Long deleteTimeInMillis; @@ -307,12 +307,12 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Long noopUpdateTotal; @Nullable - private String throttleTime; + private Time throttleTime; private Long throttleTimeInMillis; @Nullable - private String indexTime; + private Time indexTime; private Long indexTimeInMillis; @@ -342,11 +342,18 @@ public final Builder deleteCurrent(long value) { /** * API name: {@code delete_time} */ - public final Builder deleteTime(@Nullable String value) { + public final Builder deleteTime(@Nullable Time value) { this.deleteTime = value; return this; } + /** + * API name: {@code delete_time} + */ + public final Builder deleteTime(Function> fn) { + return this.deleteTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code delete_time_in_millis} */ @@ -382,11 +389,18 @@ public final Builder noopUpdateTotal(long value) { /** * API name: {@code throttle_time} */ - public final Builder throttleTime(@Nullable String value) { + public final Builder throttleTime(@Nullable Time value) { this.throttleTime = value; return this; } + /** + * API name: {@code throttle_time} + */ + public final Builder throttleTime(Function> fn) { + return this.throttleTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code throttle_time_in_millis} */ @@ -398,11 +412,18 @@ public final Builder throttleTimeInMillis(long value) { /** * API name: {@code index_time} */ - public final Builder indexTime(@Nullable String value) { + public final Builder indexTime(@Nullable Time value) { this.indexTime = value; return this; } + /** + * API name: {@code index_time} + */ + public final Builder indexTime(Function> fn) { + return this.indexTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code index_time_in_millis} */ @@ -486,14 +507,14 @@ protected static void setupIndexingStatsDeserializer(ObjectDeserializer implement private Long totalSizeInBytes; @Nullable - private String totalStoppedTime; + private Time totalStoppedTime; private Long totalStoppedTimeInMillis; @Nullable - private String totalThrottledTime; + private Time totalThrottledTime; private Long totalThrottledTimeInMillis; @Nullable - private String totalTime; + private Time totalTime; private Long totalTimeInMillis; @@ -441,11 +441,18 @@ public final Builder totalSizeInBytes(long value) { /** * API name: {@code total_stopped_time} */ - public final Builder totalStoppedTime(@Nullable String value) { + public final Builder totalStoppedTime(@Nullable Time value) { this.totalStoppedTime = value; return this; } + /** + * API name: {@code total_stopped_time} + */ + public final Builder totalStoppedTime(Function> fn) { + return this.totalStoppedTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_stopped_time_in_millis} */ @@ -457,11 +464,18 @@ public final Builder totalStoppedTimeInMillis(long value) { /** * API name: {@code total_throttled_time} */ - public final Builder totalThrottledTime(@Nullable String value) { + public final Builder totalThrottledTime(@Nullable Time value) { this.totalThrottledTime = value; return this; } + /** + * API name: {@code total_throttled_time} + */ + public final Builder totalThrottledTime(Function> fn) { + return this.totalThrottledTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_throttled_time_in_millis} */ @@ -473,11 +487,18 @@ public final Builder totalThrottledTimeInMillis(long value) { /** * API name: {@code total_time} */ - public final Builder totalTime(@Nullable String value) { + public final Builder totalTime(@Nullable Time value) { this.totalTime = value; return this; } + /** + * API name: {@code total_time} + */ + public final Builder totalTime(Function> fn) { + return this.totalTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_time_in_millis} */ @@ -524,12 +545,12 @@ protected static void setupMergesStatsDeserializer(ObjectDeserializer implement private Long currentAsTarget; @Nullable - private String throttleTime; + private Time throttleTime; private Long throttleTimeInMillis; @@ -170,11 +169,18 @@ public final Builder currentAsTarget(long value) { /** * API name: {@code throttle_time} */ - public final Builder throttleTime(@Nullable String value) { + public final Builder throttleTime(@Nullable Time value) { this.throttleTime = value; return this; } + /** + * API name: {@code throttle_time} + */ + public final Builder throttleTime(Function> fn) { + return this.throttleTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code throttle_time_in_millis} */ @@ -213,7 +219,7 @@ protected static void setupRecoveryStatsDeserializer(ObjectDeserializer implement private Long total; @Nullable - private String totalTime; + private Time totalTime; private Long totalTimeInMillis; @@ -216,11 +215,18 @@ public final Builder total(long value) { /** * API name: {@code total_time} */ - public final Builder totalTime(@Nullable String value) { + public final Builder totalTime(@Nullable Time value) { this.totalTime = value; return this; } + /** + * API name: {@code total_time} + */ + public final Builder totalTime(Function> fn) { + return this.totalTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_time_in_millis} */ @@ -262,7 +268,7 @@ protected static void setupRefreshStatsDeserializer(ObjectDeserializer implements ObjectBuilder { private Long fetchCurrent; + @Nullable + private Time fetchTime; + private Long fetchTimeInMillis; private Long fetchTotal; @@ -293,18 +364,27 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Long queryCurrent; + @Nullable + private Time queryTime; + private Long queryTimeInMillis; private Long queryTotal; private Long scrollCurrent; + @Nullable + private Time scrollTime; + private Long scrollTimeInMillis; private Long scrollTotal; private Long suggestCurrent; + @Nullable + private Time suggestTime; + private Long suggestTimeInMillis; private Long suggestTotal; @@ -320,6 +400,21 @@ public final Builder fetchCurrent(long value) { return this; } + /** + * API name: {@code fetch_time} + */ + public final Builder fetchTime(@Nullable Time value) { + this.fetchTime = value; + return this; + } + + /** + * API name: {@code fetch_time} + */ + public final Builder fetchTime(Function> fn) { + return this.fetchTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code fetch_time_in_millis} */ @@ -352,6 +447,21 @@ public final Builder queryCurrent(long value) { return this; } + /** + * API name: {@code query_time} + */ + public final Builder queryTime(@Nullable Time value) { + this.queryTime = value; + return this; + } + + /** + * API name: {@code query_time} + */ + public final Builder queryTime(Function> fn) { + return this.queryTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code query_time_in_millis} */ @@ -376,6 +486,21 @@ public final Builder scrollCurrent(long value) { return this; } + /** + * API name: {@code scroll_time} + */ + public final Builder scrollTime(@Nullable Time value) { + this.scrollTime = value; + return this; + } + + /** + * API name: {@code scroll_time} + */ + public final Builder scrollTime(Function> fn) { + return this.scrollTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code scroll_time_in_millis} */ @@ -400,6 +525,21 @@ public final Builder suggestCurrent(long value) { return this; } + /** + * API name: {@code suggest_time} + */ + public final Builder suggestTime(@Nullable Time value) { + this.suggestTime = value; + return this; + } + + /** + * API name: {@code suggest_time} + */ + public final Builder suggestTime(Function> fn) { + return this.suggestTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code suggest_time_in_millis} */ @@ -474,16 +614,20 @@ public SearchStats build() { protected static void setupSearchStatsDeserializer(ObjectDeserializer op) { op.add(Builder::fetchCurrent, JsonpDeserializer.longDeserializer(), "fetch_current"); + op.add(Builder::fetchTime, Time._DESERIALIZER, "fetch_time"); op.add(Builder::fetchTimeInMillis, JsonpDeserializer.longDeserializer(), "fetch_time_in_millis"); op.add(Builder::fetchTotal, JsonpDeserializer.longDeserializer(), "fetch_total"); op.add(Builder::openContexts, JsonpDeserializer.longDeserializer(), "open_contexts"); op.add(Builder::queryCurrent, JsonpDeserializer.longDeserializer(), "query_current"); + op.add(Builder::queryTime, Time._DESERIALIZER, "query_time"); op.add(Builder::queryTimeInMillis, JsonpDeserializer.longDeserializer(), "query_time_in_millis"); op.add(Builder::queryTotal, JsonpDeserializer.longDeserializer(), "query_total"); op.add(Builder::scrollCurrent, JsonpDeserializer.longDeserializer(), "scroll_current"); + op.add(Builder::scrollTime, Time._DESERIALIZER, "scroll_time"); op.add(Builder::scrollTimeInMillis, JsonpDeserializer.longDeserializer(), "scroll_time_in_millis"); op.add(Builder::scrollTotal, JsonpDeserializer.longDeserializer(), "scroll_total"); op.add(Builder::suggestCurrent, JsonpDeserializer.longDeserializer(), "suggest_current"); + op.add(Builder::suggestTime, Time._DESERIALIZER, "suggest_time"); op.add(Builder::suggestTimeInMillis, JsonpDeserializer.longDeserializer(), "suggest_time_in_millis"); op.add(Builder::suggestTotal, JsonpDeserializer.longDeserializer(), "suggest_total"); op.add(Builder::groups, JsonpDeserializer.stringMapDeserializer(SearchStats._DESERIALIZER), "groups"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/SortOptions.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/SortOptions.java index 3f621f143..a7b509587 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/SortOptions.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/SortOptions.java @@ -48,7 +48,7 @@ /** * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/sort-search-results.html">Documentation * on elastic.co * @see API * specification diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/Time.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/Time.java index 7ba378eb0..ae97518e2 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/Time.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/Time.java @@ -43,16 +43,17 @@ import java.util.function.Function; import javax.annotation.Nullable; -// typedef: _types.Time +// typedef: _types.Duration /** * Whenever durations need to be specified, e.g. for a timeout parameter, the * duration must specify the unit, like 2d for 2 days. * * @see Documentation + * "https://github.com/elastic/elasticsearch/blob/master/libs/core/src/main/java/org/elasticsearch/core/TimeValue.java">Documentation * on elastic.co - * @see API specification + * @see API + * specification */ @JsonpDeserializable public class Time implements TaggedUnion, JsonpSerializable { diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/WarmerStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/WarmerStats.java index 11c0d6c08..365758ab7 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/WarmerStats.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/WarmerStats.java @@ -35,7 +35,6 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.Long; -import java.lang.String; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -54,7 +53,7 @@ public class WarmerStats implements JsonpSerializable { private final long total; @Nullable - private final String totalTime; + private final Time totalTime; private final long totalTimeInMillis; @@ -91,7 +90,7 @@ public final long total() { * API name: {@code total_time} */ @Nullable - public final String totalTime() { + public final Time totalTime() { return this.totalTime; } @@ -121,7 +120,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.totalTime != null) { generator.writeKey("total_time"); - generator.write(this.totalTime); + this.totalTime.serialize(generator, mapper); } generator.writeKey("total_time_in_millis"); @@ -146,7 +145,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Long total; @Nullable - private String totalTime; + private Time totalTime; private Long totalTimeInMillis; @@ -169,11 +168,18 @@ public final Builder total(long value) { /** * API name: {@code total_time} */ - public final Builder totalTime(@Nullable String value) { + public final Builder totalTime(@Nullable Time value) { this.totalTime = value; return this; } + /** + * API name: {@code total_time} + */ + public final Builder totalTime(Function> fn) { + return this.totalTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_time_in_millis} */ @@ -212,7 +218,7 @@ protected static void setupWarmerStatsDeserializer(ObjectDeserializer implements AggregateVariant { - private final DateTime interval; + private final String interval; // --------------------------------------------------------------------------------------------- @@ -74,7 +74,7 @@ public Aggregate.Kind _aggregateKind() { /** * Required - API name: {@code interval} */ - public final DateTime interval() { + public final String interval() { return this.interval; } @@ -82,7 +82,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { super.serializeInternal(generator, mapper); generator.writeKey("interval"); - this.interval.serialize(generator, mapper); + generator.write(this.interval); } @@ -95,12 +95,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends MultiBucketAggregateBase.AbstractBuilder implements ObjectBuilder { - private DateTime interval; + private String interval; /** * Required - API name: {@code interval} */ - public final Builder interval(DateTime value) { + public final Builder interval(String value) { this.interval = value; return this; } @@ -135,7 +135,7 @@ public AutoDateHistogramAggregate build() { protected static void setupAutoDateHistogramAggregateDeserializer( ObjectDeserializer op) { MultiBucketAggregateBase.setupMultiBucketAggregateBaseDeserializer(op, DateHistogramBucket._DESERIALIZER); - op.add(Builder::interval, DateTime._DESERIALIZER, "interval"); + op.add(Builder::interval, JsonpDeserializer.stringDeserializer(), "interval"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DateHistogramAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DateHistogramAggregation.java index a4c7fc1ac..59363030c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DateHistogramAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DateHistogramAggregation.java @@ -194,7 +194,11 @@ public final String format() { /** * API name: {@code interval} + * + * @deprecated 7.2.0 use fixed_interval or + * calendar_interval */ + @Deprecated @Nullable public final Time interval() { return this.interval; @@ -482,7 +486,11 @@ public final Builder format(@Nullable String value) { /** * API name: {@code interval} + * + * @deprecated 7.2.0 use fixed_interval or + * calendar_interval */ + @Deprecated public final Builder interval(@Nullable Time value) { this.interval = value; return this; @@ -490,7 +498,11 @@ public final Builder interval(@Nullable Time value) { /** * API name: {@code interval} + * + * @deprecated 7.2.0 use fixed_interval or + * calendar_interval */ + @Deprecated public final Builder interval(Function> fn) { return this.interval(fn.apply(new Time.Builder()).build()); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DateHistogramBucket.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DateHistogramBucket.java index 76bc7296f..f5db7fb49 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DateHistogramBucket.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DateHistogramBucket.java @@ -29,9 +29,9 @@ 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 jakarta.json.stream.JsonGenerator; +import java.lang.Long; import java.lang.String; import java.util.Objects; import java.util.function.Function; @@ -50,7 +50,7 @@ public class DateHistogramBucket extends MultiBucketBase { @Nullable private final String keyAsString; - private final DateTime key; + private final long key; // --------------------------------------------------------------------------------------------- @@ -77,7 +77,7 @@ public final String keyAsString() { /** * Required - API name: {@code key} */ - public final DateTime key() { + public final long key() { return this.key; } @@ -90,7 +90,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeKey("key"); - this.key.serialize(generator, mapper); + generator.write(this.key); } @@ -106,7 +106,7 @@ public static class Builder extends MultiBucketBase.AbstractBuilder @Nullable private String keyAsString; - private DateTime key; + private Long key; /** * API name: {@code key_as_string} @@ -119,7 +119,7 @@ public final Builder keyAsString(@Nullable String value) { /** * Required - API name: {@code key} */ - public final Builder key(DateTime value) { + public final Builder key(long value) { this.key = value; return this; } @@ -153,7 +153,7 @@ public DateHistogramBucket build() { protected static void setupDateHistogramBucketDeserializer(ObjectDeserializer op) { MultiBucketBase.setupMultiBucketBaseDeserializer(op); op.add(Builder::keyAsString, JsonpDeserializer.stringDeserializer(), "key_as_string"); - op.add(Builder::key, DateTime._DESERIALIZER, "key"); + op.add(Builder::key, JsonpDeserializer.longDeserializer(), "key"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/AsciiFoldingTokenFilter.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/AsciiFoldingTokenFilter.java index 56876efba..c5ee53be2 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/AsciiFoldingTokenFilter.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/AsciiFoldingTokenFilter.java @@ -28,12 +28,12 @@ import co.elastic.clients.json.JsonpMapper; 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 jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.util.Objects; import java.util.function.Function; +import javax.annotation.Nullable; // typedef: _types.analysis.AsciiFoldingTokenFilter @@ -45,14 +45,15 @@ */ @JsonpDeserializable public class AsciiFoldingTokenFilter extends TokenFilterBase implements TokenFilterDefinitionVariant { - private final boolean preserveOriginal; + @Nullable + private final Boolean preserveOriginal; // --------------------------------------------------------------------------------------------- private AsciiFoldingTokenFilter(Builder builder) { super(builder); - this.preserveOriginal = ApiTypeHelper.requireNonNull(builder.preserveOriginal, this, "preserveOriginal"); + this.preserveOriginal = builder.preserveOriginal; } @@ -69,9 +70,10 @@ public TokenFilterDefinition.Kind _tokenFilterDefinitionKind() { } /** - * Required - API name: {@code preserve_original} + * API name: {@code preserve_original} */ - public final boolean preserveOriginal() { + @Nullable + public final Boolean preserveOriginal() { return this.preserveOriginal; } @@ -79,8 +81,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write("type", "asciifolding"); super.serializeInternal(generator, mapper); - generator.writeKey("preserve_original"); - generator.write(this.preserveOriginal); + if (this.preserveOriginal != null) { + generator.writeKey("preserve_original"); + generator.write(this.preserveOriginal); + + } } @@ -93,12 +98,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends TokenFilterBase.AbstractBuilder implements ObjectBuilder { + @Nullable private Boolean preserveOriginal; /** - * Required - API name: {@code preserve_original} + * API name: {@code preserve_original} */ - public final Builder preserveOriginal(boolean value) { + public final Builder preserveOriginal(@Nullable Boolean value) { this.preserveOriginal = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/DelimitedPayloadTokenFilter.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/DelimitedPayloadTokenFilter.java index cc13d54e8..9fc23fde2 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/DelimitedPayloadTokenFilter.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/DelimitedPayloadTokenFilter.java @@ -28,7 +28,6 @@ import co.elastic.clients.json.JsonpMapper; 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 jakarta.json.stream.JsonGenerator; import java.lang.String; @@ -46,8 +45,10 @@ */ @JsonpDeserializable public class DelimitedPayloadTokenFilter extends TokenFilterBase implements TokenFilterDefinitionVariant { + @Nullable private final String delimiter; + @Nullable private final DelimitedPayloadEncoding encoding; // --------------------------------------------------------------------------------------------- @@ -55,8 +56,8 @@ public class DelimitedPayloadTokenFilter extends TokenFilterBase implements Toke private DelimitedPayloadTokenFilter(Builder builder) { super(builder); - this.delimiter = ApiTypeHelper.requireNonNull(builder.delimiter, this, "delimiter"); - this.encoding = ApiTypeHelper.requireNonNull(builder.encoding, this, "encoding"); + this.delimiter = builder.delimiter; + this.encoding = builder.encoding; } @@ -73,15 +74,17 @@ public TokenFilterDefinition.Kind _tokenFilterDefinitionKind() { } /** - * Required - API name: {@code delimiter} + * API name: {@code delimiter} */ + @Nullable public final String delimiter() { return this.delimiter; } /** - * Required - API name: {@code encoding} + * API name: {@code encoding} */ + @Nullable public final DelimitedPayloadEncoding encoding() { return this.encoding; } @@ -90,11 +93,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write("type", "delimited_payload"); super.serializeInternal(generator, mapper); - generator.writeKey("delimiter"); - generator.write(this.delimiter); + if (this.delimiter != null) { + generator.writeKey("delimiter"); + generator.write(this.delimiter); - generator.writeKey("encoding"); - this.encoding.serialize(generator, mapper); + } + if (this.encoding != null) { + generator.writeKey("encoding"); + this.encoding.serialize(generator, mapper); + } } @@ -107,22 +114,24 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends TokenFilterBase.AbstractBuilder implements ObjectBuilder { + @Nullable private String delimiter; + @Nullable private DelimitedPayloadEncoding encoding; /** - * Required - API name: {@code delimiter} + * API name: {@code delimiter} */ - public final Builder delimiter(String value) { + public final Builder delimiter(@Nullable String value) { this.delimiter = value; return this; } /** - * Required - API name: {@code encoding} + * API name: {@code encoding} */ - public final Builder encoding(DelimitedPayloadEncoding value) { + public final Builder encoding(@Nullable DelimitedPayloadEncoding value) { this.encoding = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/EdgeNGramTokenFilter.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/EdgeNGramTokenFilter.java index 13d7dee95..6ee6cb075 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/EdgeNGramTokenFilter.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/EdgeNGramTokenFilter.java @@ -28,7 +28,6 @@ import co.elastic.clients.json.JsonpMapper; 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 jakarta.json.stream.JsonGenerator; import java.lang.Boolean; @@ -47,9 +46,11 @@ */ @JsonpDeserializable public class EdgeNGramTokenFilter extends TokenFilterBase implements TokenFilterDefinitionVariant { - private final int maxGram; + @Nullable + private final Integer maxGram; - private final int minGram; + @Nullable + private final Integer minGram; @Nullable private final EdgeNGramSide side; @@ -62,8 +63,8 @@ public class EdgeNGramTokenFilter extends TokenFilterBase implements TokenFilter private EdgeNGramTokenFilter(Builder builder) { super(builder); - this.maxGram = ApiTypeHelper.requireNonNull(builder.maxGram, this, "maxGram"); - this.minGram = ApiTypeHelper.requireNonNull(builder.minGram, this, "minGram"); + this.maxGram = builder.maxGram; + this.minGram = builder.minGram; this.side = builder.side; this.preserveOriginal = builder.preserveOriginal; @@ -82,16 +83,18 @@ public TokenFilterDefinition.Kind _tokenFilterDefinitionKind() { } /** - * Required - API name: {@code max_gram} + * API name: {@code max_gram} */ - public final int maxGram() { + @Nullable + public final Integer maxGram() { return this.maxGram; } /** - * Required - API name: {@code min_gram} + * API name: {@code min_gram} */ - public final int minGram() { + @Nullable + public final Integer minGram() { return this.minGram; } @@ -115,12 +118,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write("type", "edge_ngram"); super.serializeInternal(generator, mapper); - generator.writeKey("max_gram"); - generator.write(this.maxGram); + if (this.maxGram != null) { + generator.writeKey("max_gram"); + generator.write(this.maxGram); - generator.writeKey("min_gram"); - generator.write(this.minGram); + } + if (this.minGram != null) { + generator.writeKey("min_gram"); + generator.write(this.minGram); + } if (this.side != null) { generator.writeKey("side"); this.side.serialize(generator, mapper); @@ -142,8 +149,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends TokenFilterBase.AbstractBuilder implements ObjectBuilder { + @Nullable private Integer maxGram; + @Nullable private Integer minGram; @Nullable @@ -153,17 +162,17 @@ public static class Builder extends TokenFilterBase.AbstractBuilder private Boolean preserveOriginal; /** - * Required - API name: {@code max_gram} + * API name: {@code max_gram} */ - public final Builder maxGram(int value) { + public final Builder maxGram(@Nullable Integer value) { this.maxGram = value; return this; } /** - * Required - API name: {@code min_gram} + * API name: {@code min_gram} */ - public final Builder minGram(int value) { + public final Builder minGram(@Nullable Integer value) { this.minGram = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/ElisionTokenFilter.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/ElisionTokenFilter.java index 3c127ec98..3505500f5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/ElisionTokenFilter.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/ElisionTokenFilter.java @@ -50,15 +50,20 @@ public class ElisionTokenFilter extends TokenFilterBase implements TokenFilterDefinitionVariant { private final List articles; - private final boolean articlesCase; + @Nullable + private final String articlesPath; + + @Nullable + private final Boolean articlesCase; // --------------------------------------------------------------------------------------------- private ElisionTokenFilter(Builder builder) { super(builder); - this.articles = ApiTypeHelper.unmodifiableRequired(builder.articles, this, "articles"); - this.articlesCase = ApiTypeHelper.requireNonNull(builder.articlesCase, this, "articlesCase"); + this.articles = ApiTypeHelper.unmodifiable(builder.articles); + this.articlesPath = builder.articlesPath; + this.articlesCase = builder.articlesCase; } @@ -75,16 +80,25 @@ public TokenFilterDefinition.Kind _tokenFilterDefinitionKind() { } /** - * Required - API name: {@code articles} + * API name: {@code articles} */ public final List articles() { return this.articles; } /** - * Required - API name: {@code articles_case} + * API name: {@code articles_path} + */ + @Nullable + public final String articlesPath() { + return this.articlesPath; + } + + /** + * API name: {@code articles_case} */ - public final boolean articlesCase() { + @Nullable + public final Boolean articlesCase() { return this.articlesCase; } @@ -102,8 +116,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - generator.writeKey("articles_case"); - generator.write(this.articlesCase); + if (this.articlesPath != null) { + generator.writeKey("articles_path"); + generator.write(this.articlesPath); + + } + if (this.articlesCase != null) { + generator.writeKey("articles_case"); + generator.write(this.articlesCase); + + } } @@ -116,12 +138,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends TokenFilterBase.AbstractBuilder implements ObjectBuilder { + @Nullable private List articles; + @Nullable + private String articlesPath; + + @Nullable private Boolean articlesCase; /** - * Required - API name: {@code articles} + * API name: {@code articles} *

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

* Adds one or more values to articles. */ @@ -141,9 +168,17 @@ public final Builder articles(String value, String... values) { } /** - * Required - API name: {@code articles_case} + * API name: {@code articles_path} + */ + public final Builder articlesPath(@Nullable String value) { + this.articlesPath = value; + return this; + } + + /** + * API name: {@code articles_case} */ - public final Builder articlesCase(boolean value) { + public final Builder articlesCase(@Nullable Boolean value) { this.articlesCase = value; return this; } @@ -178,6 +213,7 @@ protected static void setupElisionTokenFilterDeserializer(ObjectDeserializer implements ObjectBuilder { + @Nullable private Integer maxOutputSize; + @Nullable private String separator; /** - * Required - API name: {@code max_output_size} + * API name: {@code max_output_size} */ - public final Builder maxOutputSize(int value) { + public final Builder maxOutputSize(@Nullable Integer value) { this.maxOutputSize = value; return this; } /** - * Required - API name: {@code separator} + * API name: {@code separator} */ - public final Builder separator(String value) { + public final Builder separator(@Nullable String value) { this.separator = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/HunspellTokenFilter.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/HunspellTokenFilter.java index f5f2fe90f..c32140f2a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/HunspellTokenFilter.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/HunspellTokenFilter.java @@ -47,23 +47,26 @@ */ @JsonpDeserializable public class HunspellTokenFilter extends TokenFilterBase implements TokenFilterDefinitionVariant { - private final boolean dedup; + @Nullable + private final Boolean dedup; + @Nullable private final String dictionary; private final String locale; - private final boolean longestOnly; + @Nullable + private final Boolean longestOnly; // --------------------------------------------------------------------------------------------- private HunspellTokenFilter(Builder builder) { super(builder); - this.dedup = ApiTypeHelper.requireNonNull(builder.dedup, this, "dedup"); - this.dictionary = ApiTypeHelper.requireNonNull(builder.dictionary, this, "dictionary"); + this.dedup = builder.dedup; + this.dictionary = builder.dictionary; this.locale = ApiTypeHelper.requireNonNull(builder.locale, this, "locale"); - this.longestOnly = ApiTypeHelper.requireNonNull(builder.longestOnly, this, "longestOnly"); + this.longestOnly = builder.longestOnly; } @@ -80,15 +83,17 @@ public TokenFilterDefinition.Kind _tokenFilterDefinitionKind() { } /** - * Required - API name: {@code dedup} + * API name: {@code dedup} */ - public final boolean dedup() { + @Nullable + public final Boolean dedup() { return this.dedup; } /** - * Required - API name: {@code dictionary} + * API name: {@code dictionary} */ + @Nullable public final String dictionary() { return this.dictionary; } @@ -101,9 +106,10 @@ public final String locale() { } /** - * Required - API name: {@code longest_only} + * API name: {@code longest_only} */ - public final boolean longestOnly() { + @Nullable + public final Boolean longestOnly() { return this.longestOnly; } @@ -111,17 +117,24 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write("type", "hunspell"); super.serializeInternal(generator, mapper); - generator.writeKey("dedup"); - generator.write(this.dedup); + if (this.dedup != null) { + generator.writeKey("dedup"); + generator.write(this.dedup); - generator.writeKey("dictionary"); - generator.write(this.dictionary); + } + if (this.dictionary != null) { + generator.writeKey("dictionary"); + generator.write(this.dictionary); + } generator.writeKey("locale"); generator.write(this.locale); - generator.writeKey("longest_only"); - generator.write(this.longestOnly); + if (this.longestOnly != null) { + generator.writeKey("longest_only"); + generator.write(this.longestOnly); + + } } @@ -134,26 +147,29 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends TokenFilterBase.AbstractBuilder implements ObjectBuilder { + @Nullable private Boolean dedup; + @Nullable private String dictionary; private String locale; + @Nullable private Boolean longestOnly; /** - * Required - API name: {@code dedup} + * API name: {@code dedup} */ - public final Builder dedup(boolean value) { + public final Builder dedup(@Nullable Boolean value) { this.dedup = value; return this; } /** - * Required - API name: {@code dictionary} + * API name: {@code dictionary} */ - public final Builder dictionary(String value) { + public final Builder dictionary(@Nullable String value) { this.dictionary = value; return this; } @@ -167,9 +183,9 @@ public final Builder locale(String value) { } /** - * Required - API name: {@code longest_only} + * API name: {@code longest_only} */ - public final Builder longestOnly(boolean value) { + public final Builder longestOnly(@Nullable Boolean value) { this.longestOnly = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/LengthTokenFilter.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/LengthTokenFilter.java index 4e6c5dd9f..0d6f69e13 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/LengthTokenFilter.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/LengthTokenFilter.java @@ -28,12 +28,12 @@ import co.elastic.clients.json.JsonpMapper; 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 jakarta.json.stream.JsonGenerator; import java.lang.Integer; import java.util.Objects; import java.util.function.Function; +import javax.annotation.Nullable; // typedef: _types.analysis.LengthTokenFilter @@ -45,17 +45,19 @@ */ @JsonpDeserializable public class LengthTokenFilter extends TokenFilterBase implements TokenFilterDefinitionVariant { - private final int max; + @Nullable + private final Integer max; - private final int min; + @Nullable + private final Integer min; // --------------------------------------------------------------------------------------------- private LengthTokenFilter(Builder builder) { super(builder); - this.max = ApiTypeHelper.requireNonNull(builder.max, this, "max"); - this.min = ApiTypeHelper.requireNonNull(builder.min, this, "min"); + this.max = builder.max; + this.min = builder.min; } @@ -72,16 +74,18 @@ public TokenFilterDefinition.Kind _tokenFilterDefinitionKind() { } /** - * Required - API name: {@code max} + * API name: {@code max} */ - public final int max() { + @Nullable + public final Integer max() { return this.max; } /** - * Required - API name: {@code min} + * API name: {@code min} */ - public final int min() { + @Nullable + public final Integer min() { return this.min; } @@ -89,11 +93,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write("type", "length"); super.serializeInternal(generator, mapper); - generator.writeKey("max"); - generator.write(this.max); + if (this.max != null) { + generator.writeKey("max"); + generator.write(this.max); - generator.writeKey("min"); - generator.write(this.min); + } + if (this.min != null) { + generator.writeKey("min"); + generator.write(this.min); + + } } @@ -106,22 +115,24 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends TokenFilterBase.AbstractBuilder implements ObjectBuilder { + @Nullable private Integer max; + @Nullable private Integer min; /** - * Required - API name: {@code max} + * API name: {@code max} */ - public final Builder max(int value) { + public final Builder max(@Nullable Integer value) { this.max = value; return this; } /** - * Required - API name: {@code min} + * API name: {@code min} */ - public final Builder min(int value) { + public final Builder min(@Nullable Integer value) { this.min = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/LimitTokenCountTokenFilter.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/LimitTokenCountTokenFilter.java index 6abc0754a..e035c944d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/LimitTokenCountTokenFilter.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/LimitTokenCountTokenFilter.java @@ -28,13 +28,13 @@ import co.elastic.clients.json.JsonpMapper; 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 jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.lang.Integer; import java.util.Objects; import java.util.function.Function; +import javax.annotation.Nullable; // typedef: _types.analysis.LimitTokenCountTokenFilter @@ -46,17 +46,19 @@ */ @JsonpDeserializable public class LimitTokenCountTokenFilter extends TokenFilterBase implements TokenFilterDefinitionVariant { - private final boolean consumeAllTokens; + @Nullable + private final Boolean consumeAllTokens; - private final int maxTokenCount; + @Nullable + private final Integer maxTokenCount; // --------------------------------------------------------------------------------------------- private LimitTokenCountTokenFilter(Builder builder) { super(builder); - this.consumeAllTokens = ApiTypeHelper.requireNonNull(builder.consumeAllTokens, this, "consumeAllTokens"); - this.maxTokenCount = ApiTypeHelper.requireNonNull(builder.maxTokenCount, this, "maxTokenCount"); + this.consumeAllTokens = builder.consumeAllTokens; + this.maxTokenCount = builder.maxTokenCount; } @@ -73,16 +75,18 @@ public TokenFilterDefinition.Kind _tokenFilterDefinitionKind() { } /** - * Required - API name: {@code consume_all_tokens} + * API name: {@code consume_all_tokens} */ - public final boolean consumeAllTokens() { + @Nullable + public final Boolean consumeAllTokens() { return this.consumeAllTokens; } /** - * Required - API name: {@code max_token_count} + * API name: {@code max_token_count} */ - public final int maxTokenCount() { + @Nullable + public final Integer maxTokenCount() { return this.maxTokenCount; } @@ -90,11 +94,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write("type", "limit"); super.serializeInternal(generator, mapper); - generator.writeKey("consume_all_tokens"); - generator.write(this.consumeAllTokens); + if (this.consumeAllTokens != null) { + generator.writeKey("consume_all_tokens"); + generator.write(this.consumeAllTokens); - generator.writeKey("max_token_count"); - generator.write(this.maxTokenCount); + } + if (this.maxTokenCount != null) { + generator.writeKey("max_token_count"); + generator.write(this.maxTokenCount); + + } } @@ -107,22 +116,24 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends TokenFilterBase.AbstractBuilder implements ObjectBuilder { + @Nullable private Boolean consumeAllTokens; + @Nullable private Integer maxTokenCount; /** - * Required - API name: {@code consume_all_tokens} + * API name: {@code consume_all_tokens} */ - public final Builder consumeAllTokens(boolean value) { + public final Builder consumeAllTokens(@Nullable Boolean value) { this.consumeAllTokens = value; return this; } /** - * Required - API name: {@code max_token_count} + * API name: {@code max_token_count} */ - public final Builder maxTokenCount(int value) { + public final Builder maxTokenCount(@Nullable Integer value) { this.maxTokenCount = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/MultiplexerTokenFilter.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/MultiplexerTokenFilter.java index 88357e32d..8a221a22d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/MultiplexerTokenFilter.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/MultiplexerTokenFilter.java @@ -50,7 +50,8 @@ public class MultiplexerTokenFilter extends TokenFilterBase implements TokenFilterDefinitionVariant { private final List filters; - private final boolean preserveOriginal; + @Nullable + private final Boolean preserveOriginal; // --------------------------------------------------------------------------------------------- @@ -58,7 +59,7 @@ private MultiplexerTokenFilter(Builder builder) { super(builder); this.filters = ApiTypeHelper.unmodifiableRequired(builder.filters, this, "filters"); - this.preserveOriginal = ApiTypeHelper.requireNonNull(builder.preserveOriginal, this, "preserveOriginal"); + this.preserveOriginal = builder.preserveOriginal; } @@ -82,9 +83,10 @@ public final List filters() { } /** - * Required - API name: {@code preserve_original} + * API name: {@code preserve_original} */ - public final boolean preserveOriginal() { + @Nullable + public final Boolean preserveOriginal() { return this.preserveOriginal; } @@ -102,8 +104,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - generator.writeKey("preserve_original"); - generator.write(this.preserveOriginal); + if (this.preserveOriginal != null) { + generator.writeKey("preserve_original"); + generator.write(this.preserveOriginal); + + } } @@ -118,6 +123,7 @@ public static class Builder extends TokenFilterBase.AbstractBuilder ObjectBuilder { private List filters; + @Nullable private Boolean preserveOriginal; /** @@ -141,9 +147,9 @@ public final Builder filters(String value, String... values) { } /** - * Required - API name: {@code preserve_original} + * API name: {@code preserve_original} */ - public final Builder preserveOriginal(boolean value) { + public final Builder preserveOriginal(@Nullable Boolean value) { this.preserveOriginal = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/NoriPartOfSpeechTokenFilter.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/NoriPartOfSpeechTokenFilter.java index 67c04934b..56092eb10 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/NoriPartOfSpeechTokenFilter.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/NoriPartOfSpeechTokenFilter.java @@ -54,7 +54,7 @@ public class NoriPartOfSpeechTokenFilter extends TokenFilterBase implements Toke private NoriPartOfSpeechTokenFilter(Builder builder) { super(builder); - this.stoptags = ApiTypeHelper.unmodifiableRequired(builder.stoptags, this, "stoptags"); + this.stoptags = ApiTypeHelper.unmodifiable(builder.stoptags); } @@ -71,7 +71,7 @@ public TokenFilterDefinition.Kind _tokenFilterDefinitionKind() { } /** - * Required - API name: {@code stoptags} + * API name: {@code stoptags} */ public final List stoptags() { return this.stoptags; @@ -103,10 +103,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends TokenFilterBase.AbstractBuilder implements ObjectBuilder { + @Nullable private List stoptags; /** - * Required - API name: {@code stoptags} + * API name: {@code stoptags} *

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

* Adds one or more values to stoptags. */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/Normalizer.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/Normalizer.java index a37b0bc3e..bd3d3b1ab 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/Normalizer.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/Normalizer.java @@ -46,7 +46,7 @@ /** * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/analysis-normalizers.html">Documentation * on elastic.co * @see API * specification diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/PatternCaptureTokenFilter.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/PatternCaptureTokenFilter.java index 172c8126e..5b2d569de 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/PatternCaptureTokenFilter.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/PatternCaptureTokenFilter.java @@ -50,7 +50,8 @@ public class PatternCaptureTokenFilter extends TokenFilterBase implements TokenFilterDefinitionVariant { private final List patterns; - private final boolean preserveOriginal; + @Nullable + private final Boolean preserveOriginal; // --------------------------------------------------------------------------------------------- @@ -58,7 +59,7 @@ private PatternCaptureTokenFilter(Builder builder) { super(builder); this.patterns = ApiTypeHelper.unmodifiableRequired(builder.patterns, this, "patterns"); - this.preserveOriginal = ApiTypeHelper.requireNonNull(builder.preserveOriginal, this, "preserveOriginal"); + this.preserveOriginal = builder.preserveOriginal; } @@ -82,9 +83,10 @@ public final List patterns() { } /** - * Required - API name: {@code preserve_original} + * API name: {@code preserve_original} */ - public final boolean preserveOriginal() { + @Nullable + public final Boolean preserveOriginal() { return this.preserveOriginal; } @@ -102,8 +104,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - generator.writeKey("preserve_original"); - generator.write(this.preserveOriginal); + if (this.preserveOriginal != null) { + generator.writeKey("preserve_original"); + generator.write(this.preserveOriginal); + + } } @@ -118,6 +123,7 @@ public static class Builder extends TokenFilterBase.AbstractBuilder ObjectBuilder { private List patterns; + @Nullable private Boolean preserveOriginal; /** @@ -141,9 +147,9 @@ public final Builder patterns(String value, String... values) { } /** - * Required - API name: {@code preserve_original} + * API name: {@code preserve_original} */ - public final Builder preserveOriginal(boolean value) { + public final Builder preserveOriginal(@Nullable Boolean value) { this.preserveOriginal = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/PatternReplaceTokenFilter.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/PatternReplaceTokenFilter.java index c5f92cb04..81778fbc4 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/PatternReplaceTokenFilter.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/PatternReplaceTokenFilter.java @@ -31,6 +31,7 @@ import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; import java.lang.String; import java.util.Objects; import java.util.function.Function; @@ -46,10 +47,15 @@ */ @JsonpDeserializable public class PatternReplaceTokenFilter extends TokenFilterBase implements TokenFilterDefinitionVariant { + @Nullable + private final Boolean all; + + @Nullable private final String flags; private final String pattern; + @Nullable private final String replacement; // --------------------------------------------------------------------------------------------- @@ -57,9 +63,10 @@ public class PatternReplaceTokenFilter extends TokenFilterBase implements TokenF private PatternReplaceTokenFilter(Builder builder) { super(builder); - this.flags = ApiTypeHelper.requireNonNull(builder.flags, this, "flags"); + this.all = builder.all; + this.flags = builder.flags; this.pattern = ApiTypeHelper.requireNonNull(builder.pattern, this, "pattern"); - this.replacement = ApiTypeHelper.requireNonNull(builder.replacement, this, "replacement"); + this.replacement = builder.replacement; } @@ -76,8 +83,17 @@ public TokenFilterDefinition.Kind _tokenFilterDefinitionKind() { } /** - * Required - API name: {@code flags} + * API name: {@code all} + */ + @Nullable + public final Boolean all() { + return this.all; + } + + /** + * API name: {@code flags} */ + @Nullable public final String flags() { return this.flags; } @@ -90,8 +106,9 @@ public final String pattern() { } /** - * Required - API name: {@code replacement} + * API name: {@code replacement} */ + @Nullable public final String replacement() { return this.replacement; } @@ -100,14 +117,24 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write("type", "pattern_replace"); super.serializeInternal(generator, mapper); - generator.writeKey("flags"); - generator.write(this.flags); + if (this.all != null) { + generator.writeKey("all"); + generator.write(this.all); + + } + if (this.flags != null) { + generator.writeKey("flags"); + generator.write(this.flags); + } generator.writeKey("pattern"); generator.write(this.pattern); - generator.writeKey("replacement"); - generator.write(this.replacement); + if (this.replacement != null) { + generator.writeKey("replacement"); + generator.write(this.replacement); + + } } @@ -120,16 +147,29 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends TokenFilterBase.AbstractBuilder implements ObjectBuilder { + @Nullable + private Boolean all; + + @Nullable private String flags; private String pattern; + @Nullable private String replacement; /** - * Required - API name: {@code flags} + * API name: {@code all} + */ + public final Builder all(@Nullable Boolean value) { + this.all = value; + return this; + } + + /** + * API name: {@code flags} */ - public final Builder flags(String value) { + public final Builder flags(@Nullable String value) { this.flags = value; return this; } @@ -143,9 +183,9 @@ public final Builder pattern(String value) { } /** - * Required - API name: {@code replacement} + * API name: {@code replacement} */ - public final Builder replacement(String value) { + public final Builder replacement(@Nullable String value) { this.replacement = value; return this; } @@ -179,6 +219,7 @@ public PatternReplaceTokenFilter build() { protected static void setupPatternReplaceTokenFilterDeserializer( ObjectDeserializer op) { TokenFilterBase.setupTokenFilterBaseDeserializer(op); + op.add(Builder::all, JsonpDeserializer.booleanDeserializer(), "all"); op.add(Builder::flags, JsonpDeserializer.stringDeserializer(), "flags"); op.add(Builder::pattern, JsonpDeserializer.stringDeserializer(), "pattern"); op.add(Builder::replacement, JsonpDeserializer.stringDeserializer(), "replacement"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/StopTokenFilter.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/StopTokenFilter.java index e62c3c906..ddde59ea0 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/StopTokenFilter.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/StopTokenFilter.java @@ -66,7 +66,7 @@ private StopTokenFilter(Builder builder) { this.ignoreCase = builder.ignoreCase; this.removeTrailing = builder.removeTrailing; - this.stopwords = ApiTypeHelper.unmodifiableRequired(builder.stopwords, this, "stopwords"); + this.stopwords = ApiTypeHelper.unmodifiable(builder.stopwords); this.stopwordsPath = builder.stopwordsPath; } @@ -100,7 +100,7 @@ public final Boolean removeTrailing() { } /** - * Required - API name: {@code stopwords} + * API name: {@code stopwords} */ public final List stopwords() { return this.stopwords; @@ -161,6 +161,7 @@ public static class Builder extends TokenFilterBase.AbstractBuilder @Nullable private Boolean removeTrailing; + @Nullable private List stopwords; @Nullable @@ -183,7 +184,7 @@ public final Builder removeTrailing(@Nullable Boolean value) { } /** - * Required - API name: {@code stopwords} + * API name: {@code stopwords} *

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

* Adds one or more values to stopwords. */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/TruncateTokenFilter.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/TruncateTokenFilter.java index a80a50148..c297f59f1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/TruncateTokenFilter.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/TruncateTokenFilter.java @@ -28,12 +28,12 @@ import co.elastic.clients.json.JsonpMapper; 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 jakarta.json.stream.JsonGenerator; import java.lang.Integer; import java.util.Objects; import java.util.function.Function; +import javax.annotation.Nullable; // typedef: _types.analysis.TruncateTokenFilter @@ -45,14 +45,15 @@ */ @JsonpDeserializable public class TruncateTokenFilter extends TokenFilterBase implements TokenFilterDefinitionVariant { - private final int length; + @Nullable + private final Integer length; // --------------------------------------------------------------------------------------------- private TruncateTokenFilter(Builder builder) { super(builder); - this.length = ApiTypeHelper.requireNonNull(builder.length, this, "length"); + this.length = builder.length; } @@ -69,9 +70,10 @@ public TokenFilterDefinition.Kind _tokenFilterDefinitionKind() { } /** - * Required - API name: {@code length} + * API name: {@code length} */ - public final int length() { + @Nullable + public final Integer length() { return this.length; } @@ -79,8 +81,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write("type", "truncate"); super.serializeInternal(generator, mapper); - generator.writeKey("length"); - generator.write(this.length); + if (this.length != null) { + generator.writeKey("length"); + generator.write(this.length); + + } } @@ -93,12 +98,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends TokenFilterBase.AbstractBuilder implements ObjectBuilder { + @Nullable private Integer length; /** - * Required - API name: {@code length} + * API name: {@code length} */ - public final Builder length(int value) { + public final Builder length(@Nullable Integer value) { this.length = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/GeoShapeProperty.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/GeoShapeProperty.java index 0d3e03d1e..1fcb62697 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/GeoShapeProperty.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/GeoShapeProperty.java @@ -42,7 +42,7 @@ * searching with arbitrary geo shapes such as rectangles and polygons. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/geo-shape.html">Documentation * on elastic.co * @see API diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/ShapeProperty.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/ShapeProperty.java index dc64a900a..85d54edd8 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/ShapeProperty.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/ShapeProperty.java @@ -43,7 +43,7 @@ * polygons. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/shape.html">Documentation * on elastic.co * @see API * specification diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/Like.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/Like.java index 27a16e4c2..17b187c2d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/Like.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/Like.java @@ -49,7 +49,7 @@ * the text. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/query-dsl-mlt-query.html#_document_input_parameters">Documentation * on elastic.co * @see API * specification diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/Query.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/Query.java index 3b677aadf..6c8b16238 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/Query.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/Query.java @@ -49,7 +49,7 @@ /** * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/query-dsl.html">Documentation * on elastic.co * @see API diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/SimpleQueryStringFlags.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/SimpleQueryStringFlags.java index 256fd6002..65e298451 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/SimpleQueryStringFlags.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/SimpleQueryStringFlags.java @@ -49,7 +49,7 @@ * OR|AND|PREFIX * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/query-dsl-simple-query-string-query.html#supported-flags">Documentation * on elastic.co * @see API diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/AsyncSearchResponseBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/AsyncSearchResponseBase.java index 2d51cafe8..5022fd8d1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/AsyncSearchResponseBase.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/AsyncSearchResponseBase.java @@ -36,6 +36,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.Objects; import javax.annotation.Nullable; @@ -57,9 +58,15 @@ public abstract class AsyncSearchResponseBase implements JsonpSerializable { private final boolean isRunning; - private final DateTime expirationTimeInMillis; + @Nullable + private final DateTime expirationTime; + + private final long expirationTimeInMillis; + + @Nullable + private final DateTime startTime; - private final DateTime startTimeInMillis; + private final long startTimeInMillis; // --------------------------------------------------------------------------------------------- @@ -68,8 +75,10 @@ protected AsyncSearchResponseBase(AbstractBuilder builder) { this.id = builder.id; this.isPartial = ApiTypeHelper.requireNonNull(builder.isPartial, this, "isPartial"); this.isRunning = ApiTypeHelper.requireNonNull(builder.isRunning, this, "isRunning"); + this.expirationTime = builder.expirationTime; this.expirationTimeInMillis = ApiTypeHelper.requireNonNull(builder.expirationTimeInMillis, this, "expirationTimeInMillis"); + this.startTime = builder.startTime; this.startTimeInMillis = ApiTypeHelper.requireNonNull(builder.startTimeInMillis, this, "startTimeInMillis"); } @@ -96,17 +105,33 @@ public final boolean isRunning() { return this.isRunning; } + /** + * API name: {@code expiration_time} + */ + @Nullable + public final DateTime expirationTime() { + return this.expirationTime; + } + /** * Required - API name: {@code expiration_time_in_millis} */ - public final DateTime expirationTimeInMillis() { + public final long expirationTimeInMillis() { return this.expirationTimeInMillis; } + /** + * API name: {@code start_time} + */ + @Nullable + public final DateTime startTime() { + return this.startTime; + } + /** * Required - API name: {@code start_time_in_millis} */ - public final DateTime startTimeInMillis() { + public final long startTimeInMillis() { return this.startTimeInMillis; } @@ -132,10 +157,19 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("is_running"); generator.write(this.isRunning); + if (this.expirationTime != null) { + generator.writeKey("expiration_time"); + this.expirationTime.serialize(generator, mapper); + } generator.writeKey("expiration_time_in_millis"); - this.expirationTimeInMillis.serialize(generator, mapper); + generator.write(this.expirationTimeInMillis); + + if (this.startTime != null) { + generator.writeKey("start_time"); + this.startTime.serialize(generator, mapper); + } generator.writeKey("start_time_in_millis"); - this.startTimeInMillis.serialize(generator, mapper); + generator.write(this.startTimeInMillis); } @@ -154,9 +188,15 @@ protected abstract static class AbstractBuilder> void setupAsyncSea op.add(AbstractBuilder::id, JsonpDeserializer.stringDeserializer(), "id"); op.add(AbstractBuilder::isPartial, JsonpDeserializer.booleanDeserializer(), "is_partial"); op.add(AbstractBuilder::isRunning, JsonpDeserializer.booleanDeserializer(), "is_running"); - op.add(AbstractBuilder::expirationTimeInMillis, DateTime._DESERIALIZER, "expiration_time_in_millis"); - op.add(AbstractBuilder::startTimeInMillis, DateTime._DESERIALIZER, "start_time_in_millis"); + op.add(AbstractBuilder::expirationTime, DateTime._DESERIALIZER, "expiration_time"); + op.add(AbstractBuilder::expirationTimeInMillis, JsonpDeserializer.longDeserializer(), + "expiration_time_in_millis"); + op.add(AbstractBuilder::startTime, DateTime._DESERIALIZER, "start_time"); + op.add(AbstractBuilder::startTimeInMillis, JsonpDeserializer.longDeserializer(), "start_time_in_millis"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/ElasticsearchAsyncSearchAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/ElasticsearchAsyncSearchAsyncClient.java index 980c2de33..7ff49e4e6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/ElasticsearchAsyncSearchAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/ElasticsearchAsyncSearchAsyncClient.java @@ -64,7 +64,7 @@ public ElasticsearchAsyncSearchAsyncClient withTransportOptions(@Nullable Transp * request will be cancelled. Otherwise, the saved search results are deleted. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/async-search.html">Documentation * on elastic.co */ @@ -83,7 +83,7 @@ public CompletableFuture delete(DeleteAsyncSearchRequ * a function that initializes a builder to create the * {@link DeleteAsyncSearchRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/async-search.html">Documentation * on elastic.co */ @@ -99,7 +99,7 @@ public final CompletableFuture delete( * its ID. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/async-search.html">Documentation * on elastic.co */ @@ -121,7 +121,7 @@ public CompletableFuture> get(GetA * a function that initializes a builder to create the * {@link GetAsyncSearchRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/async-search.html">Documentation * on elastic.co */ @@ -138,7 +138,7 @@ public final CompletableFuture> ge * ID. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/async-search.html">Documentation * on elastic.co */ @@ -157,7 +157,7 @@ public CompletableFuture status(AsyncSearchStatusRequ * a function that initializes a builder to create the * {@link AsyncSearchStatusRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/async-search.html">Documentation * on elastic.co */ @@ -172,7 +172,7 @@ public final CompletableFuture status( * Executes a search request asynchronously. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/async-search.html">Documentation * on elastic.co */ @@ -193,7 +193,7 @@ public CompletableFuture> submit(SubmitReq * a function that initializes a builder to create the * {@link SubmitRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/async-search.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/ElasticsearchAsyncSearchClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/ElasticsearchAsyncSearchClient.java index 3581bca69..52e81655b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/ElasticsearchAsyncSearchClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/ElasticsearchAsyncSearchClient.java @@ -63,7 +63,7 @@ public ElasticsearchAsyncSearchClient withTransportOptions(@Nullable TransportOp * request will be cancelled. Otherwise, the saved search results are deleted. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/async-search.html">Documentation * on elastic.co */ @@ -83,7 +83,7 @@ public DeleteAsyncSearchResponse delete(DeleteAsyncSearchRequest request) * a function that initializes a builder to create the * {@link DeleteAsyncSearchRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/async-search.html">Documentation * on elastic.co */ @@ -100,7 +100,7 @@ public final DeleteAsyncSearchResponse delete( * its ID. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/async-search.html">Documentation * on elastic.co */ @@ -122,7 +122,7 @@ public GetAsyncSearchResponse get(GetAsyncSearchRequest r * a function that initializes a builder to create the * {@link GetAsyncSearchRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/async-search.html">Documentation * on elastic.co */ @@ -139,7 +139,7 @@ public final GetAsyncSearchResponse get( * ID. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/async-search.html">Documentation * on elastic.co */ @@ -159,7 +159,7 @@ public AsyncSearchStatusResponse status(AsyncSearchStatusRequest request) * a function that initializes a builder to create the * {@link AsyncSearchStatusRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/async-search.html">Documentation * on elastic.co */ @@ -175,7 +175,7 @@ public final AsyncSearchStatusResponse status( * Executes a search request asynchronously. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/async-search.html">Documentation * on elastic.co */ @@ -196,7 +196,7 @@ public SubmitResponse submit(SubmitRequest request, Class * a function that initializes a builder to create the * {@link SubmitRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/async-search.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/ElasticsearchAutoscalingAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/ElasticsearchAutoscalingAsyncClient.java index 12a8a7564..315baee27 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/ElasticsearchAutoscalingAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/ElasticsearchAutoscalingAsyncClient.java @@ -63,7 +63,7 @@ public ElasticsearchAutoscalingAsyncClient withTransportOptions(@Nullable Transp * Direct use is not supported. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/autoscaling-delete-autoscaling-policy.html">Documentation * on elastic.co */ @@ -83,7 +83,7 @@ public CompletableFuture deleteAutoscalingPolic * a function that initializes a builder to create the * {@link DeleteAutoscalingPolicyRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/autoscaling-delete-autoscaling-policy.html">Documentation * on elastic.co */ @@ -100,7 +100,7 @@ public final CompletableFuture deleteAutoscalin * supported. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/autoscaling-get-autoscaling-capacity.html">Documentation * on elastic.co */ public CompletableFuture getAutoscalingCapacity() { @@ -115,7 +115,7 @@ public CompletableFuture getAutoscalingCapacity( * ECK. Direct use is not supported. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/autoscaling-get-autoscaling-capacity.html">Documentation * on elastic.co */ @@ -134,7 +134,7 @@ public CompletableFuture getAutoscalingPolicy(GetA * a function that initializes a builder to create the * {@link GetAutoscalingPolicyRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/autoscaling-get-autoscaling-capacity.html">Documentation * on elastic.co */ @@ -150,7 +150,7 @@ public final CompletableFuture getAutoscalingPolic * ECK. Direct use is not supported. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/autoscaling-put-autoscaling-policy.html">Documentation * on elastic.co */ @@ -169,7 +169,7 @@ public CompletableFuture putAutoscalingPolicy(PutA * a function that initializes a builder to create the * {@link PutAutoscalingPolicyRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/autoscaling-put-autoscaling-policy.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/ElasticsearchAutoscalingClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/ElasticsearchAutoscalingClient.java index 5650defec..3e1f3e607 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/ElasticsearchAutoscalingClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/ElasticsearchAutoscalingClient.java @@ -62,7 +62,7 @@ public ElasticsearchAutoscalingClient withTransportOptions(@Nullable TransportOp * Direct use is not supported. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/autoscaling-delete-autoscaling-policy.html">Documentation * on elastic.co */ @@ -82,7 +82,7 @@ public DeleteAutoscalingPolicyResponse deleteAutoscalingPolicy(DeleteAutoscaling * a function that initializes a builder to create the * {@link DeleteAutoscalingPolicyRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/autoscaling-delete-autoscaling-policy.html">Documentation * on elastic.co */ @@ -100,7 +100,7 @@ public final DeleteAutoscalingPolicyResponse deleteAutoscalingPolicy( * supported. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/autoscaling-get-autoscaling-capacity.html">Documentation * on elastic.co */ public GetAutoscalingCapacityResponse getAutoscalingCapacity() throws IOException, ElasticsearchException { @@ -115,7 +115,7 @@ public GetAutoscalingCapacityResponse getAutoscalingCapacity() throws IOExceptio * ECK. Direct use is not supported. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/autoscaling-get-autoscaling-capacity.html">Documentation * on elastic.co */ @@ -135,7 +135,7 @@ public GetAutoscalingPolicyResponse getAutoscalingPolicy(GetAutoscalingPolicyReq * a function that initializes a builder to create the * {@link GetAutoscalingPolicyRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/autoscaling-get-autoscaling-capacity.html">Documentation * on elastic.co */ @@ -152,7 +152,7 @@ public final GetAutoscalingPolicyResponse getAutoscalingPolicy( * ECK. Direct use is not supported. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/autoscaling-put-autoscaling-policy.html">Documentation * on elastic.co */ @@ -172,7 +172,7 @@ public PutAutoscalingPolicyResponse putAutoscalingPolicy(PutAutoscalingPolicyReq * a function that initializes a builder to create the * {@link PutAutoscalingPolicyRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/autoscaling-put-autoscaling-policy.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ElasticsearchCatAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ElasticsearchCatAsyncClient.java index 373213ee1..3b54cb6fa 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ElasticsearchCatAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ElasticsearchCatAsyncClient.java @@ -60,7 +60,7 @@ public ElasticsearchCatAsyncClient withTransportOptions(@Nullable TransportOptio * filter and routing infos. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-alias.html">Documentation * on elastic.co */ @@ -79,7 +79,7 @@ public CompletableFuture aliases(AliasesRequest request) { * a function that initializes a builder to create the * {@link AliasesRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-alias.html">Documentation * on elastic.co */ @@ -93,7 +93,7 @@ public final CompletableFuture aliases( * filter and routing infos. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-alias.html">Documentation * on elastic.co */ @@ -109,7 +109,7 @@ public CompletableFuture aliases() { * how much disk space they are using. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-allocation.html">Documentation * on elastic.co */ @@ -128,7 +128,7 @@ public CompletableFuture allocation(AllocationRequest reques * a function that initializes a builder to create the * {@link AllocationRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-allocation.html">Documentation * on elastic.co */ @@ -142,7 +142,7 @@ public final CompletableFuture allocation( * how much disk space they are using. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-allocation.html">Documentation * on elastic.co */ @@ -204,7 +204,7 @@ public CompletableFuture componentTemplates() { * individual indices. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-count.html">Documentation * on elastic.co */ @@ -223,7 +223,7 @@ public CompletableFuture count(CountRequest request) { * a function that initializes a builder to create the * {@link CountRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-count.html">Documentation * on elastic.co */ @@ -237,7 +237,7 @@ public final CompletableFuture count( * individual indices. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-count.html">Documentation * on elastic.co */ @@ -253,7 +253,7 @@ public CompletableFuture count() { * node in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-fielddata.html">Documentation * on elastic.co */ @@ -272,7 +272,7 @@ public CompletableFuture fielddata(FielddataRequest request) * a function that initializes a builder to create the * {@link FielddataRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-fielddata.html">Documentation * on elastic.co */ @@ -286,7 +286,7 @@ public final CompletableFuture fielddata( * node in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-fielddata.html">Documentation * on elastic.co */ @@ -301,7 +301,7 @@ public CompletableFuture fielddata() { * Returns a concise representation of the cluster health. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-health.html">Documentation * on elastic.co */ @@ -319,7 +319,7 @@ public CompletableFuture health(HealthRequest request) { * a function that initializes a builder to create the * {@link HealthRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-health.html">Documentation * on elastic.co */ @@ -332,7 +332,7 @@ public final CompletableFuture health( * Returns a concise representation of the cluster health. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-health.html">Documentation * on elastic.co */ @@ -347,7 +347,7 @@ public CompletableFuture health() { * Returns help for the Cat APIs. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat.html">Documentation * on elastic.co */ public CompletableFuture help() { @@ -361,7 +361,7 @@ public CompletableFuture help() { * counts, disk size, ... * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-indices.html">Documentation * on elastic.co */ @@ -380,7 +380,7 @@ public CompletableFuture indices(IndicesRequest request) { * a function that initializes a builder to create the * {@link IndicesRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-indices.html">Documentation * on elastic.co */ @@ -394,7 +394,7 @@ public final CompletableFuture indices( * counts, disk size, ... * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-indices.html">Documentation * on elastic.co */ @@ -409,7 +409,7 @@ public CompletableFuture indices() { * Returns information about the master node. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-master.html">Documentation * on elastic.co */ public CompletableFuture master() { @@ -423,7 +423,7 @@ public CompletableFuture master() { * Gets configuration and usage information about data frame analytics jobs. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-dfanalytics.html">Documentation * on elastic.co */ @@ -441,7 +441,7 @@ public CompletableFuture mlDataFrameAnalytics(MlDa * a function that initializes a builder to create the * {@link MlDataFrameAnalyticsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-dfanalytics.html">Documentation * on elastic.co */ @@ -454,7 +454,7 @@ public final CompletableFuture mlDataFrameAnalytic * Gets configuration and usage information about data frame analytics jobs. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-dfanalytics.html">Documentation * on elastic.co */ @@ -469,7 +469,7 @@ public CompletableFuture mlDataFrameAnalytics() { * Gets configuration and usage information about datafeeds. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-datafeeds.html">Documentation * on elastic.co */ @@ -487,7 +487,7 @@ public CompletableFuture mlDatafeeds(MlDatafeedsRequest req * a function that initializes a builder to create the * {@link MlDatafeedsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-datafeeds.html">Documentation * on elastic.co */ @@ -500,7 +500,7 @@ public final CompletableFuture mlDatafeeds( * Gets configuration and usage information about datafeeds. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-datafeeds.html">Documentation * on elastic.co */ @@ -515,7 +515,7 @@ public CompletableFuture mlDatafeeds() { * Gets configuration and usage information about anomaly detection jobs. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-anomaly-detectors.html">Documentation * on elastic.co */ @@ -533,7 +533,7 @@ public CompletableFuture mlJobs(MlJobsRequest request) { * a function that initializes a builder to create the * {@link MlJobsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-anomaly-detectors.html">Documentation * on elastic.co */ @@ -546,7 +546,7 @@ public final CompletableFuture mlJobs( * Gets configuration and usage information about anomaly detection jobs. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-anomaly-detectors.html">Documentation * on elastic.co */ @@ -561,7 +561,7 @@ public CompletableFuture mlJobs() { * Gets configuration and usage information about inference trained models. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-trained-model.html">Documentation * on elastic.co */ @@ -579,7 +579,7 @@ public CompletableFuture mlTrainedModels(MlTrainedModel * a function that initializes a builder to create the * {@link MlTrainedModelsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-trained-model.html">Documentation * on elastic.co */ @@ -592,7 +592,7 @@ public final CompletableFuture mlTrainedModels( * Gets configuration and usage information about inference trained models. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-trained-model.html">Documentation * on elastic.co */ @@ -607,7 +607,7 @@ public CompletableFuture mlTrainedModels() { * Returns information about custom node attributes. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-nodeattrs.html">Documentation * on elastic.co */ public CompletableFuture nodeattrs() { @@ -621,7 +621,7 @@ public CompletableFuture nodeattrs() { * Returns basic statistics about performance of cluster nodes. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-nodes.html">Documentation * on elastic.co */ @@ -639,7 +639,7 @@ public CompletableFuture nodes(NodesRequest request) { * a function that initializes a builder to create the * {@link NodesRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-nodes.html">Documentation * on elastic.co */ @@ -652,7 +652,7 @@ public final CompletableFuture nodes( * Returns basic statistics about performance of cluster nodes. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-nodes.html">Documentation * on elastic.co */ @@ -667,7 +667,7 @@ public CompletableFuture nodes() { * Returns a concise representation of the cluster pending tasks. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-pending-tasks.html">Documentation * on elastic.co */ public CompletableFuture pendingTasks() { @@ -681,7 +681,7 @@ public CompletableFuture pendingTasks() { * Returns information about installed plugins across nodes node. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-plugins.html">Documentation * on elastic.co */ public CompletableFuture plugins() { @@ -695,7 +695,7 @@ public CompletableFuture plugins() { * Returns information about index shard recoveries, both on-going completed. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-recovery.html">Documentation * on elastic.co */ @@ -713,7 +713,7 @@ public CompletableFuture recovery(RecoveryRequest request) { * a function that initializes a builder to create the * {@link RecoveryRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-recovery.html">Documentation * on elastic.co */ @@ -726,7 +726,7 @@ public final CompletableFuture recovery( * Returns information about index shard recoveries, both on-going completed. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-recovery.html">Documentation * on elastic.co */ @@ -741,7 +741,7 @@ public CompletableFuture recovery() { * Returns information about snapshot repositories registered in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-repositories.html">Documentation * on elastic.co */ public CompletableFuture repositories() { @@ -755,7 +755,7 @@ public CompletableFuture repositories() { * Provides low-level information about the segments in the shards of an index. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-segments.html">Documentation * on elastic.co */ @@ -773,7 +773,7 @@ public CompletableFuture segments(SegmentsRequest request) { * a function that initializes a builder to create the * {@link SegmentsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-segments.html">Documentation * on elastic.co */ @@ -786,7 +786,7 @@ public final CompletableFuture segments( * Provides low-level information about the segments in the shards of an index. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-segments.html">Documentation * on elastic.co */ @@ -801,7 +801,7 @@ public CompletableFuture segments() { * Provides a detailed view of shard allocation on nodes. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-shards.html">Documentation * on elastic.co */ @@ -819,7 +819,7 @@ public CompletableFuture shards(ShardsRequest request) { * a function that initializes a builder to create the * {@link ShardsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-shards.html">Documentation * on elastic.co */ @@ -832,7 +832,7 @@ public final CompletableFuture shards( * Provides a detailed view of shard allocation on nodes. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-shards.html">Documentation * on elastic.co */ @@ -847,7 +847,7 @@ public CompletableFuture shards() { * Returns all snapshots in a specific repository. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-snapshots.html">Documentation * on elastic.co */ @@ -865,7 +865,7 @@ public CompletableFuture snapshots(SnapshotsRequest request) * a function that initializes a builder to create the * {@link SnapshotsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-snapshots.html">Documentation * on elastic.co */ @@ -878,7 +878,7 @@ public final CompletableFuture snapshots( * Returns all snapshots in a specific repository. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-snapshots.html">Documentation * on elastic.co */ @@ -894,7 +894,7 @@ public CompletableFuture snapshots() { * in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -913,7 +913,7 @@ public CompletableFuture tasks(TasksRequest request) { * a function that initializes a builder to create the * {@link TasksRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -927,7 +927,7 @@ public final CompletableFuture tasks( * in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -942,7 +942,7 @@ public CompletableFuture tasks() { * Returns information about existing templates. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-templates.html">Documentation * on elastic.co */ @@ -960,7 +960,7 @@ public CompletableFuture templates(TemplatesRequest request) * a function that initializes a builder to create the * {@link TemplatesRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-templates.html">Documentation * on elastic.co */ @@ -973,7 +973,7 @@ public final CompletableFuture templates( * Returns information about existing templates. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-templates.html">Documentation * on elastic.co */ @@ -989,7 +989,7 @@ public CompletableFuture templates() { * queue and rejected statistics are returned for all thread pools. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-thread-pool.html">Documentation * on elastic.co */ @@ -1008,7 +1008,7 @@ public CompletableFuture threadPool(ThreadPoolRequest reques * a function that initializes a builder to create the * {@link ThreadPoolRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-thread-pool.html">Documentation * on elastic.co */ @@ -1022,7 +1022,7 @@ public final CompletableFuture threadPool( * queue and rejected statistics are returned for all thread pools. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-thread-pool.html">Documentation * on elastic.co */ @@ -1037,7 +1037,7 @@ public CompletableFuture threadPool() { * Gets configuration and usage information about transforms. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-transforms.html">Documentation * on elastic.co */ @@ -1055,7 +1055,7 @@ public CompletableFuture transforms(TransformsRequest reques * a function that initializes a builder to create the * {@link TransformsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-transforms.html">Documentation * on elastic.co */ @@ -1068,7 +1068,7 @@ public final CompletableFuture transforms( * Gets configuration and usage information about transforms. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-transforms.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ElasticsearchCatClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ElasticsearchCatClient.java index fd669672b..0542a5525 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ElasticsearchCatClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ElasticsearchCatClient.java @@ -61,7 +61,7 @@ public ElasticsearchCatClient withTransportOptions(@Nullable TransportOptions tr * filter and routing infos. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-alias.html">Documentation * on elastic.co */ @@ -80,7 +80,7 @@ public AliasesResponse aliases(AliasesRequest request) throws IOException, Elast * a function that initializes a builder to create the * {@link AliasesRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-alias.html">Documentation * on elastic.co */ @@ -94,7 +94,7 @@ public final AliasesResponse aliases(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-alias.html">Documentation * on elastic.co */ @@ -110,7 +110,7 @@ public AliasesResponse aliases() throws IOException, ElasticsearchException { * how much disk space they are using. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-allocation.html">Documentation * on elastic.co */ @@ -129,7 +129,7 @@ public AllocationResponse allocation(AllocationRequest request) throws IOExcepti * a function that initializes a builder to create the * {@link AllocationRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-allocation.html">Documentation * on elastic.co */ @@ -143,7 +143,7 @@ public final AllocationResponse allocation(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-allocation.html">Documentation * on elastic.co */ @@ -207,7 +207,7 @@ public ComponentTemplatesResponse componentTemplates() throws IOException, Elast * individual indices. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-count.html">Documentation * on elastic.co */ @@ -226,7 +226,7 @@ public CountResponse count(CountRequest request) throws IOException, Elasticsear * a function that initializes a builder to create the * {@link CountRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-count.html">Documentation * on elastic.co */ @@ -240,7 +240,7 @@ public final CountResponse count(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-count.html">Documentation * on elastic.co */ @@ -256,7 +256,7 @@ public CountResponse count() throws IOException, ElasticsearchException { * node in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-fielddata.html">Documentation * on elastic.co */ @@ -275,7 +275,7 @@ public FielddataResponse fielddata(FielddataRequest request) throws IOException, * a function that initializes a builder to create the * {@link FielddataRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-fielddata.html">Documentation * on elastic.co */ @@ -289,7 +289,7 @@ public final FielddataResponse fielddata(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-fielddata.html">Documentation * on elastic.co */ @@ -304,7 +304,7 @@ public FielddataResponse fielddata() throws IOException, ElasticsearchException * Returns a concise representation of the cluster health. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-health.html">Documentation * on elastic.co */ @@ -322,7 +322,7 @@ public HealthResponse health(HealthRequest request) throws IOException, Elastics * a function that initializes a builder to create the * {@link HealthRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-health.html">Documentation * on elastic.co */ @@ -335,7 +335,7 @@ public final HealthResponse health(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-health.html">Documentation * on elastic.co */ @@ -350,7 +350,7 @@ public HealthResponse health() throws IOException, ElasticsearchException { * Returns help for the Cat APIs. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat.html">Documentation * on elastic.co */ public HelpResponse help() throws IOException, ElasticsearchException { @@ -364,7 +364,7 @@ public HelpResponse help() throws IOException, ElasticsearchException { * counts, disk size, ... * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-indices.html">Documentation * on elastic.co */ @@ -383,7 +383,7 @@ public IndicesResponse indices(IndicesRequest request) throws IOException, Elast * a function that initializes a builder to create the * {@link IndicesRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-indices.html">Documentation * on elastic.co */ @@ -397,7 +397,7 @@ public final IndicesResponse indices(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-indices.html">Documentation * on elastic.co */ @@ -412,7 +412,7 @@ public IndicesResponse indices() throws IOException, ElasticsearchException { * Returns information about the master node. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-master.html">Documentation * on elastic.co */ public MasterResponse master() throws IOException, ElasticsearchException { @@ -425,7 +425,7 @@ public MasterResponse master() throws IOException, ElasticsearchException { * Gets configuration and usage information about data frame analytics jobs. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-dfanalytics.html">Documentation * on elastic.co */ @@ -444,7 +444,7 @@ public MlDataFrameAnalyticsResponse mlDataFrameAnalytics(MlDataFrameAnalyticsReq * a function that initializes a builder to create the * {@link MlDataFrameAnalyticsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-dfanalytics.html">Documentation * on elastic.co */ @@ -458,7 +458,7 @@ public final MlDataFrameAnalyticsResponse mlDataFrameAnalytics( * Gets configuration and usage information about data frame analytics jobs. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-dfanalytics.html">Documentation * on elastic.co */ @@ -473,7 +473,7 @@ public MlDataFrameAnalyticsResponse mlDataFrameAnalytics() throws IOException, E * Gets configuration and usage information about datafeeds. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-datafeeds.html">Documentation * on elastic.co */ @@ -491,7 +491,7 @@ public MlDatafeedsResponse mlDatafeeds(MlDatafeedsRequest request) throws IOExce * a function that initializes a builder to create the * {@link MlDatafeedsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-datafeeds.html">Documentation * on elastic.co */ @@ -505,7 +505,7 @@ public final MlDatafeedsResponse mlDatafeeds( * Gets configuration and usage information about datafeeds. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-datafeeds.html">Documentation * on elastic.co */ @@ -520,7 +520,7 @@ public MlDatafeedsResponse mlDatafeeds() throws IOException, ElasticsearchExcept * Gets configuration and usage information about anomaly detection jobs. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-anomaly-detectors.html">Documentation * on elastic.co */ @@ -538,7 +538,7 @@ public MlJobsResponse mlJobs(MlJobsRequest request) throws IOException, Elastics * a function that initializes a builder to create the * {@link MlJobsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-anomaly-detectors.html">Documentation * on elastic.co */ @@ -551,7 +551,7 @@ public final MlJobsResponse mlJobs(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-anomaly-detectors.html">Documentation * on elastic.co */ @@ -566,7 +566,7 @@ public MlJobsResponse mlJobs() throws IOException, ElasticsearchException { * Gets configuration and usage information about inference trained models. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-trained-model.html">Documentation * on elastic.co */ @@ -585,7 +585,7 @@ public MlTrainedModelsResponse mlTrainedModels(MlTrainedModelsRequest request) * a function that initializes a builder to create the * {@link MlTrainedModelsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-trained-model.html">Documentation * on elastic.co */ @@ -599,7 +599,7 @@ public final MlTrainedModelsResponse mlTrainedModels( * Gets configuration and usage information about inference trained models. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-trained-model.html">Documentation * on elastic.co */ @@ -614,7 +614,7 @@ public MlTrainedModelsResponse mlTrainedModels() throws IOException, Elasticsear * Returns information about custom node attributes. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-nodeattrs.html">Documentation * on elastic.co */ public NodeattrsResponse nodeattrs() throws IOException, ElasticsearchException { @@ -628,7 +628,7 @@ public NodeattrsResponse nodeattrs() throws IOException, ElasticsearchException * Returns basic statistics about performance of cluster nodes. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-nodes.html">Documentation * on elastic.co */ @@ -646,7 +646,7 @@ public NodesResponse nodes(NodesRequest request) throws IOException, Elasticsear * a function that initializes a builder to create the * {@link NodesRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-nodes.html">Documentation * on elastic.co */ @@ -659,7 +659,7 @@ public final NodesResponse nodes(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-nodes.html">Documentation * on elastic.co */ @@ -674,7 +674,7 @@ public NodesResponse nodes() throws IOException, ElasticsearchException { * Returns a concise representation of the cluster pending tasks. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-pending-tasks.html">Documentation * on elastic.co */ public PendingTasksResponse pendingTasks() throws IOException, ElasticsearchException { @@ -688,7 +688,7 @@ public PendingTasksResponse pendingTasks() throws IOException, ElasticsearchExce * Returns information about installed plugins across nodes node. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-plugins.html">Documentation * on elastic.co */ public PluginsResponse plugins() throws IOException, ElasticsearchException { @@ -701,7 +701,7 @@ public PluginsResponse plugins() throws IOException, ElasticsearchException { * Returns information about index shard recoveries, both on-going completed. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-recovery.html">Documentation * on elastic.co */ @@ -719,7 +719,7 @@ public RecoveryResponse recovery(RecoveryRequest request) throws IOException, El * a function that initializes a builder to create the * {@link RecoveryRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-recovery.html">Documentation * on elastic.co */ @@ -732,7 +732,7 @@ public final RecoveryResponse recovery(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-recovery.html">Documentation * on elastic.co */ @@ -747,7 +747,7 @@ public RecoveryResponse recovery() throws IOException, ElasticsearchException { * Returns information about snapshot repositories registered in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-repositories.html">Documentation * on elastic.co */ public RepositoriesResponse repositories() throws IOException, ElasticsearchException { @@ -761,7 +761,7 @@ public RepositoriesResponse repositories() throws IOException, ElasticsearchExce * Provides low-level information about the segments in the shards of an index. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-segments.html">Documentation * on elastic.co */ @@ -779,7 +779,7 @@ public SegmentsResponse segments(SegmentsRequest request) throws IOException, El * a function that initializes a builder to create the * {@link SegmentsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-segments.html">Documentation * on elastic.co */ @@ -792,7 +792,7 @@ public final SegmentsResponse segments(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-segments.html">Documentation * on elastic.co */ @@ -807,7 +807,7 @@ public SegmentsResponse segments() throws IOException, ElasticsearchException { * Provides a detailed view of shard allocation on nodes. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-shards.html">Documentation * on elastic.co */ @@ -825,7 +825,7 @@ public ShardsResponse shards(ShardsRequest request) throws IOException, Elastics * a function that initializes a builder to create the * {@link ShardsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-shards.html">Documentation * on elastic.co */ @@ -838,7 +838,7 @@ public final ShardsResponse shards(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-shards.html">Documentation * on elastic.co */ @@ -853,7 +853,7 @@ public ShardsResponse shards() throws IOException, ElasticsearchException { * Returns all snapshots in a specific repository. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-snapshots.html">Documentation * on elastic.co */ @@ -871,7 +871,7 @@ public SnapshotsResponse snapshots(SnapshotsRequest request) throws IOException, * a function that initializes a builder to create the * {@link SnapshotsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-snapshots.html">Documentation * on elastic.co */ @@ -884,7 +884,7 @@ public final SnapshotsResponse snapshots(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-snapshots.html">Documentation * on elastic.co */ @@ -900,7 +900,7 @@ public SnapshotsResponse snapshots() throws IOException, ElasticsearchException * in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -919,7 +919,7 @@ public TasksResponse tasks(TasksRequest request) throws IOException, Elasticsear * a function that initializes a builder to create the * {@link TasksRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -933,7 +933,7 @@ public final TasksResponse tasks(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -948,7 +948,7 @@ public TasksResponse tasks() throws IOException, ElasticsearchException { * Returns information about existing templates. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-templates.html">Documentation * on elastic.co */ @@ -966,7 +966,7 @@ public TemplatesResponse templates(TemplatesRequest request) throws IOException, * a function that initializes a builder to create the * {@link TemplatesRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-templates.html">Documentation * on elastic.co */ @@ -979,7 +979,7 @@ public final TemplatesResponse templates(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-templates.html">Documentation * on elastic.co */ @@ -995,7 +995,7 @@ public TemplatesResponse templates() throws IOException, ElasticsearchException * queue and rejected statistics are returned for all thread pools. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-thread-pool.html">Documentation * on elastic.co */ @@ -1014,7 +1014,7 @@ public ThreadPoolResponse threadPool(ThreadPoolRequest request) throws IOExcepti * a function that initializes a builder to create the * {@link ThreadPoolRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-thread-pool.html">Documentation * on elastic.co */ @@ -1028,7 +1028,7 @@ public final ThreadPoolResponse threadPool(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-thread-pool.html">Documentation * on elastic.co */ @@ -1043,7 +1043,7 @@ public ThreadPoolResponse threadPool() throws IOException, ElasticsearchExceptio * Gets configuration and usage information about transforms. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-transforms.html">Documentation * on elastic.co */ @@ -1061,7 +1061,7 @@ public TransformsResponse transforms(TransformsRequest request) throws IOExcepti * a function that initializes a builder to create the * {@link TransformsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-transforms.html">Documentation * on elastic.co */ @@ -1074,7 +1074,7 @@ public final TransformsResponse transforms(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cat-transforms.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ThreadPoolRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ThreadPoolRequest.java index 8b3e600c2..a4b0967c1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ThreadPoolRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ThreadPoolRequest.java @@ -24,7 +24,7 @@ package co.elastic.clients.elasticsearch.cat; import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.Time; +import co.elastic.clients.elasticsearch._types.TimeUnit; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.ObjectBuilderDeserializer; @@ -58,7 +58,7 @@ public class ThreadPoolRequest extends CatRequestBase { private final List threadPoolPatterns; @Nullable - private final Time time; + private final TimeUnit time; // --------------------------------------------------------------------------------------------- @@ -89,7 +89,7 @@ public final List threadPoolPatterns() { * API name: {@code time} */ @Nullable - public final Time time() { + public final TimeUnit time() { return this.time; } @@ -104,7 +104,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder threadPoolPatterns; @Nullable - private Time time; + private TimeUnit time; /** * List of thread pool names used to limit the request. Accepts wildcard @@ -137,20 +137,11 @@ public final Builder threadPoolPatterns(String value, String... values) { *

* API name: {@code time} */ - public final Builder time(@Nullable Time value) { + public final Builder time(@Nullable TimeUnit value) { this.time = value; return this; } - /** - * Unit used to display time values. - *

- * API name: {@code time} - */ - public final Builder time(Function> fn) { - return this.time(fn.apply(new Time.Builder()).build()); - } - /** * Builds a {@link ThreadPoolRequest}. * @@ -211,7 +202,7 @@ public ThreadPoolRequest build() { Map params = new HashMap<>(); params.put("format", "json"); if (request.time != null) { - params.put("time", request.time._toJsonString()); + params.put("time", request.time.jsonValue()); } return params; diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/TransformsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/TransformsRequest.java index c5c7d80c9..72f67d40b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/TransformsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/TransformsRequest.java @@ -24,7 +24,7 @@ package co.elastic.clients.elasticsearch.cat; import co.elastic.clients.elasticsearch._types.ErrorResponse; -import co.elastic.clients.elasticsearch._types.Time; +import co.elastic.clients.elasticsearch._types.TimeUnit; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.ObjectBuilderDeserializer; @@ -74,7 +74,7 @@ public class TransformsRequest extends CatRequestBase { private final Integer size; @Nullable - private final Time time; + private final TimeUnit time; @Nullable private final String transformId; @@ -153,7 +153,7 @@ public final Integer size() { * API name: {@code time} */ @Nullable - public final Time time() { + public final TimeUnit time() { return this.time; } @@ -191,7 +191,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder * API name: {@code time} */ - public final Builder time(@Nullable Time value) { + public final Builder time(@Nullable TimeUnit value) { this.time = value; return this; } - /** - * Unit used to display time values. - *

- * API name: {@code time} - */ - public final Builder time(Function> fn) { - return this.time(fn.apply(new Time.Builder()).build()); - } - /** * The id of the transform for which to get stats. '_all' or '*' implies all * transforms @@ -378,7 +369,7 @@ public TransformsRequest build() { params.put("from", String.valueOf(request.from)); } if (request.time != null) { - params.put("time", request.time._toJsonString()); + params.put("time", request.time.jsonValue()); } if (request.allowNoMatch != null) { params.put("allow_no_match", String.valueOf(request.allowNoMatch)); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/count/CountRecord.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/count/CountRecord.java index 1420d1a72..8d71e1f70 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/count/CountRecord.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/count/CountRecord.java @@ -30,10 +30,10 @@ import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; -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.Long; import java.lang.String; import java.util.Objects; import java.util.function.Function; @@ -49,10 +49,10 @@ @JsonpDeserializable public class CountRecord implements JsonpSerializable { @Nullable - private final DateTime epoch; + private final Long epoch; @Nullable - private final DateTime timestamp; + private final String timestamp; @Nullable private final String count; @@ -72,12 +72,12 @@ public static CountRecord of(Function> fn) { } /** - * seconds since 1969-01-01 00:00:00 + * seconds since 1970-01-01 00:00:00 *

* API name: {@code epoch} */ @Nullable - public final DateTime epoch() { + public final Long epoch() { return this.epoch; } @@ -87,7 +87,7 @@ public final DateTime epoch() { * API name: {@code timestamp} */ @Nullable - public final DateTime timestamp() { + public final String timestamp() { return this.timestamp; } @@ -114,11 +114,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.epoch != null) { generator.writeKey("epoch"); - this.epoch.serialize(generator, mapper); + generator.write(this.epoch); + } if (this.timestamp != null) { generator.writeKey("timestamp"); - this.timestamp.serialize(generator, mapper); + generator.write(this.timestamp); + } if (this.count != null) { generator.writeKey("count"); @@ -141,20 +143,20 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { @Nullable - private DateTime epoch; + private Long epoch; @Nullable - private DateTime timestamp; + private String timestamp; @Nullable private String count; /** - * seconds since 1969-01-01 00:00:00 + * seconds since 1970-01-01 00:00:00 *

* API name: {@code epoch} */ - public final Builder epoch(@Nullable DateTime value) { + public final Builder epoch(@Nullable Long value) { this.epoch = value; return this; } @@ -164,7 +166,7 @@ public final Builder epoch(@Nullable DateTime value) { *

* API name: {@code timestamp} */ - public final Builder timestamp(@Nullable DateTime value) { + public final Builder timestamp(@Nullable String value) { this.timestamp = value; return this; } @@ -207,8 +209,8 @@ public CountRecord build() { protected static void setupCountRecordDeserializer(ObjectDeserializer op) { - op.add(Builder::epoch, DateTime._DESERIALIZER, "epoch", "t", "time"); - op.add(Builder::timestamp, DateTime._DESERIALIZER, "timestamp", "ts", "hms", "hhmmss"); + op.add(Builder::epoch, JsonpDeserializer.longDeserializer(), "epoch", "t", "time"); + op.add(Builder::timestamp, JsonpDeserializer.stringDeserializer(), "timestamp", "ts", "hms", "hhmmss"); op.add(Builder::count, JsonpDeserializer.stringDeserializer(), "count", "dc", "docs.count", "docsCount"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/health/HealthRecord.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/health/HealthRecord.java index 230523603..a68833de5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/health/HealthRecord.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/health/HealthRecord.java @@ -30,10 +30,10 @@ import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; -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.Long; import java.lang.String; import java.util.Objects; import java.util.function.Function; @@ -49,10 +49,10 @@ @JsonpDeserializable public class HealthRecord implements JsonpSerializable { @Nullable - private final DateTime epoch; + private final Long epoch; @Nullable - private final DateTime timestamp; + private final String timestamp; @Nullable private final String cluster; @@ -116,12 +116,12 @@ public static HealthRecord of(Function> fn) } /** - * seconds since 1969-01-01 00:00:00 + * seconds since 1970-01-01 00:00:00 *

* API name: {@code epoch} */ @Nullable - public final DateTime epoch() { + public final Long epoch() { return this.epoch; } @@ -131,7 +131,7 @@ public final DateTime epoch() { * API name: {@code timestamp} */ @Nullable - public final DateTime timestamp() { + public final String timestamp() { return this.timestamp; } @@ -268,11 +268,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.epoch != null) { generator.writeKey("epoch"); - this.epoch.serialize(generator, mapper); + generator.write(this.epoch); + } if (this.timestamp != null) { generator.writeKey("timestamp"); - this.timestamp.serialize(generator, mapper); + generator.write(this.timestamp); + } if (this.cluster != null) { generator.writeKey("cluster"); @@ -350,10 +352,10 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { @Nullable - private DateTime epoch; + private Long epoch; @Nullable - private DateTime timestamp; + private String timestamp; @Nullable private String cluster; @@ -392,11 +394,11 @@ public static class Builder extends WithJsonObjectBuilderBase implement private String activeShardsPercent; /** - * seconds since 1969-01-01 00:00:00 + * seconds since 1970-01-01 00:00:00 *

* API name: {@code epoch} */ - public final Builder epoch(@Nullable DateTime value) { + public final Builder epoch(@Nullable Long value) { this.epoch = value; return this; } @@ -406,7 +408,7 @@ public final Builder epoch(@Nullable DateTime value) { *

* API name: {@code timestamp} */ - public final Builder timestamp(@Nullable DateTime value) { + public final Builder timestamp(@Nullable String value) { this.timestamp = value; return this; } @@ -559,8 +561,8 @@ public HealthRecord build() { protected static void setupHealthRecordDeserializer(ObjectDeserializer op) { - op.add(Builder::epoch, DateTime._DESERIALIZER, "epoch", "time"); - op.add(Builder::timestamp, DateTime._DESERIALIZER, "timestamp", "ts", "hms", "hhmmss"); + op.add(Builder::epoch, JsonpDeserializer.longDeserializer(), "epoch", "time"); + op.add(Builder::timestamp, JsonpDeserializer.stringDeserializer(), "timestamp", "ts", "hms", "hhmmss"); op.add(Builder::cluster, JsonpDeserializer.stringDeserializer(), "cluster", "cl"); op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status", "st"); op.add(Builder::nodeTotal, JsonpDeserializer.stringDeserializer(), "node.total", "nt", "nodeTotal"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/recovery/RecoveryRecord.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/recovery/RecoveryRecord.java index da21c407c..b66c36820 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/recovery/RecoveryRecord.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cat/recovery/RecoveryRecord.java @@ -23,6 +23,7 @@ package co.elastic.clients.elasticsearch.cat.recovery; +import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -30,9 +31,11 @@ import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; +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.Long; import java.lang.String; import java.util.Objects; import java.util.function.Function; @@ -54,19 +57,19 @@ public class RecoveryRecord implements JsonpSerializable { private final String shard; @Nullable - private final String startTime; + private final DateTime startTime; @Nullable - private final String startTimeMillis; + private final Long startTimeMillis; @Nullable - private final String stopTime; + private final DateTime stopTime; @Nullable - private final String stopTimeMillis; + private final Long stopTimeMillis; @Nullable - private final String time; + private final Time time; @Nullable private final String type; @@ -188,7 +191,7 @@ public final String shard() { * API name: {@code start_time} */ @Nullable - public final String startTime() { + public final DateTime startTime() { return this.startTime; } @@ -198,7 +201,7 @@ public final String startTime() { * API name: {@code start_time_millis} */ @Nullable - public final String startTimeMillis() { + public final Long startTimeMillis() { return this.startTimeMillis; } @@ -208,7 +211,7 @@ public final String startTimeMillis() { * API name: {@code stop_time} */ @Nullable - public final String stopTime() { + public final DateTime stopTime() { return this.stopTime; } @@ -218,7 +221,7 @@ public final String stopTime() { * API name: {@code stop_time_millis} */ @Nullable - public final String stopTimeMillis() { + public final Long stopTimeMillis() { return this.stopTimeMillis; } @@ -228,7 +231,7 @@ public final String stopTimeMillis() { * API name: {@code time} */ @Nullable - public final String time() { + public final Time time() { return this.time; } @@ -445,8 +448,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.startTime != null) { generator.writeKey("start_time"); - generator.write(this.startTime); - + this.startTime.serialize(generator, mapper); } if (this.startTimeMillis != null) { generator.writeKey("start_time_millis"); @@ -455,8 +457,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.stopTime != null) { generator.writeKey("stop_time"); - generator.write(this.stopTime); - + this.stopTime.serialize(generator, mapper); } if (this.stopTimeMillis != null) { generator.writeKey("stop_time_millis"); @@ -465,7 +466,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.time != null) { generator.writeKey("time"); - generator.write(this.time); + this.time.serialize(generator, mapper); } if (this.type != null) { @@ -585,19 +586,19 @@ public static class Builder extends WithJsonObjectBuilderBase implement private String shard; @Nullable - private String startTime; + private DateTime startTime; @Nullable - private String startTimeMillis; + private Long startTimeMillis; @Nullable - private String stopTime; + private DateTime stopTime; @Nullable - private String stopTimeMillis; + private Long stopTimeMillis; @Nullable - private String time; + private Time time; @Nullable private String type; @@ -681,7 +682,7 @@ public final Builder shard(@Nullable String value) { *

* API name: {@code start_time} */ - public final Builder startTime(@Nullable String value) { + public final Builder startTime(@Nullable DateTime value) { this.startTime = value; return this; } @@ -691,7 +692,7 @@ public final Builder startTime(@Nullable String value) { *

* API name: {@code start_time_millis} */ - public final Builder startTimeMillis(@Nullable String value) { + public final Builder startTimeMillis(@Nullable Long value) { this.startTimeMillis = value; return this; } @@ -701,7 +702,7 @@ public final Builder startTimeMillis(@Nullable String value) { *

* API name: {@code stop_time} */ - public final Builder stopTime(@Nullable String value) { + public final Builder stopTime(@Nullable DateTime value) { this.stopTime = value; return this; } @@ -711,7 +712,7 @@ public final Builder stopTime(@Nullable String value) { *

* API name: {@code stop_time_millis} */ - public final Builder stopTimeMillis(@Nullable String value) { + public final Builder stopTimeMillis(@Nullable Long value) { this.stopTimeMillis = value; return this; } @@ -721,11 +722,20 @@ public final Builder stopTimeMillis(@Nullable String value) { *

* API name: {@code time} */ - public final Builder time(@Nullable String value) { + public final Builder time(@Nullable Time value) { this.time = value; return this; } + /** + * recovery time + *

+ * API name: {@code time} + */ + public final Builder time(Function> fn) { + return this.time(fn.apply(new Time.Builder()).build()); + } + /** * recovery type *

@@ -946,11 +956,11 @@ protected static void setupRecoveryRecordDeserializer(ObjectDeserializer implement private String status; @Nullable - private DateTime startEpoch; + private Long startEpoch; @Nullable - private DateTime startTime; + private ScheduleTimeOfDay startTime; @Nullable - private DateTime endEpoch; + private Long endEpoch; @Nullable - private DateTime endTime; + private String endTime; @Nullable private Time duration; @@ -404,7 +409,7 @@ public final Builder status(@Nullable String value) { *

* API name: {@code start_epoch} */ - public final Builder startEpoch(@Nullable DateTime value) { + public final Builder startEpoch(@Nullable Long value) { this.startEpoch = value; return this; } @@ -414,17 +419,26 @@ public final Builder startEpoch(@Nullable DateTime value) { *

* API name: {@code start_time} */ - public final Builder startTime(@Nullable DateTime value) { + public final Builder startTime(@Nullable ScheduleTimeOfDay value) { this.startTime = value; return this; } + /** + * start time in HH:MM:SS + *

+ * API name: {@code start_time} + */ + public final Builder startTime(Function> fn) { + return this.startTime(fn.apply(new ScheduleTimeOfDay.Builder()).build()); + } + /** * end time in seconds since 1970-01-01 00:00:00 *

* API name: {@code end_epoch} */ - public final Builder endEpoch(@Nullable DateTime value) { + public final Builder endEpoch(@Nullable Long value) { this.endEpoch = value; return this; } @@ -434,7 +448,7 @@ public final Builder endEpoch(@Nullable DateTime value) { *

* API name: {@code end_time} */ - public final Builder endTime(@Nullable DateTime value) { + public final Builder endTime(@Nullable String value) { this.endTime = value; return this; } @@ -539,10 +553,10 @@ protected static void setupSnapshotsRecordDeserializer(ObjectDeserializerDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-delete-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -78,7 +78,7 @@ public CompletableFuture deleteAutoFollowPatter * a function that initializes a builder to create the * {@link DeleteAutoFollowPatternRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-delete-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -94,7 +94,7 @@ public final CompletableFuture deleteAutoFollow * index. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-put-follow.html">Documentation * on elastic.co */ @@ -113,7 +113,7 @@ public CompletableFuture follow(FollowRequest request) { * a function that initializes a builder to create the * {@link FollowRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-put-follow.html">Documentation * on elastic.co */ @@ -129,7 +129,7 @@ public final CompletableFuture follow( * status for each follower index * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-get-follow-info.html">Documentation * on elastic.co */ @@ -148,7 +148,7 @@ public CompletableFuture followInfo(FollowInfoRequest reques * a function that initializes a builder to create the * {@link FollowInfoRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-get-follow-info.html">Documentation * on elastic.co */ @@ -164,7 +164,7 @@ public final CompletableFuture followInfo( * associated with each shard for the specified indices. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-get-follow-stats.html">Documentation * on elastic.co */ @@ -183,7 +183,7 @@ public CompletableFuture followStats(FollowStatsRequest req * a function that initializes a builder to create the * {@link FollowStatsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-get-follow-stats.html">Documentation * on elastic.co */ @@ -198,7 +198,7 @@ public final CompletableFuture followStats( * Removes the follower retention leases from the leader. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-post-forget-follower.html">Documentation * on elastic.co */ @@ -216,7 +216,7 @@ public CompletableFuture forgetFollower(ForgetFollowerRe * a function that initializes a builder to create the * {@link ForgetFollowerRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-post-forget-follower.html">Documentation * on elastic.co */ @@ -232,7 +232,7 @@ public final CompletableFuture forgetFollower( * pattern collection. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-get-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -251,7 +251,7 @@ public CompletableFuture getAutoFollowPattern(GetA * a function that initializes a builder to create the * {@link GetAutoFollowPatternRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-get-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -265,7 +265,7 @@ public final CompletableFuture getAutoFollowPatter * pattern collection. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-get-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -280,7 +280,7 @@ public CompletableFuture getAutoFollowPattern() { * Pauses an auto-follow pattern * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-pause-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -299,7 +299,7 @@ public CompletableFuture pauseAutoFollowPattern( * a function that initializes a builder to create the * {@link PauseAutoFollowPatternRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-pause-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -315,7 +315,7 @@ public final CompletableFuture pauseAutoFollowPa * operations from the leader index. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-post-pause-follow.html">Documentation * on elastic.co */ @@ -334,7 +334,7 @@ public CompletableFuture pauseFollow(PauseFollowRequest req * a function that initializes a builder to create the * {@link PauseFollowRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-post-pause-follow.html">Documentation * on elastic.co */ @@ -351,7 +351,7 @@ public final CompletableFuture pauseFollow( * the specified patterns will be automatically configured as follower indices. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-put-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -371,7 +371,7 @@ public CompletableFuture putAutoFollowPattern(PutA * a function that initializes a builder to create the * {@link PutAutoFollowPatternRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-put-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -386,7 +386,7 @@ public final CompletableFuture putAutoFollowPatter * Resumes an auto-follow pattern that has been paused * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-resume-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -405,7 +405,7 @@ public CompletableFuture resumeAutoFollowPatter * a function that initializes a builder to create the * {@link ResumeAutoFollowPatternRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-resume-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -420,7 +420,7 @@ public final CompletableFuture resumeAutoFollow * Resumes a follower index that has been paused * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-post-resume-follow.html">Documentation * on elastic.co */ @@ -438,7 +438,7 @@ public CompletableFuture resumeFollow(ResumeFollowRequest * a function that initializes a builder to create the * {@link ResumeFollowRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-post-resume-follow.html">Documentation * on elastic.co */ @@ -453,7 +453,7 @@ public final CompletableFuture resumeFollow( * Gets all stats related to cross-cluster replication. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-get-stats.html">Documentation * on elastic.co */ public CompletableFuture stats() { @@ -468,7 +468,7 @@ public CompletableFuture stats() { * metadata and settings associated with cross-cluster replication. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-post-unfollow.html">Documentation * on elastic.co */ @@ -487,7 +487,7 @@ public CompletableFuture unfollow(UnfollowRequest request) { * a function that initializes a builder to create the * {@link UnfollowRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-post-unfollow.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ccr/ElasticsearchCcrClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ccr/ElasticsearchCcrClient.java index 1ac3c1e8b..3f3015404 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ccr/ElasticsearchCcrClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ccr/ElasticsearchCcrClient.java @@ -60,7 +60,7 @@ public ElasticsearchCcrClient withTransportOptions(@Nullable TransportOptions tr * Deletes auto-follow patterns. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-delete-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -79,7 +79,7 @@ public DeleteAutoFollowPatternResponse deleteAutoFollowPattern(DeleteAutoFollowP * a function that initializes a builder to create the * {@link DeleteAutoFollowPatternRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-delete-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -96,7 +96,7 @@ public final DeleteAutoFollowPatternResponse deleteAutoFollowPattern( * index. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-put-follow.html">Documentation * on elastic.co */ @@ -115,7 +115,7 @@ public FollowResponse follow(FollowRequest request) throws IOException, Elastics * a function that initializes a builder to create the * {@link FollowRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-put-follow.html">Documentation * on elastic.co */ @@ -131,7 +131,7 @@ public final FollowResponse follow(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-get-follow-info.html">Documentation * on elastic.co */ @@ -150,7 +150,7 @@ public FollowInfoResponse followInfo(FollowInfoRequest request) throws IOExcepti * a function that initializes a builder to create the * {@link FollowInfoRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-get-follow-info.html">Documentation * on elastic.co */ @@ -166,7 +166,7 @@ public final FollowInfoResponse followInfo(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-get-follow-stats.html">Documentation * on elastic.co */ @@ -185,7 +185,7 @@ public FollowStatsResponse followStats(FollowStatsRequest request) throws IOExce * a function that initializes a builder to create the * {@link FollowStatsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-get-follow-stats.html">Documentation * on elastic.co */ @@ -201,7 +201,7 @@ public final FollowStatsResponse followStats( * Removes the follower retention leases from the leader. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-post-forget-follower.html">Documentation * on elastic.co */ @@ -220,7 +220,7 @@ public ForgetFollowerResponse forgetFollower(ForgetFollowerRequest request) * a function that initializes a builder to create the * {@link ForgetFollowerRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-post-forget-follower.html">Documentation * on elastic.co */ @@ -237,7 +237,7 @@ public final ForgetFollowerResponse forgetFollower( * pattern collection. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-get-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -257,7 +257,7 @@ public GetAutoFollowPatternResponse getAutoFollowPattern(GetAutoFollowPatternReq * a function that initializes a builder to create the * {@link GetAutoFollowPatternRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-get-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -272,7 +272,7 @@ public final GetAutoFollowPatternResponse getAutoFollowPattern( * pattern collection. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-get-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -287,7 +287,7 @@ public GetAutoFollowPatternResponse getAutoFollowPattern() throws IOException, E * Pauses an auto-follow pattern * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-pause-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -306,7 +306,7 @@ public PauseAutoFollowPatternResponse pauseAutoFollowPattern(PauseAutoFollowPatt * a function that initializes a builder to create the * {@link PauseAutoFollowPatternRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-pause-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -323,7 +323,7 @@ public final PauseAutoFollowPatternResponse pauseAutoFollowPattern( * operations from the leader index. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-post-pause-follow.html">Documentation * on elastic.co */ @@ -342,7 +342,7 @@ public PauseFollowResponse pauseFollow(PauseFollowRequest request) throws IOExce * a function that initializes a builder to create the * {@link PauseFollowRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-post-pause-follow.html">Documentation * on elastic.co */ @@ -360,7 +360,7 @@ public final PauseFollowResponse pauseFollow( * the specified patterns will be automatically configured as follower indices. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-put-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -381,7 +381,7 @@ public PutAutoFollowPatternResponse putAutoFollowPattern(PutAutoFollowPatternReq * a function that initializes a builder to create the * {@link PutAutoFollowPatternRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-put-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -397,7 +397,7 @@ public final PutAutoFollowPatternResponse putAutoFollowPattern( * Resumes an auto-follow pattern that has been paused * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-resume-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -416,7 +416,7 @@ public ResumeAutoFollowPatternResponse resumeAutoFollowPattern(ResumeAutoFollowP * a function that initializes a builder to create the * {@link ResumeAutoFollowPatternRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-resume-auto-follow-pattern.html">Documentation * on elastic.co */ @@ -432,7 +432,7 @@ public final ResumeAutoFollowPatternResponse resumeAutoFollowPattern( * Resumes a follower index that has been paused * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-post-resume-follow.html">Documentation * on elastic.co */ @@ -450,7 +450,7 @@ public ResumeFollowResponse resumeFollow(ResumeFollowRequest request) throws IOE * a function that initializes a builder to create the * {@link ResumeFollowRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-post-resume-follow.html">Documentation * on elastic.co */ @@ -466,7 +466,7 @@ public final ResumeFollowResponse resumeFollow( * Gets all stats related to cross-cluster replication. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-get-stats.html">Documentation * on elastic.co */ public CcrStatsResponse stats() throws IOException, ElasticsearchException { @@ -481,7 +481,7 @@ public CcrStatsResponse stats() throws IOException, ElasticsearchException { * metadata and settings associated with cross-cluster replication. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-post-unfollow.html">Documentation * on elastic.co */ @@ -500,7 +500,7 @@ public UnfollowResponse unfollow(UnfollowRequest request) throws IOException, El * a function that initializes a builder to create the * {@link UnfollowRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ccr-post-unfollow.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ccr/ShardStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ccr/ShardStats.java index ad4c52d51..77935d2b1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ccr/ShardStats.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ccr/ShardStats.java @@ -24,6 +24,7 @@ package co.elastic.clients.elasticsearch.ccr; import co.elastic.clients.elasticsearch._types.ErrorCause; +import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -32,7 +33,6 @@ 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; @@ -100,13 +100,25 @@ public class ShardStats implements JsonpSerializable { private final long successfulWriteRequests; - private final DateTime timeSinceLastReadMillis; + @Nullable + private final Time timeSinceLastRead; + + private final long timeSinceLastReadMillis; + + @Nullable + private final Time totalReadRemoteExecTime; - private final DateTime totalReadRemoteExecTimeMillis; + private final long totalReadRemoteExecTimeMillis; - private final DateTime totalReadTimeMillis; + @Nullable + private final Time totalReadTime; - private final DateTime totalWriteTimeMillis; + private final long totalReadTimeMillis; + + @Nullable + private final Time totalWriteTime; + + private final long totalWriteTimeMillis; private final long writeBufferOperationCount; @@ -149,12 +161,16 @@ private ShardStats(Builder builder) { "successfulReadRequests"); this.successfulWriteRequests = ApiTypeHelper.requireNonNull(builder.successfulWriteRequests, this, "successfulWriteRequests"); + this.timeSinceLastRead = builder.timeSinceLastRead; this.timeSinceLastReadMillis = ApiTypeHelper.requireNonNull(builder.timeSinceLastReadMillis, this, "timeSinceLastReadMillis"); + this.totalReadRemoteExecTime = builder.totalReadRemoteExecTime; this.totalReadRemoteExecTimeMillis = ApiTypeHelper.requireNonNull(builder.totalReadRemoteExecTimeMillis, this, "totalReadRemoteExecTimeMillis"); + this.totalReadTime = builder.totalReadTime; this.totalReadTimeMillis = ApiTypeHelper.requireNonNull(builder.totalReadTimeMillis, this, "totalReadTimeMillis"); + this.totalWriteTime = builder.totalWriteTime; this.totalWriteTimeMillis = ApiTypeHelper.requireNonNull(builder.totalWriteTimeMillis, this, "totalWriteTimeMillis"); this.writeBufferOperationCount = ApiTypeHelper.requireNonNull(builder.writeBufferOperationCount, this, @@ -330,31 +346,63 @@ public final long successfulWriteRequests() { return this.successfulWriteRequests; } + /** + * API name: {@code time_since_last_read} + */ + @Nullable + public final Time timeSinceLastRead() { + return this.timeSinceLastRead; + } + /** * Required - API name: {@code time_since_last_read_millis} */ - public final DateTime timeSinceLastReadMillis() { + public final long timeSinceLastReadMillis() { return this.timeSinceLastReadMillis; } + /** + * API name: {@code total_read_remote_exec_time} + */ + @Nullable + public final Time totalReadRemoteExecTime() { + return this.totalReadRemoteExecTime; + } + /** * Required - API name: {@code total_read_remote_exec_time_millis} */ - public final DateTime totalReadRemoteExecTimeMillis() { + public final long totalReadRemoteExecTimeMillis() { return this.totalReadRemoteExecTimeMillis; } + /** + * API name: {@code total_read_time} + */ + @Nullable + public final Time totalReadTime() { + return this.totalReadTime; + } + /** * Required - API name: {@code total_read_time_millis} */ - public final DateTime totalReadTimeMillis() { + public final long totalReadTimeMillis() { return this.totalReadTimeMillis; } + /** + * API name: {@code total_write_time} + */ + @Nullable + public final Time totalWriteTime() { + return this.totalWriteTime; + } + /** * Required - API name: {@code total_write_time_millis} */ - public final DateTime totalWriteTimeMillis() { + public final long totalWriteTimeMillis() { return this.totalWriteTimeMillis; } @@ -461,14 +509,38 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("successful_write_requests"); generator.write(this.successfulWriteRequests); + if (this.timeSinceLastRead != null) { + generator.writeKey("time_since_last_read"); + this.timeSinceLastRead.serialize(generator, mapper); + + } generator.writeKey("time_since_last_read_millis"); - this.timeSinceLastReadMillis.serialize(generator, mapper); + generator.write(this.timeSinceLastReadMillis); + + if (this.totalReadRemoteExecTime != null) { + generator.writeKey("total_read_remote_exec_time"); + this.totalReadRemoteExecTime.serialize(generator, mapper); + + } generator.writeKey("total_read_remote_exec_time_millis"); - this.totalReadRemoteExecTimeMillis.serialize(generator, mapper); + generator.write(this.totalReadRemoteExecTimeMillis); + + if (this.totalReadTime != null) { + generator.writeKey("total_read_time"); + this.totalReadTime.serialize(generator, mapper); + + } generator.writeKey("total_read_time_millis"); - this.totalReadTimeMillis.serialize(generator, mapper); + generator.write(this.totalReadTimeMillis); + + if (this.totalWriteTime != null) { + generator.writeKey("total_write_time"); + this.totalWriteTime.serialize(generator, mapper); + + } generator.writeKey("total_write_time_millis"); - this.totalWriteTimeMillis.serialize(generator, mapper); + generator.write(this.totalWriteTimeMillis); + generator.writeKey("write_buffer_operation_count"); generator.write(this.writeBufferOperationCount); @@ -536,13 +608,25 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Long successfulWriteRequests; - private DateTime timeSinceLastReadMillis; + @Nullable + private Time timeSinceLastRead; + + private Long timeSinceLastReadMillis; - private DateTime totalReadRemoteExecTimeMillis; + @Nullable + private Time totalReadRemoteExecTime; + + private Long totalReadRemoteExecTimeMillis; + + @Nullable + private Time totalReadTime; + + private Long totalReadTimeMillis; - private DateTime totalReadTimeMillis; + @Nullable + private Time totalWriteTime; - private DateTime totalWriteTimeMillis; + private Long totalWriteTimeMillis; private Long writeBufferOperationCount; @@ -760,34 +844,94 @@ public final Builder successfulWriteRequests(long value) { return this; } + /** + * API name: {@code time_since_last_read} + */ + public final Builder timeSinceLastRead(@Nullable Time value) { + this.timeSinceLastRead = value; + return this; + } + + /** + * API name: {@code time_since_last_read} + */ + public final Builder timeSinceLastRead(Function> fn) { + return this.timeSinceLastRead(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code time_since_last_read_millis} */ - public final Builder timeSinceLastReadMillis(DateTime value) { + public final Builder timeSinceLastReadMillis(long value) { this.timeSinceLastReadMillis = value; return this; } + /** + * API name: {@code total_read_remote_exec_time} + */ + public final Builder totalReadRemoteExecTime(@Nullable Time value) { + this.totalReadRemoteExecTime = value; + return this; + } + + /** + * API name: {@code total_read_remote_exec_time} + */ + public final Builder totalReadRemoteExecTime(Function> fn) { + return this.totalReadRemoteExecTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_read_remote_exec_time_millis} */ - public final Builder totalReadRemoteExecTimeMillis(DateTime value) { + public final Builder totalReadRemoteExecTimeMillis(long value) { this.totalReadRemoteExecTimeMillis = value; return this; } + /** + * API name: {@code total_read_time} + */ + public final Builder totalReadTime(@Nullable Time value) { + this.totalReadTime = value; + return this; + } + + /** + * API name: {@code total_read_time} + */ + public final Builder totalReadTime(Function> fn) { + return this.totalReadTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_read_time_millis} */ - public final Builder totalReadTimeMillis(DateTime value) { + public final Builder totalReadTimeMillis(long value) { this.totalReadTimeMillis = value; return this; } + /** + * API name: {@code total_write_time} + */ + public final Builder totalWriteTime(@Nullable Time value) { + this.totalWriteTime = value; + return this; + } + + /** + * API name: {@code total_write_time} + */ + public final Builder totalWriteTime(Function> fn) { + return this.totalWriteTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_write_time_millis} */ - public final Builder totalWriteTimeMillis(DateTime value) { + public final Builder totalWriteTimeMillis(long value) { this.totalWriteTimeMillis = value; return this; } @@ -861,10 +1005,15 @@ protected static void setupShardStatsDeserializer(ObjectDeserializer private Long lastSeenMetadataVersion; - private DateTime timeSinceLastCheckMillis; + private Long timeSinceLastCheckMillis; /** * Required - API name: {@code cluster_name} @@ -155,7 +154,7 @@ public final Builder lastSeenMetadataVersion(long value) { /** * Required - API name: {@code time_since_last_check_millis} */ - public final Builder timeSinceLastCheckMillis(DateTime value) { + public final Builder timeSinceLastCheckMillis(long value) { this.timeSinceLastCheckMillis = value; return this; } @@ -190,7 +189,7 @@ protected static void setupAutoFollowedClusterDeserializer(ObjectDeserializer private String allocateExplanation; @Nullable - private String allocationDelay; + private Time allocationDelay; @Nullable private Long allocationDelayInMillis; @@ -545,7 +546,7 @@ public static class Builder extends WithJsonObjectBuilderBase private ClusterInfo clusterInfo; @Nullable - private String configuredDelay; + private Time configuredDelay; @Nullable private Long configuredDelayInMillis; @@ -569,7 +570,7 @@ public static class Builder extends WithJsonObjectBuilderBase private String rebalanceExplanation; @Nullable - private String remainingDelay; + private Time remainingDelay; @Nullable private Long remainingDelayInMillis; @@ -593,11 +594,18 @@ public final Builder allocateExplanation(@Nullable String value) { /** * API name: {@code allocation_delay} */ - public final Builder allocationDelay(@Nullable String value) { + public final Builder allocationDelay(@Nullable Time value) { this.allocationDelay = value; return this; } + /** + * API name: {@code allocation_delay} + */ + public final Builder allocationDelay(Function> fn) { + return this.allocationDelay(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code allocation_delay_in_millis} */ @@ -726,11 +734,18 @@ public final Builder clusterInfo(Function> fn) { + return this.configuredDelay(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code configured_delay_in_millis} */ @@ -829,11 +844,18 @@ public final Builder rebalanceExplanation(@Nullable String value) { /** * API name: {@code remaining_delay} */ - public final Builder remainingDelay(@Nullable String value) { + public final Builder remainingDelay(@Nullable Time value) { this.remainingDelay = value; return this; } + /** + * API name: {@code remaining_delay} + */ + public final Builder remainingDelay(Function> fn) { + return this.remainingDelay(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code remaining_delay_in_millis} */ @@ -904,7 +926,7 @@ protected static void setupAllocationExplainResponseDeserializer( ObjectDeserializer op) { op.add(Builder::allocateExplanation, JsonpDeserializer.stringDeserializer(), "allocate_explanation"); - op.add(Builder::allocationDelay, JsonpDeserializer.stringDeserializer(), "allocation_delay"); + op.add(Builder::allocationDelay, Time._DESERIALIZER, "allocation_delay"); op.add(Builder::allocationDelayInMillis, JsonpDeserializer.longDeserializer(), "allocation_delay_in_millis"); op.add(Builder::canAllocate, Decision._DESERIALIZER, "can_allocate"); op.add(Builder::canMoveToOtherNode, Decision._DESERIALIZER, "can_move_to_other_node"); @@ -917,7 +939,7 @@ protected static void setupAllocationExplainResponseDeserializer( "can_remain_decisions"); op.add(Builder::canRemainOnCurrentNode, Decision._DESERIALIZER, "can_remain_on_current_node"); op.add(Builder::clusterInfo, ClusterInfo._DESERIALIZER, "cluster_info"); - op.add(Builder::configuredDelay, JsonpDeserializer.stringDeserializer(), "configured_delay"); + op.add(Builder::configuredDelay, Time._DESERIALIZER, "configured_delay"); op.add(Builder::configuredDelayInMillis, JsonpDeserializer.longDeserializer(), "configured_delay_in_millis"); op.add(Builder::currentNode, CurrentNode._DESERIALIZER, "current_node"); op.add(Builder::currentState, JsonpDeserializer.stringDeserializer(), "current_state"); @@ -928,7 +950,7 @@ protected static void setupAllocationExplainResponseDeserializer( "node_allocation_decisions"); op.add(Builder::primary, JsonpDeserializer.booleanDeserializer(), "primary"); op.add(Builder::rebalanceExplanation, JsonpDeserializer.stringDeserializer(), "rebalance_explanation"); - op.add(Builder::remainingDelay, JsonpDeserializer.stringDeserializer(), "remaining_delay"); + op.add(Builder::remainingDelay, Time._DESERIALIZER, "remaining_delay"); op.add(Builder::remainingDelayInMillis, JsonpDeserializer.longDeserializer(), "remaining_delay_in_millis"); op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard"); op.add(Builder::unassignedInfo, UnassignedInformation._DESERIALIZER, "unassigned_info"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ElasticsearchClusterAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ElasticsearchClusterAsyncClient.java index ddb52c1e8..612760af0 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ElasticsearchClusterAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ElasticsearchClusterAsyncClient.java @@ -63,7 +63,7 @@ public ElasticsearchClusterAsyncClient withTransportOptions(@Nullable TransportO * Provides explanations for shard allocations in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-allocation-explain.html">Documentation * on elastic.co */ @@ -81,7 +81,7 @@ public CompletableFuture allocationExplain(Allocation * a function that initializes a builder to create the * {@link AllocationExplainRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-allocation-explain.html">Documentation * on elastic.co */ @@ -94,7 +94,7 @@ public final CompletableFuture allocationExplain( * Provides explanations for shard allocations in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-allocation-explain.html">Documentation * on elastic.co */ @@ -109,7 +109,7 @@ public CompletableFuture allocationExplain() { * Deletes a component template * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/indices-component-template.html">Documentation * on elastic.co */ @@ -128,7 +128,7 @@ public CompletableFuture deleteComponentTemplat * a function that initializes a builder to create the * {@link DeleteComponentTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/indices-component-template.html">Documentation * on elastic.co */ @@ -143,7 +143,7 @@ public final CompletableFuture deleteComponentT * Clears cluster voting config exclusions. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/voting-config-exclusions.html">Documentation * on elastic.co */ @@ -162,7 +162,7 @@ public CompletableFuture deleteVotingConfigExclusions( * a function that initializes a builder to create the * {@link DeleteVotingConfigExclusionsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/voting-config-exclusions.html">Documentation * on elastic.co */ @@ -175,7 +175,7 @@ public final CompletableFuture deleteVotingConfigExclusions( * Clears cluster voting config exclusions. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/voting-config-exclusions.html">Documentation * on elastic.co */ @@ -190,7 +190,7 @@ public CompletableFuture deleteVotingConfigExclusions() { * Returns information about whether a particular component template exist * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/indices-component-template.html">Documentation * on elastic.co */ @@ -208,7 +208,7 @@ public CompletableFuture existsComponentTemplate(ExistsComponen * a function that initializes a builder to create the * {@link ExistsComponentTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/indices-component-template.html">Documentation * on elastic.co */ @@ -223,7 +223,7 @@ public final CompletableFuture existsComponentTemplate( * Returns one or more component templates * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/indices-component-template.html">Documentation * on elastic.co */ @@ -241,7 +241,7 @@ public CompletableFuture getComponentTemplate(GetC * a function that initializes a builder to create the * {@link GetComponentTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/indices-component-template.html">Documentation * on elastic.co */ @@ -254,7 +254,7 @@ public final CompletableFuture getComponentTemplat * Returns one or more component templates * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/indices-component-template.html">Documentation * on elastic.co */ @@ -269,7 +269,7 @@ public CompletableFuture getComponentTemplate() { * Returns cluster settings. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-get-settings.html">Documentation * on elastic.co */ @@ -287,7 +287,7 @@ public CompletableFuture getSettings(GetClusterSetti * a function that initializes a builder to create the * {@link GetClusterSettingsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-get-settings.html">Documentation * on elastic.co */ @@ -300,7 +300,7 @@ public final CompletableFuture getSettings( * Returns cluster settings. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-get-settings.html">Documentation * on elastic.co */ @@ -315,7 +315,7 @@ public CompletableFuture getSettings() { * Returns basic information about the health of the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-health.html">Documentation * on elastic.co */ @@ -333,7 +333,7 @@ public CompletableFuture health(HealthRequest request) { * a function that initializes a builder to create the * {@link HealthRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-health.html">Documentation * on elastic.co */ @@ -346,7 +346,7 @@ public final CompletableFuture health( * Returns basic information about the health of the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-health.html">Documentation * on elastic.co */ @@ -362,7 +362,7 @@ public CompletableFuture health() { * mapping, allocate or fail shard) which have not yet been executed. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-pending.html">Documentation * on elastic.co */ @@ -381,7 +381,7 @@ public CompletableFuture pendingTasks(PendingTasksRequest * a function that initializes a builder to create the * {@link PendingTasksRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-pending.html">Documentation * on elastic.co */ @@ -395,7 +395,7 @@ public final CompletableFuture pendingTasks( * mapping, allocate or fail shard) which have not yet been executed. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-pending.html">Documentation * on elastic.co */ @@ -410,7 +410,7 @@ public CompletableFuture pendingTasks() { * Updates the cluster voting config exclusions by node ids or node names. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/voting-config-exclusions.html">Documentation * on elastic.co */ @@ -428,7 +428,7 @@ public CompletableFuture postVotingConfigExclusions(PostVotingC * a function that initializes a builder to create the * {@link PostVotingConfigExclusionsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/voting-config-exclusions.html">Documentation * on elastic.co */ @@ -441,7 +441,7 @@ public final CompletableFuture postVotingConfigExclusions( * Updates the cluster voting config exclusions by node ids or node names. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/voting-config-exclusions.html">Documentation * on elastic.co */ @@ -456,7 +456,7 @@ public CompletableFuture postVotingConfigExclusions() { * Creates or updates a component template * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/indices-component-template.html">Documentation * on elastic.co */ @@ -474,7 +474,7 @@ public CompletableFuture putComponentTemplate(PutC * a function that initializes a builder to create the * {@link PutComponentTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/indices-component-template.html">Documentation * on elastic.co */ @@ -489,7 +489,7 @@ public final CompletableFuture putComponentTemplat * Updates the cluster settings. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-update-settings.html">Documentation * on elastic.co */ @@ -507,7 +507,7 @@ public CompletableFuture putSettings(PutClusterSetti * a function that initializes a builder to create the * {@link PutClusterSettingsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-update-settings.html">Documentation * on elastic.co */ @@ -520,7 +520,7 @@ public final CompletableFuture putSettings( * Updates the cluster settings. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-update-settings.html">Documentation * on elastic.co */ @@ -535,7 +535,7 @@ public CompletableFuture putSettings() { * Returns the information about configured remote clusters. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-remote-info.html">Documentation * on elastic.co */ public CompletableFuture remoteInfo() { @@ -549,7 +549,7 @@ public CompletableFuture remoteInfo() { * Allows to manually change the allocation of individual shards in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-reroute.html">Documentation * on elastic.co */ @@ -567,7 +567,7 @@ public CompletableFuture reroute(RerouteRequest request) { * a function that initializes a builder to create the * {@link RerouteRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-reroute.html">Documentation * on elastic.co */ @@ -580,7 +580,7 @@ public final CompletableFuture reroute( * Allows to manually change the allocation of individual shards in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-reroute.html">Documentation * on elastic.co */ @@ -595,7 +595,7 @@ public CompletableFuture reroute() { * Returns a comprehensive information about the state of the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-state.html">Documentation * on elastic.co */ @@ -613,7 +613,7 @@ public CompletableFuture state(StateRequest request) { * a function that initializes a builder to create the * {@link StateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-state.html">Documentation * on elastic.co */ @@ -626,7 +626,7 @@ public final CompletableFuture state( * Returns a comprehensive information about the state of the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-state.html">Documentation * on elastic.co */ @@ -641,7 +641,7 @@ public CompletableFuture state() { * Returns high-level overview of cluster statistics. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-stats.html">Documentation * on elastic.co */ @@ -659,7 +659,7 @@ public CompletableFuture stats(ClusterStatsRequest request * a function that initializes a builder to create the * {@link ClusterStatsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-stats.html">Documentation * on elastic.co */ @@ -672,7 +672,7 @@ public final CompletableFuture stats( * Returns high-level overview of cluster statistics. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-stats.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ElasticsearchClusterClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ElasticsearchClusterClient.java index 61f9a730c..671cf8181 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ElasticsearchClusterClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ElasticsearchClusterClient.java @@ -61,7 +61,7 @@ public ElasticsearchClusterClient withTransportOptions(@Nullable TransportOption * Provides explanations for shard allocations in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-allocation-explain.html">Documentation * on elastic.co */ @@ -80,7 +80,7 @@ public AllocationExplainResponse allocationExplain(AllocationExplainRequest requ * a function that initializes a builder to create the * {@link AllocationExplainRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-allocation-explain.html">Documentation * on elastic.co */ @@ -94,7 +94,7 @@ public final AllocationExplainResponse allocationExplain( * Provides explanations for shard allocations in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-allocation-explain.html">Documentation * on elastic.co */ @@ -109,7 +109,7 @@ public AllocationExplainResponse allocationExplain() throws IOException, Elastic * Deletes a component template * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/indices-component-template.html">Documentation * on elastic.co */ @@ -128,7 +128,7 @@ public DeleteComponentTemplateResponse deleteComponentTemplate(DeleteComponentTe * a function that initializes a builder to create the * {@link DeleteComponentTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/indices-component-template.html">Documentation * on elastic.co */ @@ -144,7 +144,7 @@ public final DeleteComponentTemplateResponse deleteComponentTemplate( * Clears cluster voting config exclusions. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/voting-config-exclusions.html">Documentation * on elastic.co */ @@ -163,7 +163,7 @@ public BooleanResponse deleteVotingConfigExclusions(DeleteVotingConfigExclusions * a function that initializes a builder to create the * {@link DeleteVotingConfigExclusionsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/voting-config-exclusions.html">Documentation * on elastic.co */ @@ -177,7 +177,7 @@ public final BooleanResponse deleteVotingConfigExclusions( * Clears cluster voting config exclusions. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/voting-config-exclusions.html">Documentation * on elastic.co */ @@ -192,7 +192,7 @@ public BooleanResponse deleteVotingConfigExclusions() throws IOException, Elasti * Returns information about whether a particular component template exist * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/indices-component-template.html">Documentation * on elastic.co */ @@ -211,7 +211,7 @@ public BooleanResponse existsComponentTemplate(ExistsComponentTemplateRequest re * a function that initializes a builder to create the * {@link ExistsComponentTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/indices-component-template.html">Documentation * on elastic.co */ @@ -227,7 +227,7 @@ public final BooleanResponse existsComponentTemplate( * Returns one or more component templates * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/indices-component-template.html">Documentation * on elastic.co */ @@ -246,7 +246,7 @@ public GetComponentTemplateResponse getComponentTemplate(GetComponentTemplateReq * a function that initializes a builder to create the * {@link GetComponentTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/indices-component-template.html">Documentation * on elastic.co */ @@ -260,7 +260,7 @@ public final GetComponentTemplateResponse getComponentTemplate( * Returns one or more component templates * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/indices-component-template.html">Documentation * on elastic.co */ @@ -275,7 +275,7 @@ public GetComponentTemplateResponse getComponentTemplate() throws IOException, E * Returns cluster settings. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-get-settings.html">Documentation * on elastic.co */ @@ -294,7 +294,7 @@ public GetClusterSettingsResponse getSettings(GetClusterSettingsRequest request) * a function that initializes a builder to create the * {@link GetClusterSettingsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-get-settings.html">Documentation * on elastic.co */ @@ -308,7 +308,7 @@ public final GetClusterSettingsResponse getSettings( * Returns cluster settings. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-get-settings.html">Documentation * on elastic.co */ @@ -323,7 +323,7 @@ public GetClusterSettingsResponse getSettings() throws IOException, Elasticsearc * Returns basic information about the health of the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-health.html">Documentation * on elastic.co */ @@ -341,7 +341,7 @@ public HealthResponse health(HealthRequest request) throws IOException, Elastics * a function that initializes a builder to create the * {@link HealthRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-health.html">Documentation * on elastic.co */ @@ -354,7 +354,7 @@ public final HealthResponse health(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-health.html">Documentation * on elastic.co */ @@ -370,7 +370,7 @@ public HealthResponse health() throws IOException, ElasticsearchException { * mapping, allocate or fail shard) which have not yet been executed. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-pending.html">Documentation * on elastic.co */ @@ -389,7 +389,7 @@ public PendingTasksResponse pendingTasks(PendingTasksRequest request) throws IOE * a function that initializes a builder to create the * {@link PendingTasksRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-pending.html">Documentation * on elastic.co */ @@ -404,7 +404,7 @@ public final PendingTasksResponse pendingTasks( * mapping, allocate or fail shard) which have not yet been executed. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-pending.html">Documentation * on elastic.co */ @@ -419,7 +419,7 @@ public PendingTasksResponse pendingTasks() throws IOException, ElasticsearchExce * Updates the cluster voting config exclusions by node ids or node names. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/voting-config-exclusions.html">Documentation * on elastic.co */ @@ -438,7 +438,7 @@ public BooleanResponse postVotingConfigExclusions(PostVotingConfigExclusionsRequ * a function that initializes a builder to create the * {@link PostVotingConfigExclusionsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/voting-config-exclusions.html">Documentation * on elastic.co */ @@ -452,7 +452,7 @@ public final BooleanResponse postVotingConfigExclusions( * Updates the cluster voting config exclusions by node ids or node names. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/voting-config-exclusions.html">Documentation * on elastic.co */ @@ -467,7 +467,7 @@ public BooleanResponse postVotingConfigExclusions() throws IOException, Elastics * Creates or updates a component template * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/indices-component-template.html">Documentation * on elastic.co */ @@ -486,7 +486,7 @@ public PutComponentTemplateResponse putComponentTemplate(PutComponentTemplateReq * a function that initializes a builder to create the * {@link PutComponentTemplateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/indices-component-template.html">Documentation * on elastic.co */ @@ -502,7 +502,7 @@ public final PutComponentTemplateResponse putComponentTemplate( * Updates the cluster settings. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-update-settings.html">Documentation * on elastic.co */ @@ -521,7 +521,7 @@ public PutClusterSettingsResponse putSettings(PutClusterSettingsRequest request) * a function that initializes a builder to create the * {@link PutClusterSettingsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-update-settings.html">Documentation * on elastic.co */ @@ -535,7 +535,7 @@ public final PutClusterSettingsResponse putSettings( * Updates the cluster settings. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-update-settings.html">Documentation * on elastic.co */ @@ -550,7 +550,7 @@ public PutClusterSettingsResponse putSettings() throws IOException, Elasticsearc * Returns the information about configured remote clusters. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-remote-info.html">Documentation * on elastic.co */ public RemoteInfoResponse remoteInfo() throws IOException, ElasticsearchException { @@ -564,7 +564,7 @@ public RemoteInfoResponse remoteInfo() throws IOException, ElasticsearchExceptio * Allows to manually change the allocation of individual shards in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-reroute.html">Documentation * on elastic.co */ @@ -582,7 +582,7 @@ public RerouteResponse reroute(RerouteRequest request) throws IOException, Elast * a function that initializes a builder to create the * {@link RerouteRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-reroute.html">Documentation * on elastic.co */ @@ -595,7 +595,7 @@ public final RerouteResponse reroute(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-reroute.html">Documentation * on elastic.co */ @@ -610,7 +610,7 @@ public RerouteResponse reroute() throws IOException, ElasticsearchException { * Returns a comprehensive information about the state of the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-state.html">Documentation * on elastic.co */ @@ -628,7 +628,7 @@ public StateResponse state(StateRequest request) throws IOException, Elasticsear * a function that initializes a builder to create the * {@link StateRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-state.html">Documentation * on elastic.co */ @@ -641,7 +641,7 @@ public final StateResponse state(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-state.html">Documentation * on elastic.co */ @@ -656,7 +656,7 @@ public StateResponse state() throws IOException, ElasticsearchException { * Returns high-level overview of cluster statistics. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-stats.html">Documentation * on elastic.co */ @@ -674,7 +674,7 @@ public ClusterStatsResponse stats(ClusterStatsRequest request) throws IOExceptio * a function that initializes a builder to create the * {@link ClusterStatsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-stats.html">Documentation * on elastic.co */ @@ -688,7 +688,7 @@ public final ClusterStatsResponse stats( * Returns high-level overview of cluster statistics. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-stats.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/HealthResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/HealthResponse.java index 9b53f28d4..3e7aec3b6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/HealthResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/HealthResponse.java @@ -24,6 +24,7 @@ package co.elastic.clients.elasticsearch.cluster; import co.elastic.clients.elasticsearch._types.HealthStatus; +import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.elasticsearch.cluster.health.IndexHealthStats; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; @@ -33,12 +34,12 @@ 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.Boolean; import java.lang.Integer; +import java.lang.Long; import java.lang.String; import java.util.Map; import java.util.Objects; @@ -80,7 +81,10 @@ public class HealthResponse implements JsonpSerializable { private final HealthStatus status; - private final DateTime taskMaxWaitingInQueueMillis; + @Nullable + private final Time taskMaxWaitingInQueue; + + private final long taskMaxWaitingInQueueMillis; private final boolean timedOut; @@ -108,6 +112,7 @@ private HealthResponse(Builder builder) { "numberOfPendingTasks"); this.relocatingShards = ApiTypeHelper.requireNonNull(builder.relocatingShards, this, "relocatingShards"); this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + this.taskMaxWaitingInQueue = builder.taskMaxWaitingInQueue; this.taskMaxWaitingInQueueMillis = ApiTypeHelper.requireNonNull(builder.taskMaxWaitingInQueueMillis, this, "taskMaxWaitingInQueueMillis"); this.timedOut = ApiTypeHelper.requireNonNull(builder.timedOut, this, "timedOut"); @@ -235,13 +240,23 @@ public final HealthStatus status() { return this.status; } + /** + * The time since the earliest initiated task is waiting for being performed. + *

+ * API name: {@code task_max_waiting_in_queue} + */ + @Nullable + public final Time taskMaxWaitingInQueue() { + return this.taskMaxWaitingInQueue; + } + /** * Required - The time expressed in milliseconds since the earliest initiated * task is waiting for being performed. *

* API name: {@code task_max_waiting_in_queue_millis} */ - public final DateTime taskMaxWaitingInQueueMillis() { + public final long taskMaxWaitingInQueueMillis() { return this.taskMaxWaitingInQueueMillis; } @@ -321,8 +336,14 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("status"); this.status.serialize(generator, mapper); + if (this.taskMaxWaitingInQueue != null) { + generator.writeKey("task_max_waiting_in_queue"); + this.taskMaxWaitingInQueue.serialize(generator, mapper); + + } generator.writeKey("task_max_waiting_in_queue_millis"); - this.taskMaxWaitingInQueueMillis.serialize(generator, mapper); + generator.write(this.taskMaxWaitingInQueueMillis); + generator.writeKey("timed_out"); generator.write(this.timedOut); @@ -370,7 +391,10 @@ public static class Builder extends WithJsonObjectBuilderBase implement private HealthStatus status; - private DateTime taskMaxWaitingInQueueMillis; + @Nullable + private Time taskMaxWaitingInQueue; + + private Long taskMaxWaitingInQueueMillis; private Boolean timedOut; @@ -527,13 +551,32 @@ public final Builder status(HealthStatus value) { return this; } + /** + * The time since the earliest initiated task is waiting for being performed. + *

+ * API name: {@code task_max_waiting_in_queue} + */ + public final Builder taskMaxWaitingInQueue(@Nullable Time value) { + this.taskMaxWaitingInQueue = value; + return this; + } + + /** + * The time since the earliest initiated task is waiting for being performed. + *

+ * API name: {@code task_max_waiting_in_queue} + */ + public final Builder taskMaxWaitingInQueue(Function> fn) { + return this.taskMaxWaitingInQueue(fn.apply(new Time.Builder()).build()); + } + /** * Required - The time expressed in milliseconds since the earliest initiated * task is waiting for being performed. *

* API name: {@code task_max_waiting_in_queue_millis} */ - public final Builder taskMaxWaitingInQueueMillis(DateTime value) { + public final Builder taskMaxWaitingInQueueMillis(long value) { this.taskMaxWaitingInQueueMillis = value; return this; } @@ -601,7 +644,9 @@ protected static void setupHealthResponseDeserializer(ObjectDeserializer implement private String source; - private String timeInQueue; + @Nullable + private Time timeInQueue; - private Integer timeInQueueMillis; + private Long timeInQueueMillis; /** * Required - API name: {@code executing} @@ -210,17 +217,24 @@ public final Builder source(String value) { } /** - * Required - API name: {@code time_in_queue} + * API name: {@code time_in_queue} */ - public final Builder timeInQueue(String value) { + public final Builder timeInQueue(@Nullable Time value) { this.timeInQueue = value; return this; } + /** + * API name: {@code time_in_queue} + */ + public final Builder timeInQueue(Function> fn) { + return this.timeInQueue(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code time_in_queue_millis} */ - public final Builder timeInQueueMillis(int value) { + public final Builder timeInQueueMillis(long value) { this.timeInQueueMillis = value; return this; } @@ -257,8 +271,8 @@ protected static void setupPendingTaskDeserializer(ObjectDeserializerDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/modules-cluster.html">Documentation * on elastic.co * @see API diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/stats/ClusterProcessor.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/stats/ClusterProcessor.java index 8ef31afb8..264875e18 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/stats/ClusterProcessor.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/stats/ClusterProcessor.java @@ -23,6 +23,7 @@ package co.elastic.clients.elasticsearch.cluster.stats; +import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -37,6 +38,7 @@ import java.lang.Long; import java.util.Objects; import java.util.function.Function; +import javax.annotation.Nullable; // typedef: cluster.stats.ClusterProcessor @@ -54,6 +56,9 @@ public class ClusterProcessor implements JsonpSerializable { private final long failed; + @Nullable + private final Time time; + private final long timeInMillis; // --------------------------------------------------------------------------------------------- @@ -63,6 +68,7 @@ private ClusterProcessor(Builder builder) { this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); this.current = ApiTypeHelper.requireNonNull(builder.current, this, "current"); this.failed = ApiTypeHelper.requireNonNull(builder.failed, this, "failed"); + this.time = builder.time; this.timeInMillis = ApiTypeHelper.requireNonNull(builder.timeInMillis, this, "timeInMillis"); } @@ -92,6 +98,14 @@ public final long failed() { return this.failed; } + /** + * API name: {@code time} + */ + @Nullable + public final Time time() { + return this.time; + } + /** * Required - API name: {@code time_in_millis} */ @@ -119,6 +133,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("failed"); generator.write(this.failed); + if (this.time != null) { + generator.writeKey("time"); + this.time.serialize(generator, mapper); + + } generator.writeKey("time_in_millis"); generator.write(this.timeInMillis); @@ -142,6 +161,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Long failed; + @Nullable + private Time time; + private Long timeInMillis; /** @@ -168,6 +190,21 @@ public final Builder failed(long value) { return this; } + /** + * API name: {@code time} + */ + public final Builder time(@Nullable Time value) { + this.time = value; + return this; + } + + /** + * API name: {@code time} + */ + public final Builder time(Function> fn) { + return this.time(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code time_in_millis} */ @@ -207,6 +244,7 @@ protected static void setupClusterProcessorDeserializer(ObjectDeserializer private Boolean requestCache; @Nullable - private Long requestsPerSecond; + private Float requestsPerSecond; @Nullable private String routing; @@ -883,7 +884,7 @@ public final Builder requestCache(@Nullable Boolean value) { *

* API name: {@code requests_per_second} */ - public final Builder requestsPerSecond(@Nullable Long value) { + public final Builder requestsPerSecond(@Nullable Float value) { this.requestsPerSecond = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryResponse.java index 69f6964bc..c0743a921 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryResponse.java @@ -25,6 +25,7 @@ import co.elastic.clients.elasticsearch._types.BulkIndexByScrollFailure; import co.elastic.clients.elasticsearch._types.Retries; +import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -80,10 +81,14 @@ public class DeleteByQueryResponse implements JsonpSerializable { private final String task; @Nullable - private final Long throttledMillis; + private final Time throttled; + + private final long throttledMillis; @Nullable - private final Long throttledUntilMillis; + private final Time throttledUntil; + + private final long throttledUntilMillis; @Nullable private final Boolean timedOut; @@ -109,8 +114,11 @@ private DeleteByQueryResponse(Builder builder) { this.retries = builder.retries; this.sliceId = builder.sliceId; this.task = builder.task; - this.throttledMillis = builder.throttledMillis; - this.throttledUntilMillis = builder.throttledUntilMillis; + this.throttled = builder.throttled; + this.throttledMillis = ApiTypeHelper.requireNonNull(builder.throttledMillis, this, "throttledMillis"); + this.throttledUntil = builder.throttledUntil; + this.throttledUntilMillis = ApiTypeHelper.requireNonNull(builder.throttledUntilMillis, this, + "throttledUntilMillis"); this.timedOut = builder.timedOut; this.took = builder.took; this.total = builder.total; @@ -186,18 +194,32 @@ public final String task() { } /** - * API name: {@code throttled_millis} + * API name: {@code throttled} */ @Nullable - public final Long throttledMillis() { + public final Time throttled() { + return this.throttled; + } + + /** + * Required - API name: {@code throttled_millis} + */ + public final long throttledMillis() { return this.throttledMillis; } /** - * API name: {@code throttled_until_millis} + * API name: {@code throttled_until} */ @Nullable - public final Long throttledUntilMillis() { + public final Time throttledUntil() { + return this.throttledUntil; + } + + /** + * Required - API name: {@code throttled_until_millis} + */ + public final long throttledUntilMillis() { return this.throttledUntilMillis; } @@ -289,16 +311,22 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.task); } - if (this.throttledMillis != null) { - generator.writeKey("throttled_millis"); - generator.write(this.throttledMillis); + if (this.throttled != null) { + generator.writeKey("throttled"); + this.throttled.serialize(generator, mapper); } - if (this.throttledUntilMillis != null) { - generator.writeKey("throttled_until_millis"); - generator.write(this.throttledUntilMillis); + generator.writeKey("throttled_millis"); + generator.write(this.throttledMillis); + + if (this.throttledUntil != null) { + generator.writeKey("throttled_until"); + this.throttledUntil.serialize(generator, mapper); } + generator.writeKey("throttled_until_millis"); + generator.write(this.throttledUntilMillis); + if (this.timedOut != null) { generator.writeKey("timed_out"); generator.write(this.timedOut); @@ -361,9 +389,13 @@ public static class Builder extends WithJsonObjectBuilderBase private String task; @Nullable + private Time throttled; + private Long throttledMillis; @Nullable + private Time throttledUntil; + private Long throttledUntilMillis; @Nullable @@ -472,17 +504,47 @@ public final Builder task(@Nullable String value) { } /** - * API name: {@code throttled_millis} + * API name: {@code throttled} + */ + public final Builder throttled(@Nullable Time value) { + this.throttled = value; + return this; + } + + /** + * API name: {@code throttled} + */ + public final Builder throttled(Function> fn) { + return this.throttled(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - API name: {@code throttled_millis} */ - public final Builder throttledMillis(@Nullable Long value) { + public final Builder throttledMillis(long value) { this.throttledMillis = value; return this; } /** - * API name: {@code throttled_until_millis} + * API name: {@code throttled_until} + */ + public final Builder throttledUntil(@Nullable Time value) { + this.throttledUntil = value; + return this; + } + + /** + * API name: {@code throttled_until} + */ + public final Builder throttledUntil(Function> fn) { + return this.throttledUntil(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - API name: {@code throttled_until_millis} */ - public final Builder throttledUntilMillis(@Nullable Long value) { + public final Builder throttledUntilMillis(long value) { this.throttledUntilMillis = value; return this; } @@ -556,7 +618,9 @@ protected static void setupDeleteByQueryResponseDeserializer(ObjectDeserializer< op.add(Builder::retries, Retries._DESERIALIZER, "retries"); op.add(Builder::sliceId, JsonpDeserializer.integerDeserializer(), "slice_id"); op.add(Builder::task, JsonpDeserializer.stringDeserializer(), "task"); + op.add(Builder::throttled, Time._DESERIALIZER, "throttled"); op.add(Builder::throttledMillis, JsonpDeserializer.longDeserializer(), "throttled_millis"); + op.add(Builder::throttledUntil, Time._DESERIALIZER, "throttled_until"); op.add(Builder::throttledUntilMillis, JsonpDeserializer.longDeserializer(), "throttled_until_millis"); op.add(Builder::timedOut, JsonpDeserializer.booleanDeserializer(), "timed_out"); op.add(Builder::took, JsonpDeserializer.longDeserializer(), "took"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRethrottleRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRethrottleRequest.java index 2c900fec2..23a406e5d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRethrottleRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRethrottleRequest.java @@ -35,7 +35,7 @@ import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.ObjectBuilderBase; import jakarta.json.stream.JsonGenerator; -import java.lang.Long; +import java.lang.Float; import java.lang.String; import java.util.HashMap; import java.util.Map; @@ -56,7 +56,7 @@ public class DeleteByQueryRethrottleRequest extends RequestBase { @Nullable - private final Long requestsPerSecond; + private final Float requestsPerSecond; private final String taskId; @@ -81,7 +81,7 @@ public static DeleteByQueryRethrottleRequest of( * API name: {@code requests_per_second} */ @Nullable - public final Long requestsPerSecond() { + public final Float requestsPerSecond() { return this.requestsPerSecond; } @@ -102,7 +102,7 @@ public final String taskId() { public static class Builder extends ObjectBuilderBase implements ObjectBuilder { @Nullable - private Long requestsPerSecond; + private Float requestsPerSecond; private String taskId; @@ -112,7 +112,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder * API name: {@code requests_per_second} */ - public final Builder requestsPerSecond(@Nullable Long value) { + public final Builder requestsPerSecond(@Nullable Float value) { this.requestsPerSecond = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ReindexRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ReindexRequest.java index c2a9c8fe9..af6b47e5c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ReindexRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ReindexRequest.java @@ -45,6 +45,7 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; +import java.lang.Float; import java.lang.Long; import java.util.HashMap; import java.util.Map; @@ -76,7 +77,7 @@ public class ReindexRequest extends RequestBase implements JsonpSerializable { private final Boolean refresh; @Nullable - private final Long requestsPerSecond; + private final Float requestsPerSecond; @Nullable private final Boolean requireAlias; @@ -169,7 +170,7 @@ public final Boolean refresh() { * API name: {@code requests_per_second} */ @Nullable - public final Long requestsPerSecond() { + public final Float requestsPerSecond() { return this.requestsPerSecond; } @@ -317,7 +318,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Boolean refresh; @Nullable - private Long requestsPerSecond; + private Float requestsPerSecond; @Nullable private Boolean requireAlias; @@ -392,7 +393,7 @@ public final Builder refresh(@Nullable Boolean value) { *

* API name: {@code requests_per_second} */ - public final Builder requestsPerSecond(@Nullable Long value) { + public final Builder requestsPerSecond(@Nullable Float value) { this.requestsPerSecond = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ReindexResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ReindexResponse.java index c5618e4b9..cad9f46d4 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ReindexResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/ReindexResponse.java @@ -25,7 +25,6 @@ import co.elastic.clients.elasticsearch._types.BulkIndexByScrollFailure; import co.elastic.clients.elasticsearch._types.Retries; -import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -34,11 +33,11 @@ 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.Boolean; +import java.lang.Float; import java.lang.Integer; import java.lang.Long; import java.lang.String; @@ -74,7 +73,7 @@ public class ReindexResponse implements JsonpSerializable { private final Retries retries; @Nullable - private final Long requestsPerSecond; + private final Float requestsPerSecond; @Nullable private final Integer sliceId; @@ -83,16 +82,16 @@ public class ReindexResponse implements JsonpSerializable { private final String task; @Nullable - private final DateTime throttledMillis; + private final Long throttledMillis; @Nullable - private final DateTime throttledUntilMillis; + private final Long throttledUntilMillis; @Nullable private final Boolean timedOut; @Nullable - private final Time took; + private final Long took; @Nullable private final Long total; @@ -181,7 +180,7 @@ public final Retries retries() { * API name: {@code requests_per_second} */ @Nullable - public final Long requestsPerSecond() { + public final Float requestsPerSecond() { return this.requestsPerSecond; } @@ -205,7 +204,7 @@ public final String task() { * API name: {@code throttled_millis} */ @Nullable - public final DateTime throttledMillis() { + public final Long throttledMillis() { return this.throttledMillis; } @@ -213,7 +212,7 @@ public final DateTime throttledMillis() { * API name: {@code throttled_until_millis} */ @Nullable - public final DateTime throttledUntilMillis() { + public final Long throttledUntilMillis() { return this.throttledUntilMillis; } @@ -229,7 +228,7 @@ public final Boolean timedOut() { * API name: {@code took} */ @Nullable - public final Time took() { + public final Long took() { return this.took; } @@ -320,11 +319,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.throttledMillis != null) { generator.writeKey("throttled_millis"); - this.throttledMillis.serialize(generator, mapper); + generator.write(this.throttledMillis); + } if (this.throttledUntilMillis != null) { generator.writeKey("throttled_until_millis"); - this.throttledUntilMillis.serialize(generator, mapper); + generator.write(this.throttledUntilMillis); + } if (this.timedOut != null) { generator.writeKey("timed_out"); @@ -333,7 +334,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.took != null) { generator.writeKey("took"); - this.took.serialize(generator, mapper); + generator.write(this.took); } if (this.total != null) { @@ -385,7 +386,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Retries retries; @Nullable - private Long requestsPerSecond; + private Float requestsPerSecond; @Nullable private Integer sliceId; @@ -394,16 +395,16 @@ public static class Builder extends WithJsonObjectBuilderBase implement private String task; @Nullable - private DateTime throttledMillis; + private Long throttledMillis; @Nullable - private DateTime throttledUntilMillis; + private Long throttledUntilMillis; @Nullable private Boolean timedOut; @Nullable - private Time took; + private Long took; @Nullable private Long total; @@ -494,7 +495,7 @@ public final Builder retries(Function> f /** * API name: {@code requests_per_second} */ - public final Builder requestsPerSecond(@Nullable Long value) { + public final Builder requestsPerSecond(@Nullable Float value) { this.requestsPerSecond = value; return this; } @@ -518,7 +519,7 @@ public final Builder task(@Nullable String value) { /** * API name: {@code throttled_millis} */ - public final Builder throttledMillis(@Nullable DateTime value) { + public final Builder throttledMillis(@Nullable Long value) { this.throttledMillis = value; return this; } @@ -526,7 +527,7 @@ public final Builder throttledMillis(@Nullable DateTime value) { /** * API name: {@code throttled_until_millis} */ - public final Builder throttledUntilMillis(@Nullable DateTime value) { + public final Builder throttledUntilMillis(@Nullable Long value) { this.throttledUntilMillis = value; return this; } @@ -542,18 +543,11 @@ public final Builder timedOut(@Nullable Boolean value) { /** * API name: {@code took} */ - public final Builder took(@Nullable Time value) { + public final Builder took(@Nullable Long value) { this.took = value; return this; } - /** - * API name: {@code took} - */ - public final Builder took(Function> fn) { - return this.took(fn.apply(new Time.Builder()).build()); - } - /** * API name: {@code total} */ @@ -613,13 +607,13 @@ protected static void setupReindexResponseDeserializer(ObjectDeserializer { @Nullable - private Long requestsPerSecond; + private Float requestsPerSecond; private String taskId; @@ -110,7 +110,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder * API name: {@code requests_per_second} */ - public final Builder requestsPerSecond(@Nullable Long value) { + public final Builder requestsPerSecond(@Nullable Float value) { this.requestsPerSecond = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRequest.java index 8d3d14103..11a71dcb9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRequest.java @@ -48,6 +48,7 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; +import java.lang.Float; import java.lang.Long; import java.lang.String; import java.util.HashMap; @@ -119,7 +120,7 @@ public class UpdateByQueryRequest extends RequestBase implements JsonpSerializab private final Boolean requestCache; @Nullable - private final Long requestsPerSecond; + private final Float requestsPerSecond; @Nullable private final String routing; @@ -391,7 +392,7 @@ public final Boolean requestCache() { * API name: {@code requests_per_second} */ @Nullable - public final Long requestsPerSecond() { + public final Float requestsPerSecond() { return this.requestsPerSecond; } @@ -657,7 +658,7 @@ public static class Builder extends WithJsonObjectBuilderBase private Boolean requestCache; @Nullable - private Long requestsPerSecond; + private Float requestsPerSecond; @Nullable private String routing; @@ -924,7 +925,7 @@ public final Builder requestCache(@Nullable Boolean value) { *

* API name: {@code requests_per_second} */ - public final Builder requestsPerSecond(@Nullable Long value) { + public final Builder requestsPerSecond(@Nullable Float value) { this.requestsPerSecond = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryResponse.java index 81929e6b3..2a76fdbca 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryResponse.java @@ -25,6 +25,7 @@ import co.elastic.clients.elasticsearch._types.BulkIndexByScrollFailure; import co.elastic.clients.elasticsearch._types.Retries; +import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -39,7 +40,6 @@ import java.lang.Boolean; import java.lang.Float; import java.lang.Long; -import java.lang.Number; import java.lang.String; import java.util.List; import java.util.Objects; @@ -92,10 +92,16 @@ public class UpdateByQueryResponse implements JsonpSerializable { private final Long versionConflicts; @Nullable - private final Number throttledMillis; + private final Time throttled; @Nullable - private final Number throttledUntilMillis; + private final Long throttledMillis; + + @Nullable + private final Time throttledUntil; + + @Nullable + private final Long throttledUntilMillis; // --------------------------------------------------------------------------------------------- @@ -113,7 +119,9 @@ private UpdateByQueryResponse(Builder builder) { this.total = builder.total; this.updated = builder.updated; this.versionConflicts = builder.versionConflicts; + this.throttled = builder.throttled; this.throttledMillis = builder.throttledMillis; + this.throttledUntil = builder.throttledUntil; this.throttledUntilMillis = builder.throttledUntilMillis; } @@ -217,19 +225,35 @@ public final Long versionConflicts() { return this.versionConflicts; } + /** + * API name: {@code throttled} + */ + @Nullable + public final Time throttled() { + return this.throttled; + } + /** * API name: {@code throttled_millis} */ @Nullable - public final Number throttledMillis() { + public final Long throttledMillis() { return this.throttledMillis; } + /** + * API name: {@code throttled_until} + */ + @Nullable + public final Time throttledUntil() { + return this.throttledUntil; + } + /** * API name: {@code throttled_until_millis} */ @Nullable - public final Number throttledUntilMillis() { + public final Long throttledUntilMillis() { return this.throttledUntilMillis; } @@ -308,15 +332,25 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("version_conflicts"); generator.write(this.versionConflicts); + } + if (this.throttled != null) { + generator.writeKey("throttled"); + this.throttled.serialize(generator, mapper); + } if (this.throttledMillis != null) { generator.writeKey("throttled_millis"); - generator.write(this.throttledMillis.doubleValue()); + generator.write(this.throttledMillis); + + } + if (this.throttledUntil != null) { + generator.writeKey("throttled_until"); + this.throttledUntil.serialize(generator, mapper); } if (this.throttledUntilMillis != null) { generator.writeKey("throttled_until_millis"); - generator.write(this.throttledUntilMillis.doubleValue()); + generator.write(this.throttledUntilMillis); } @@ -373,10 +407,16 @@ public static class Builder extends WithJsonObjectBuilderBase private Long versionConflicts; @Nullable - private Number throttledMillis; + private Time throttled; + + @Nullable + private Long throttledMillis; @Nullable - private Number throttledUntilMillis; + private Time throttledUntil; + + @Nullable + private Long throttledUntilMillis; /** * API name: {@code batches} @@ -503,18 +543,48 @@ public final Builder versionConflicts(@Nullable Long value) { return this; } + /** + * API name: {@code throttled} + */ + public final Builder throttled(@Nullable Time value) { + this.throttled = value; + return this; + } + + /** + * API name: {@code throttled} + */ + public final Builder throttled(Function> fn) { + return this.throttled(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code throttled_millis} */ - public final Builder throttledMillis(@Nullable Number value) { + public final Builder throttledMillis(@Nullable Long value) { this.throttledMillis = value; return this; } + /** + * API name: {@code throttled_until} + */ + public final Builder throttledUntil(@Nullable Time value) { + this.throttledUntil = value; + return this; + } + + /** + * API name: {@code throttled_until} + */ + public final Builder throttledUntil(Function> fn) { + return this.throttledUntil(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code throttled_until_millis} */ - public final Builder throttledUntilMillis(@Nullable Number value) { + public final Builder throttledUntilMillis(@Nullable Long value) { this.throttledUntilMillis = value; return this; } @@ -560,8 +630,10 @@ protected static void setupUpdateByQueryResponseDeserializer(ObjectDeserializer< op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); op.add(Builder::updated, JsonpDeserializer.longDeserializer(), "updated"); op.add(Builder::versionConflicts, JsonpDeserializer.longDeserializer(), "version_conflicts"); - op.add(Builder::throttledMillis, JsonpDeserializer.numberDeserializer(), "throttled_millis"); - op.add(Builder::throttledUntilMillis, JsonpDeserializer.numberDeserializer(), "throttled_until_millis"); + op.add(Builder::throttled, Time._DESERIALIZER, "throttled"); + op.add(Builder::throttledMillis, JsonpDeserializer.longDeserializer(), "throttled_millis"); + op.add(Builder::throttledUntil, Time._DESERIALIZER, "throttled_until"); + op.add(Builder::throttledUntilMillis, JsonpDeserializer.longDeserializer(), "throttled_until_millis"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRethrottleRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRethrottleRequest.java index b6badc664..e6f0b543c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRethrottleRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRethrottleRequest.java @@ -35,7 +35,7 @@ import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.ObjectBuilderBase; import jakarta.json.stream.JsonGenerator; -import java.lang.Long; +import java.lang.Float; import java.lang.String; import java.util.HashMap; import java.util.Map; @@ -56,7 +56,7 @@ public class UpdateByQueryRethrottleRequest extends RequestBase { @Nullable - private final Long requestsPerSecond; + private final Float requestsPerSecond; private final String taskId; @@ -81,7 +81,7 @@ public static UpdateByQueryRethrottleRequest of( * API name: {@code requests_per_second} */ @Nullable - public final Long requestsPerSecond() { + public final Float requestsPerSecond() { return this.requestsPerSecond; } @@ -102,7 +102,7 @@ public final String taskId() { public static class Builder extends ObjectBuilderBase implements ObjectBuilder { @Nullable - private Long requestsPerSecond; + private Float requestsPerSecond; private String taskId; @@ -112,7 +112,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder * API name: {@code requests_per_second} */ - public final Builder requestsPerSecond(@Nullable Long value) { + public final Builder requestsPerSecond(@Nullable Float value) { this.requestsPerSecond = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricDiscountedCumulativeGain.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricDiscountedCumulativeGain.java index f20ffb8a6..b611b54d1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricDiscountedCumulativeGain.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricDiscountedCumulativeGain.java @@ -41,7 +41,7 @@ * Discounted cumulative gain (DCG) * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/search-rank-eval.html#_discounted_cumulative_gain_dcg">Documentation * on elastic.co * @see API diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricExpectedReciprocalRank.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricExpectedReciprocalRank.java index 0ada395c5..b51341ac9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricExpectedReciprocalRank.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricExpectedReciprocalRank.java @@ -41,7 +41,7 @@ * Expected Reciprocal Rank (ERR) * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/search-rank-eval.html#_expected_reciprocal_rank_err">Documentation * on elastic.co * @see API diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricMeanReciprocalRank.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricMeanReciprocalRank.java index ec54e5b75..2b43ab9a5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricMeanReciprocalRank.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricMeanReciprocalRank.java @@ -38,7 +38,7 @@ * Mean Reciprocal Rank * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/search-rank-eval.html#_mean_reciprocal_rank">Documentation * on elastic.co * @see API diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricPrecision.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricPrecision.java index bb45280ba..6f27dbdfa 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricPrecision.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricPrecision.java @@ -41,7 +41,7 @@ * Precision at K (P@k) * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/search-rank-eval.html#k-precision">Documentation * on elastic.co * @see API diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricRecall.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricRecall.java index 82503bcd0..dcb3f5332 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricRecall.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/rank_eval/RankEvalMetricRecall.java @@ -38,7 +38,7 @@ * Recall at K (R@k) * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/search-rank-eval.html#k-recall">Documentation * on elastic.co * @see API diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex_rethrottle/ReindexStatus.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex_rethrottle/ReindexStatus.java index 2de195fa9..a29eece28 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex_rethrottle/ReindexStatus.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/reindex_rethrottle/ReindexStatus.java @@ -24,6 +24,7 @@ package co.elastic.clients.elasticsearch.core.reindex_rethrottle; import co.elastic.clients.elasticsearch._types.Retries; +import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -63,8 +64,14 @@ public class ReindexStatus implements JsonpSerializable { private final Retries retries; + @Nullable + private final Time throttled; + private final long throttledMillis; + @Nullable + private final Time throttledUntil; + private final long throttledUntilMillis; private final long total; @@ -83,7 +90,9 @@ private ReindexStatus(Builder builder) { this.noops = ApiTypeHelper.requireNonNull(builder.noops, this, "noops"); this.requestsPerSecond = ApiTypeHelper.requireNonNull(builder.requestsPerSecond, this, "requestsPerSecond"); this.retries = ApiTypeHelper.requireNonNull(builder.retries, this, "retries"); + this.throttled = builder.throttled; this.throttledMillis = ApiTypeHelper.requireNonNull(builder.throttledMillis, this, "throttledMillis"); + this.throttledUntil = builder.throttledUntil; this.throttledUntilMillis = ApiTypeHelper.requireNonNull(builder.throttledUntilMillis, this, "throttledUntilMillis"); this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); @@ -138,6 +147,14 @@ public final Retries retries() { return this.retries; } + /** + * API name: {@code throttled} + */ + @Nullable + public final Time throttled() { + return this.throttled; + } + /** * Required - API name: {@code throttled_millis} */ @@ -145,6 +162,14 @@ public final long throttledMillis() { return this.throttledMillis; } + /** + * API name: {@code throttled_until} + */ + @Nullable + public final Time throttledUntil() { + return this.throttledUntil; + } + /** * Required - API name: {@code throttled_until_millis} */ @@ -202,9 +227,19 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("retries"); this.retries.serialize(generator, mapper); + if (this.throttled != null) { + generator.writeKey("throttled"); + this.throttled.serialize(generator, mapper); + + } generator.writeKey("throttled_millis"); generator.write(this.throttledMillis); + if (this.throttledUntil != null) { + generator.writeKey("throttled_until"); + this.throttledUntil.serialize(generator, mapper); + + } generator.writeKey("throttled_until_millis"); generator.write(this.throttledUntilMillis); @@ -243,8 +278,14 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Retries retries; + @Nullable + private Time throttled; + private Long throttledMillis; + @Nullable + private Time throttledUntil; + private Long throttledUntilMillis; private Long total; @@ -308,6 +349,21 @@ public final Builder retries(Function> f return this.retries(fn.apply(new Retries.Builder()).build()); } + /** + * API name: {@code throttled} + */ + public final Builder throttled(@Nullable Time value) { + this.throttled = value; + return this; + } + + /** + * API name: {@code throttled} + */ + public final Builder throttled(Function> fn) { + return this.throttled(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code throttled_millis} */ @@ -316,6 +372,21 @@ public final Builder throttledMillis(long value) { return this; } + /** + * API name: {@code throttled_until} + */ + public final Builder throttledUntil(@Nullable Time value) { + this.throttledUntil = value; + return this; + } + + /** + * API name: {@code throttled_until} + */ + public final Builder throttledUntil(Function> fn) { + return this.throttledUntil(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code throttled_until_millis} */ @@ -382,7 +453,9 @@ protected static void setupReindexStatusDeserializer(ObjectDeserializerDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/query-dsl-mlt-query.html#_document_input_parameters">Documentation * on elastic.co * @see API diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/dangling_indices/list_dangling_indices/DanglingIndex.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/dangling_indices/list_dangling_indices/DanglingIndex.java index 2e75199ae..f2859a39a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/dangling_indices/list_dangling_indices/DanglingIndex.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/dangling_indices/list_dangling_indices/DanglingIndex.java @@ -31,10 +31,10 @@ 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.Long; import java.lang.String; import java.util.List; import java.util.Objects; @@ -55,7 +55,7 @@ public class DanglingIndex implements JsonpSerializable { private final String indexUuid; - private final DateTime creationDateMillis; + private final long creationDateMillis; private final List nodeIds; @@ -91,7 +91,7 @@ public final String indexUuid() { /** * Required - API name: {@code creation_date_millis} */ - public final DateTime creationDateMillis() { + public final long creationDateMillis() { return this.creationDateMillis; } @@ -120,7 +120,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.indexUuid); generator.writeKey("creation_date_millis"); - this.creationDateMillis.serialize(generator, mapper); + generator.write(this.creationDateMillis); + if (ApiTypeHelper.isDefined(this.nodeIds)) { generator.writeKey("node_ids"); generator.writeStartArray(); @@ -150,7 +151,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private String indexUuid; - private DateTime creationDateMillis; + private Long creationDateMillis; private List nodeIds; @@ -173,7 +174,7 @@ public final Builder indexUuid(String value) { /** * Required - API name: {@code creation_date_millis} */ - public final Builder creationDateMillis(DateTime value) { + public final Builder creationDateMillis(long value) { this.creationDateMillis = value; return this; } @@ -228,7 +229,7 @@ protected static void setupDanglingIndexDeserializer(ObjectDeserializer 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/8338d2cd458f9bdc08fdc840f86e314b4d755d11/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/81791d0a76ad60b997a42e782a25d39a7b5b2363/specification/" + (paths[hash] || ""); - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/eql/EqlSearchResponseBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/eql/EqlSearchResponseBase.java index 65d0c9a77..c99336051 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/eql/EqlSearchResponseBase.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/eql/EqlSearchResponseBase.java @@ -36,7 +36,7 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; -import java.lang.Integer; +import java.lang.Long; import java.lang.String; import java.util.Objects; import java.util.function.Function; @@ -62,7 +62,7 @@ public abstract class EqlSearchResponseBase implements JsonpSerializable private final Boolean isRunning; @Nullable - private final Integer took; + private final Long took; @Nullable private final Boolean timedOut; @@ -122,7 +122,7 @@ public final Boolean isRunning() { * API name: {@code took} */ @Nullable - public final Integer took() { + public final Long took() { return this.took; } @@ -205,7 +205,7 @@ protected abstract static class AbstractBuilder * API name: {@code took} */ - public final BuilderT took(@Nullable Integer value) { + public final BuilderT took(@Nullable Long value) { this.took = value; return self(); } @@ -306,7 +306,7 @@ protected static > vo op.add(AbstractBuilder::id, JsonpDeserializer.stringDeserializer(), "id"); op.add(AbstractBuilder::isPartial, JsonpDeserializer.booleanDeserializer(), "is_partial"); op.add(AbstractBuilder::isRunning, JsonpDeserializer.booleanDeserializer(), "is_running"); - op.add(AbstractBuilder::took, JsonpDeserializer.integerDeserializer(), "took"); + op.add(AbstractBuilder::took, JsonpDeserializer.longDeserializer(), "took"); op.add(AbstractBuilder::timedOut, JsonpDeserializer.booleanDeserializer(), "timed_out"); op.add(AbstractBuilder::hits, EqlHits.createEqlHitsDeserializer(tEventDeserializer), "hits"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/eql/GetEqlStatusResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/eql/GetEqlStatusResponse.java index 5f7300484..b7a089e89 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/eql/GetEqlStatusResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/eql/GetEqlStatusResponse.java @@ -31,12 +31,12 @@ 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.Boolean; import java.lang.Integer; +import java.lang.Long; import java.lang.String; import java.util.Objects; import java.util.function.Function; @@ -58,10 +58,10 @@ public class GetEqlStatusResponse implements JsonpSerializable { private final boolean isRunning; @Nullable - private final DateTime startTimeInMillis; + private final Long startTimeInMillis; @Nullable - private final DateTime expirationTimeInMillis; + private final Long expirationTimeInMillis; @Nullable private final Integer completionStatus; @@ -121,7 +121,7 @@ public final boolean isRunning() { * API name: {@code start_time_in_millis} */ @Nullable - public final DateTime startTimeInMillis() { + public final Long startTimeInMillis() { return this.startTimeInMillis; } @@ -133,7 +133,7 @@ public final DateTime startTimeInMillis() { * API name: {@code expiration_time_in_millis} */ @Nullable - public final DateTime expirationTimeInMillis() { + public final Long expirationTimeInMillis() { return this.expirationTimeInMillis; } @@ -169,11 +169,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.startTimeInMillis != null) { generator.writeKey("start_time_in_millis"); - this.startTimeInMillis.serialize(generator, mapper); + generator.write(this.startTimeInMillis); + } if (this.expirationTimeInMillis != null) { generator.writeKey("expiration_time_in_millis"); - this.expirationTimeInMillis.serialize(generator, mapper); + generator.write(this.expirationTimeInMillis); + } if (this.completionStatus != null) { generator.writeKey("completion_status"); @@ -204,10 +206,10 @@ public static class Builder extends WithJsonObjectBuilderBase private Boolean isRunning; @Nullable - private DateTime startTimeInMillis; + private Long startTimeInMillis; @Nullable - private DateTime expirationTimeInMillis; + private Long expirationTimeInMillis; @Nullable private Integer completionStatus; @@ -252,7 +254,7 @@ public final Builder isRunning(boolean value) { *

* API name: {@code start_time_in_millis} */ - public final Builder startTimeInMillis(@Nullable DateTime value) { + public final Builder startTimeInMillis(@Nullable Long value) { this.startTimeInMillis = value; return this; } @@ -264,7 +266,7 @@ public final Builder startTimeInMillis(@Nullable DateTime value) { *

* API name: {@code expiration_time_in_millis} */ - public final Builder expirationTimeInMillis(@Nullable DateTime value) { + public final Builder expirationTimeInMillis(@Nullable Long value) { this.expirationTimeInMillis = value; return this; } @@ -310,8 +312,8 @@ protected static void setupGetEqlStatusResponseDeserializer(ObjectDeserializer stepInfo; - private final DateTime stepTimeMillis; + @Nullable + private final DateTime stepTime; + + @Nullable + private final Long stepTimeMillis; + @Nullable private final LifecycleExplainPhaseExecution phaseExecution; @Nullable @@ -98,23 +123,27 @@ public class LifecycleExplainManaged implements LifecycleExplainVariant, JsonpSe private LifecycleExplainManaged(Builder builder) { - this.action = ApiTypeHelper.requireNonNull(builder.action, this, "action"); - this.actionTimeMillis = ApiTypeHelper.requireNonNull(builder.actionTimeMillis, this, "actionTimeMillis"); - this.age = ApiTypeHelper.requireNonNull(builder.age, this, "age"); + this.action = builder.action; + this.actionTime = builder.actionTime; + this.actionTimeMillis = builder.actionTimeMillis; + this.age = builder.age; this.failedStep = builder.failedStep; this.failedStepRetryCount = builder.failedStepRetryCount; - this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); + this.index = builder.index; + this.indexCreationDate = builder.indexCreationDate; this.indexCreationDateMillis = builder.indexCreationDateMillis; this.isAutoRetryableError = builder.isAutoRetryableError; - this.lifecycleDateMillis = ApiTypeHelper.requireNonNull(builder.lifecycleDateMillis, this, - "lifecycleDateMillis"); + this.lifecycleDate = builder.lifecycleDate; + this.lifecycleDateMillis = builder.lifecycleDateMillis; this.phase = ApiTypeHelper.requireNonNull(builder.phase, this, "phase"); - this.phaseTimeMillis = ApiTypeHelper.requireNonNull(builder.phaseTimeMillis, this, "phaseTimeMillis"); + this.phaseTime = builder.phaseTime; + this.phaseTimeMillis = builder.phaseTimeMillis; this.policy = ApiTypeHelper.requireNonNull(builder.policy, this, "policy"); - this.step = ApiTypeHelper.requireNonNull(builder.step, this, "step"); + this.step = builder.step; this.stepInfo = ApiTypeHelper.unmodifiable(builder.stepInfo); - this.stepTimeMillis = ApiTypeHelper.requireNonNull(builder.stepTimeMillis, this, "stepTimeMillis"); - this.phaseExecution = ApiTypeHelper.requireNonNull(builder.phaseExecution, this, "phaseExecution"); + this.stepTime = builder.stepTime; + this.stepTimeMillis = builder.stepTimeMillis; + this.phaseExecution = builder.phaseExecution; this.timeSinceIndexCreation = builder.timeSinceIndexCreation; } @@ -132,22 +161,33 @@ public LifecycleExplain.Kind _lifecycleExplainKind() { } /** - * Required - API name: {@code action} + * API name: {@code action} */ + @Nullable public final String action() { return this.action; } /** - * Required - API name: {@code action_time_millis} + * API name: {@code action_time} + */ + @Nullable + public final DateTime actionTime() { + return this.actionTime; + } + + /** + * API name: {@code action_time_millis} */ - public final DateTime actionTimeMillis() { + @Nullable + public final Long actionTimeMillis() { return this.actionTimeMillis; } /** - * Required - API name: {@code age} + * API name: {@code age} */ + @Nullable public final Time age() { return this.age; } @@ -169,17 +209,26 @@ public final Integer failedStepRetryCount() { } /** - * Required - API name: {@code index} + * API name: {@code index} */ + @Nullable public final String index() { return this.index; } + /** + * API name: {@code index_creation_date} + */ + @Nullable + public final DateTime indexCreationDate() { + return this.indexCreationDate; + } + /** * API name: {@code index_creation_date_millis} */ @Nullable - public final DateTime indexCreationDateMillis() { + public final Long indexCreationDateMillis() { return this.indexCreationDateMillis; } @@ -192,9 +241,18 @@ public final Boolean isAutoRetryableError() { } /** - * Required - API name: {@code lifecycle_date_millis} + * API name: {@code lifecycle_date} */ - public final DateTime lifecycleDateMillis() { + @Nullable + public final DateTime lifecycleDate() { + return this.lifecycleDate; + } + + /** + * API name: {@code lifecycle_date_millis} + */ + @Nullable + public final Long lifecycleDateMillis() { return this.lifecycleDateMillis; } @@ -206,9 +264,18 @@ public final String phase() { } /** - * Required - API name: {@code phase_time_millis} + * API name: {@code phase_time} + */ + @Nullable + public final DateTime phaseTime() { + return this.phaseTime; + } + + /** + * API name: {@code phase_time_millis} */ - public final DateTime phaseTimeMillis() { + @Nullable + public final Long phaseTimeMillis() { return this.phaseTimeMillis; } @@ -220,8 +287,9 @@ public final String policy() { } /** - * Required - API name: {@code step} + * API name: {@code step} */ + @Nullable public final String step() { return this.step; } @@ -234,15 +302,25 @@ public final Map stepInfo() { } /** - * Required - API name: {@code step_time_millis} + * API name: {@code step_time} + */ + @Nullable + public final DateTime stepTime() { + return this.stepTime; + } + + /** + * API name: {@code step_time_millis} */ - public final DateTime stepTimeMillis() { + @Nullable + public final Long stepTimeMillis() { return this.stepTimeMillis; } /** - * Required - API name: {@code phase_execution} + * API name: {@code phase_execution} */ + @Nullable public final LifecycleExplainPhaseExecution phaseExecution() { return this.phaseExecution; } @@ -268,14 +346,25 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write("managed", "true"); - generator.writeKey("action"); - generator.write(this.action); + if (this.action != null) { + generator.writeKey("action"); + generator.write(this.action); - generator.writeKey("action_time_millis"); - this.actionTimeMillis.serialize(generator, mapper); - generator.writeKey("age"); - this.age.serialize(generator, mapper); + } + if (this.actionTime != null) { + generator.writeKey("action_time"); + this.actionTime.serialize(generator, mapper); + } + if (this.actionTimeMillis != null) { + generator.writeKey("action_time_millis"); + generator.write(this.actionTimeMillis); + } + if (this.age != null) { + generator.writeKey("age"); + this.age.serialize(generator, mapper); + + } if (this.failedStep != null) { generator.writeKey("failed_step"); generator.write(this.failedStep); @@ -286,31 +375,54 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.failedStepRetryCount); } - generator.writeKey("index"); - generator.write(this.index); + if (this.index != null) { + generator.writeKey("index"); + generator.write(this.index); + } + if (this.indexCreationDate != null) { + generator.writeKey("index_creation_date"); + this.indexCreationDate.serialize(generator, mapper); + } if (this.indexCreationDateMillis != null) { generator.writeKey("index_creation_date_millis"); - this.indexCreationDateMillis.serialize(generator, mapper); + generator.write(this.indexCreationDateMillis); + } if (this.isAutoRetryableError != null) { generator.writeKey("is_auto_retryable_error"); generator.write(this.isAutoRetryableError); } - generator.writeKey("lifecycle_date_millis"); - this.lifecycleDateMillis.serialize(generator, mapper); + if (this.lifecycleDate != null) { + generator.writeKey("lifecycle_date"); + this.lifecycleDate.serialize(generator, mapper); + } + if (this.lifecycleDateMillis != null) { + generator.writeKey("lifecycle_date_millis"); + generator.write(this.lifecycleDateMillis); + + } generator.writeKey("phase"); generator.write(this.phase); - generator.writeKey("phase_time_millis"); - this.phaseTimeMillis.serialize(generator, mapper); + if (this.phaseTime != null) { + generator.writeKey("phase_time"); + this.phaseTime.serialize(generator, mapper); + } + if (this.phaseTimeMillis != null) { + generator.writeKey("phase_time_millis"); + generator.write(this.phaseTimeMillis); + + } generator.writeKey("policy"); generator.write(this.policy); - generator.writeKey("step"); - generator.write(this.step); + if (this.step != null) { + generator.writeKey("step"); + generator.write(this.step); + } if (ApiTypeHelper.isDefined(this.stepInfo)) { generator.writeKey("step_info"); generator.writeStartObject(); @@ -322,11 +434,20 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - generator.writeKey("step_time_millis"); - this.stepTimeMillis.serialize(generator, mapper); - generator.writeKey("phase_execution"); - this.phaseExecution.serialize(generator, mapper); + if (this.stepTime != null) { + generator.writeKey("step_time"); + this.stepTime.serialize(generator, mapper); + } + if (this.stepTimeMillis != null) { + generator.writeKey("step_time_millis"); + generator.write(this.stepTimeMillis); + } + if (this.phaseExecution != null) { + generator.writeKey("phase_execution"); + this.phaseExecution.serialize(generator, mapper); + + } if (this.timeSinceIndexCreation != null) { generator.writeKey("time_since_index_creation"); this.timeSinceIndexCreation.serialize(generator, mapper); @@ -349,10 +470,16 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable private String action; - private DateTime actionTimeMillis; + @Nullable + private DateTime actionTime; + + @Nullable + private Long actionTimeMillis; + @Nullable private Time age; @Nullable @@ -361,60 +488,86 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private Integer failedStepRetryCount; + @Nullable private String index; @Nullable - private DateTime indexCreationDateMillis; + private DateTime indexCreationDate; + + @Nullable + private Long indexCreationDateMillis; @Nullable private Boolean isAutoRetryableError; - private DateTime lifecycleDateMillis; + @Nullable + private DateTime lifecycleDate; + + @Nullable + private Long lifecycleDateMillis; private String phase; - private DateTime phaseTimeMillis; + @Nullable + private DateTime phaseTime; + + @Nullable + private Long phaseTimeMillis; private String policy; + @Nullable private String step; @Nullable private Map stepInfo; - private DateTime stepTimeMillis; + @Nullable + private DateTime stepTime; + + @Nullable + private Long stepTimeMillis; + @Nullable private LifecycleExplainPhaseExecution phaseExecution; @Nullable private Time timeSinceIndexCreation; /** - * Required - API name: {@code action} + * API name: {@code action} */ - public final Builder action(String value) { + public final Builder action(@Nullable String value) { this.action = value; return this; } /** - * Required - API name: {@code action_time_millis} + * API name: {@code action_time} */ - public final Builder actionTimeMillis(DateTime value) { + public final Builder actionTime(@Nullable DateTime value) { + this.actionTime = value; + return this; + } + + /** + * API name: {@code action_time_millis} + */ + public final Builder actionTimeMillis(@Nullable Long value) { this.actionTimeMillis = value; return this; } /** - * Required - API name: {@code age} + * API name: {@code age} */ - public final Builder age(Time value) { + public final Builder age(@Nullable Time value) { this.age = value; return this; } /** - * Required - API name: {@code age} + * API name: {@code age} */ public final Builder age(Function> fn) { return this.age(fn.apply(new Time.Builder()).build()); @@ -437,17 +590,25 @@ public final Builder failedStepRetryCount(@Nullable Integer value) { } /** - * Required - API name: {@code index} + * API name: {@code index} */ - public final Builder index(String value) { + public final Builder index(@Nullable String value) { this.index = value; return this; } + /** + * API name: {@code index_creation_date} + */ + public final Builder indexCreationDate(@Nullable DateTime value) { + this.indexCreationDate = value; + return this; + } + /** * API name: {@code index_creation_date_millis} */ - public final Builder indexCreationDateMillis(@Nullable DateTime value) { + public final Builder indexCreationDateMillis(@Nullable Long value) { this.indexCreationDateMillis = value; return this; } @@ -461,9 +622,17 @@ public final Builder isAutoRetryableError(@Nullable Boolean value) { } /** - * Required - API name: {@code lifecycle_date_millis} + * API name: {@code lifecycle_date} */ - public final Builder lifecycleDateMillis(DateTime value) { + public final Builder lifecycleDate(@Nullable DateTime value) { + this.lifecycleDate = value; + return this; + } + + /** + * API name: {@code lifecycle_date_millis} + */ + public final Builder lifecycleDateMillis(@Nullable Long value) { this.lifecycleDateMillis = value; return this; } @@ -477,9 +646,17 @@ public final Builder phase(String value) { } /** - * Required - API name: {@code phase_time_millis} + * API name: {@code phase_time} + */ + public final Builder phaseTime(@Nullable DateTime value) { + this.phaseTime = value; + return this; + } + + /** + * API name: {@code phase_time_millis} */ - public final Builder phaseTimeMillis(DateTime value) { + public final Builder phaseTimeMillis(@Nullable Long value) { this.phaseTimeMillis = value; return this; } @@ -493,9 +670,9 @@ public final Builder policy(String value) { } /** - * Required - API name: {@code step} + * API name: {@code step} */ - public final Builder step(String value) { + public final Builder step(@Nullable String value) { this.step = value; return this; } @@ -521,23 +698,31 @@ public final Builder stepInfo(String key, JsonData value) { } /** - * Required - API name: {@code step_time_millis} + * API name: {@code step_time} + */ + public final Builder stepTime(@Nullable DateTime value) { + this.stepTime = value; + return this; + } + + /** + * API name: {@code step_time_millis} */ - public final Builder stepTimeMillis(DateTime value) { + public final Builder stepTimeMillis(@Nullable Long value) { this.stepTimeMillis = value; return this; } /** - * Required - API name: {@code phase_execution} + * API name: {@code phase_execution} */ - public final Builder phaseExecution(LifecycleExplainPhaseExecution value) { + public final Builder phaseExecution(@Nullable LifecycleExplainPhaseExecution value) { this.phaseExecution = value; return this; } /** - * Required - API name: {@code phase_execution} + * API name: {@code phase_execution} */ public final Builder phaseExecution( Function> fn) { @@ -589,20 +774,25 @@ protected static void setupLifecycleExplainManagedDeserializer( ObjectDeserializer op) { op.add(Builder::action, JsonpDeserializer.stringDeserializer(), "action"); - op.add(Builder::actionTimeMillis, DateTime._DESERIALIZER, "action_time_millis"); + op.add(Builder::actionTime, DateTime._DESERIALIZER, "action_time"); + op.add(Builder::actionTimeMillis, JsonpDeserializer.longDeserializer(), "action_time_millis"); op.add(Builder::age, Time._DESERIALIZER, "age"); op.add(Builder::failedStep, JsonpDeserializer.stringDeserializer(), "failed_step"); op.add(Builder::failedStepRetryCount, JsonpDeserializer.integerDeserializer(), "failed_step_retry_count"); op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); - op.add(Builder::indexCreationDateMillis, DateTime._DESERIALIZER, "index_creation_date_millis"); + op.add(Builder::indexCreationDate, DateTime._DESERIALIZER, "index_creation_date"); + op.add(Builder::indexCreationDateMillis, JsonpDeserializer.longDeserializer(), "index_creation_date_millis"); op.add(Builder::isAutoRetryableError, JsonpDeserializer.booleanDeserializer(), "is_auto_retryable_error"); - op.add(Builder::lifecycleDateMillis, DateTime._DESERIALIZER, "lifecycle_date_millis"); + op.add(Builder::lifecycleDate, DateTime._DESERIALIZER, "lifecycle_date"); + op.add(Builder::lifecycleDateMillis, JsonpDeserializer.longDeserializer(), "lifecycle_date_millis"); op.add(Builder::phase, JsonpDeserializer.stringDeserializer(), "phase"); - op.add(Builder::phaseTimeMillis, DateTime._DESERIALIZER, "phase_time_millis"); + op.add(Builder::phaseTime, DateTime._DESERIALIZER, "phase_time"); + op.add(Builder::phaseTimeMillis, JsonpDeserializer.longDeserializer(), "phase_time_millis"); op.add(Builder::policy, JsonpDeserializer.stringDeserializer(), "policy"); op.add(Builder::step, JsonpDeserializer.stringDeserializer(), "step"); op.add(Builder::stepInfo, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "step_info"); - op.add(Builder::stepTimeMillis, DateTime._DESERIALIZER, "step_time_millis"); + op.add(Builder::stepTime, DateTime._DESERIALIZER, "step_time"); + op.add(Builder::stepTimeMillis, JsonpDeserializer.longDeserializer(), "step_time_millis"); op.add(Builder::phaseExecution, LifecycleExplainPhaseExecution._DESERIALIZER, "phase_execution"); op.add(Builder::timeSinceIndexCreation, Time._DESERIALIZER, "time_since_index_creation"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/explain_lifecycle/LifecycleExplainPhaseExecution.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/explain_lifecycle/LifecycleExplainPhaseExecution.java index f7eb06224..21e05e3df 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/explain_lifecycle/LifecycleExplainPhaseExecution.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/explain_lifecycle/LifecycleExplainPhaseExecution.java @@ -31,7 +31,6 @@ 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; @@ -55,7 +54,7 @@ public class LifecycleExplainPhaseExecution implements JsonpSerializable { private final long version; - private final DateTime modifiedDateInMillis; + private final long modifiedDateInMillis; // --------------------------------------------------------------------------------------------- @@ -90,7 +89,7 @@ public final long version() { /** * Required - API name: {@code modified_date_in_millis} */ - public final DateTime modifiedDateInMillis() { + public final long modifiedDateInMillis() { return this.modifiedDateInMillis; } @@ -112,7 +111,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.version); generator.writeKey("modified_date_in_millis"); - this.modifiedDateInMillis.serialize(generator, mapper); + generator.write(this.modifiedDateInMillis); } @@ -134,7 +133,7 @@ public static class Builder extends WithJsonObjectBuilderBase private Long version; - private DateTime modifiedDateInMillis; + private Long modifiedDateInMillis; /** * Required - API name: {@code policy} @@ -155,7 +154,7 @@ public final Builder version(long value) { /** * Required - API name: {@code modified_date_in_millis} */ - public final Builder modifiedDateInMillis(DateTime value) { + public final Builder modifiedDateInMillis(long value) { this.modifiedDateInMillis = value; return this; } @@ -191,7 +190,7 @@ protected static void setupLifecycleExplainPhaseExecutionDeserializer( op.add(Builder::policy, JsonpDeserializer.stringDeserializer(), "policy"); op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); - op.add(Builder::modifiedDateInMillis, DateTime._DESERIALIZER, "modified_date_in_millis"); + op.add(Builder::modifiedDateInMillis, JsonpDeserializer.longDeserializer(), "modified_date_in_millis"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DiskUsageRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DiskUsageRequest.java index d9ca48556..06d83fa27 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DiskUsageRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DiskUsageRequest.java @@ -26,7 +26,6 @@ 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.TimeUnit; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.ObjectBuilderDeserializer; @@ -68,20 +67,11 @@ public class DiskUsageRequest extends RequestBase { @Nullable private final Boolean ignoreUnavailable; - private final String index; - - @Nullable - private final TimeUnit masterTimeout; + private final List index; @Nullable private final Boolean runExpensiveTasks; - @Nullable - private final TimeUnit timeout; - - @Nullable - private final String waitForActiveShards; - // --------------------------------------------------------------------------------------------- private DiskUsageRequest(Builder builder) { @@ -90,11 +80,8 @@ private DiskUsageRequest(Builder builder) { this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.flush = builder.flush; this.ignoreUnavailable = builder.ignoreUnavailable; - this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - this.masterTimeout = builder.masterTimeout; + this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); this.runExpensiveTasks = builder.runExpensiveTasks; - this.timeout = builder.timeout; - this.waitForActiveShards = builder.waitForActiveShards; } @@ -156,21 +143,10 @@ public final Boolean ignoreUnavailable() { *

* API name: {@code index} */ - public final String index() { + public final List index() { return this.index; } - /** - * Period to wait for a connection to the master node. If no response is - * received before the timeout expires, the request fails and returns an error. - *

- * API name: {@code master_timeout} - */ - @Nullable - public final TimeUnit masterTimeout() { - return this.masterTimeout; - } - /** * Analyzing field disk usage is resource-intensive. To use the API, this * parameter must be set to true. @@ -182,29 +158,6 @@ public final Boolean runExpensiveTasks() { return this.runExpensiveTasks; } - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - @Nullable - public final TimeUnit timeout() { - return this.timeout; - } - - /** - * The number of shard copies that must be active before proceeding with the - * operation. Set to all or any positive integer up to the total number of - * shards in the index (number_of_replicas+1). Default: 1, the primary shard. - *

- * API name: {@code wait_for_active_shards} - */ - @Nullable - public final String waitForActiveShards() { - return this.waitForActiveShards; - } - // --------------------------------------------------------------------------------------------- /** @@ -224,20 +177,11 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder index; @Nullable private Boolean runExpensiveTasks; - @Nullable - private TimeUnit timeout; - - @Nullable - private String waitForActiveShards; - /** * If false, the request returns an error if any wildcard expression, index * alias, or _all value targets only missing or closed indices. This behavior @@ -308,20 +252,26 @@ public final Builder ignoreUnavailable(@Nullable Boolean value) { * significantly. *

* API name: {@code index} + *

+ * Adds all elements of list to index. */ - public final Builder index(String value) { - this.index = value; + public final Builder index(List list) { + this.index = _listAddAll(this.index, list); return this; } /** - * Period to wait for a connection to the master node. If no response is - * received before the timeout expires, the request fails and returns an error. + * Required - Comma-separated list of data streams, indices, and aliases used to + * limit the request. It’s recommended to execute this API with a single index + * (or the latest backing index of a data stream) as the API consumes resources + * significantly. + *

+ * API name: {@code index} *

- * API name: {@code master_timeout} + * Adds one or more values to index. */ - public final Builder masterTimeout(@Nullable TimeUnit value) { - this.masterTimeout = value; + public final Builder index(String value, String... values) { + this.index = _listAdd(this.index, value, values); return this; } @@ -336,29 +286,6 @@ public final Builder runExpensiveTasks(@Nullable Boolean value) { return this; } - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. - *

- * API name: {@code timeout} - */ - public final Builder timeout(@Nullable TimeUnit value) { - this.timeout = value; - return this; - } - - /** - * The number of shard copies that must be active before proceeding with the - * operation. Set to all or any positive integer up to the total number of - * shards in the index (number_of_replicas+1). Default: 1, the primary shard. - *

- * API name: {@code wait_for_active_shards} - */ - public final Builder waitForActiveShards(@Nullable String value) { - this.waitForActiveShards = value; - return this; - } - /** * Builds a {@link DiskUsageRequest}. * @@ -397,7 +324,7 @@ public DiskUsageRequest build() { if (propsSet == (_index)) { StringBuilder buf = new StringBuilder(); buf.append("/"); - SimpleEndpoint.pathEncode(request.index, buf); + SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); buf.append("/_disk_usage"); return buf.toString(); } @@ -408,9 +335,6 @@ public DiskUsageRequest build() { // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout.jsonValue()); - } if (request.flush != null) { params.put("flush", String.valueOf(request.flush)); } @@ -424,15 +348,9 @@ public DiskUsageRequest build() { if (request.allowNoIndices != null) { params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); } - if (request.waitForActiveShards != null) { - params.put("wait_for_active_shards", request.waitForActiveShards); - } if (request.runExpensiveTasks != null) { params.put("run_expensive_tasks", String.valueOf(request.runExpensiveTasks)); } - if (request.timeout != null) { - params.put("timeout", request.timeout.jsonValue()); - } return params; }, SimpleEndpoint.emptyMap(), false, DiskUsageResponse._DESERIALIZER); 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 45f49f71d..08bd87b2a 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 @@ -24,6 +24,7 @@ package co.elastic.clients.elasticsearch.indices; import co.elastic.clients.elasticsearch._types.Time; +import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -38,8 +39,11 @@ import jakarta.json.stream.JsonGenerator; import java.lang.Boolean; import java.lang.Integer; +import java.lang.Long; 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 javax.annotation.Nullable; @@ -49,13 +53,15 @@ /** * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/index-modules.html#index-modules-settings">Documentation * on elastic.co * @see API * specification */ @JsonpDeserializable public class IndexSettings implements JsonpSerializable { + private final Map otherSettings; + @Nullable private final IndexSettings index; @@ -164,7 +170,7 @@ public class IndexSettings implements JsonpSerializable { private final String providedName; @Nullable - private final DateTime creationDate; + private final Long creationDate; @Nullable private final DateTime creationDateString; @@ -215,7 +221,7 @@ public class IndexSettings implements JsonpSerializable { private final SettingsSimilarity similarity; @Nullable - private final MappingLimitSettings mappings; + private final MappingLimitSettings mapping; @Nullable private final SlowlogSettings indexingSlowlog; @@ -230,6 +236,8 @@ public class IndexSettings implements JsonpSerializable { private IndexSettings(Builder builder) { + this.otherSettings = ApiTypeHelper.unmodifiable(builder.otherSettings); + this.index = builder.index; this.mode = builder.mode; this.routingPath = ApiTypeHelper.unmodifiable(builder.routingPath); @@ -283,7 +291,7 @@ private IndexSettings(Builder builder) { this.shards = builder.shards; this.queries = builder.queries; this.similarity = builder.similarity; - this.mappings = builder.mappings; + this.mapping = builder.mapping; this.indexingSlowlog = builder.indexingSlowlog; this.indexingPressure = builder.indexingPressure; this.store = builder.store; @@ -294,6 +302,16 @@ public static IndexSettings of(Function> f return fn.apply(new Builder()).build(); } + /** + * Additional settings not covered in this type. Unless these settings are + * defined by a plugin, please open an issue on the Elasticsearch API + * specification so that they can be added in a future release. + */ + public final Map otherSettings() { + return this.otherSettings; + } + /** * API name: {@code index} */ @@ -588,7 +606,7 @@ public final String providedName() { * API name: {@code creation_date} */ @Nullable - public final DateTime creationDate() { + public final Long creationDate() { return this.creationDate; } @@ -726,11 +744,11 @@ public final SettingsSimilarity similarity() { /** * Enable or disable dynamic mapping for an index. *

- * API name: {@code mappings} + * API name: {@code mapping} */ @Nullable - public final MappingLimitSettings mappings() { - return this.mappings; + public final MappingLimitSettings mapping() { + return this.mapping; } /** @@ -773,6 +791,12 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + for (Map.Entry item0 : this.otherSettings.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + if (this.index != null) { generator.writeKey("index"); this.index.serialize(generator, mapper); @@ -959,7 +983,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.creationDate != null) { generator.writeKey("creation_date"); - this.creationDate.serialize(generator, mapper); + generator.write(this.creationDate); + } if (this.creationDateString != null) { generator.writeKey("creation_date_string"); @@ -1040,9 +1065,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.similarity.serialize(generator, mapper); } - if (this.mappings != null) { - generator.writeKey("mappings"); - this.mappings.serialize(generator, mapper); + if (this.mapping != null) { + generator.writeKey("mapping"); + this.mapping.serialize(generator, mapper); } if (this.indexingSlowlog != null) { @@ -1075,6 +1100,35 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private Map otherSettings = new HashMap<>(); + + /** + * Additional settings not covered in this type. Unless these settings are + * defined by a plugin, please open an issue on the Elasticsearch API + * specification so that they can be added in a future release. + *

+ * Adds all entries of map to otherSettings. + */ + public final Builder otherSettings(Map map) { + this.otherSettings = _mapPutAll(this.otherSettings, map); + return this; + } + + /** + * Additional settings not covered in this type. Unless these settings are + * defined by a plugin, please open an issue on the Elasticsearch API + * specification so that they can be added in a future release. + *

+ * Adds an entry to otherSettings. + */ + public final Builder otherSettings(String key, JsonData value) { + this.otherSettings = _mapPut(this.otherSettings, key, value); + return this; + } + @Nullable private IndexSettings index; @@ -1184,7 +1238,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private String providedName; @Nullable - private DateTime creationDate; + private Long creationDate; @Nullable private DateTime creationDateString; @@ -1235,7 +1289,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private SettingsSimilarity similarity; @Nullable - private MappingLimitSettings mappings; + private MappingLimitSettings mapping; @Nullable private SlowlogSettings indexingSlowlog; @@ -1640,7 +1694,7 @@ public final Builder providedName(@Nullable String value) { /** * API name: {@code creation_date} */ - public final Builder creationDate(@Nullable DateTime value) { + public final Builder creationDate(@Nullable Long value) { this.creationDate = value; return this; } @@ -1840,20 +1894,20 @@ public final Builder similarity(Function - * API name: {@code mappings} + * API name: {@code mapping} */ - public final Builder mappings(@Nullable MappingLimitSettings value) { - this.mappings = value; + public final Builder mapping(@Nullable MappingLimitSettings value) { + this.mapping = value; return this; } /** * Enable or disable dynamic mapping for an index. *

- * API name: {@code mappings} + * API name: {@code mapping} */ - public final Builder mappings(Function> fn) { - return this.mappings(fn.apply(new MappingLimitSettings.Builder()).build()); + public final Builder mapping(Function> fn) { + return this.mapping(fn.apply(new MappingLimitSettings.Builder()).build()); } /** @@ -1977,7 +2031,7 @@ protected static void setupIndexSettingsDeserializer(ObjectDeserializer { + builder.otherSettings(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); + }); + } } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettings.java index cf76d201d..ff3a6b5cc 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettings.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/MappingLimitSettings.java @@ -44,7 +44,7 @@ * Mapping Limit Settings * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/mapping-settings-limit.html">Documentation * on elastic.co * @see API diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/field_usage_stats/UsageStatsShards.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/field_usage_stats/UsageStatsShards.java index 8c805f6d1..29f2d3c8f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/field_usage_stats/UsageStatsShards.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/field_usage_stats/UsageStatsShards.java @@ -32,10 +32,10 @@ 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.Long; import java.lang.String; import java.util.Objects; import java.util.function.Function; @@ -57,7 +57,7 @@ public class UsageStatsShards implements JsonpSerializable { private final String trackingId; - private final DateTime trackingStartedAtMillis; + private final long trackingStartedAtMillis; // --------------------------------------------------------------------------------------------- @@ -99,7 +99,7 @@ public final String trackingId() { /** * Required - API name: {@code tracking_started_at_millis} */ - public final DateTime trackingStartedAtMillis() { + public final long trackingStartedAtMillis() { return this.trackingStartedAtMillis; } @@ -124,7 +124,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.trackingId); generator.writeKey("tracking_started_at_millis"); - this.trackingStartedAtMillis.serialize(generator, mapper); + generator.write(this.trackingStartedAtMillis); } @@ -146,7 +146,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private String trackingId; - private DateTime trackingStartedAtMillis; + private Long trackingStartedAtMillis; /** * Required - API name: {@code routing} @@ -189,7 +189,7 @@ public final Builder trackingId(String value) { /** * Required - API name: {@code tracking_started_at_millis} */ - public final Builder trackingStartedAtMillis(DateTime value) { + public final Builder trackingStartedAtMillis(long value) { this.trackingStartedAtMillis = value; return this; } @@ -225,7 +225,7 @@ protected static void setupUsageStatsShardsDeserializer(ObjectDeserializer @Nullable private Time sourceThrottleTime; - private DateTime sourceThrottleTimeInMillis; + private Long sourceThrottleTimeInMillis; @Nullable private Time targetThrottleTime; - private DateTime targetThrottleTimeInMillis; - - private DateTime totalTimeInMillis; + private Long targetThrottleTimeInMillis; @Nullable private Time totalTime; + private Long totalTimeInMillis; + /** * API name: {@code bytes} */ @@ -306,7 +308,7 @@ public final Builder sourceThrottleTime(Function> fn) { return this.totalTime(fn.apply(new Time.Builder()).build()); } + /** + * Required - API name: {@code total_time_in_millis} + */ + public final Builder totalTimeInMillis(long value) { + this.totalTimeInMillis = value; + return this; + } + @Override protected Builder self() { return this; @@ -389,11 +391,13 @@ protected static void setupRecoveryIndexStatusDeserializer(ObjectDeserializer implements ObjectBuilder { - private Long checkIndexTime; + @Nullable + private Time checkIndexTime; + + private Long checkIndexTimeInMillis; - private String totalTimeInMillis; + @Nullable + private Time totalTime; + + private Long totalTimeInMillis; /** - * Required - API name: {@code check_index_time} + * API name: {@code check_index_time} */ - public final Builder checkIndexTime(long value) { + public final Builder checkIndexTime(@Nullable Time value) { this.checkIndexTime = value; return this; } + /** + * API name: {@code check_index_time} + */ + public final Builder checkIndexTime(Function> fn) { + return this.checkIndexTime(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - API name: {@code check_index_time_in_millis} + */ + public final Builder checkIndexTimeInMillis(long value) { + this.checkIndexTimeInMillis = value; + return this; + } + + /** + * API name: {@code total_time} + */ + public final Builder totalTime(@Nullable Time value) { + this.totalTime = value; + return this; + } + + /** + * API name: {@code total_time} + */ + public final Builder totalTime(Function> fn) { + return this.totalTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_time_in_millis} */ - public final Builder totalTimeInMillis(String value) { + public final Builder totalTimeInMillis(long value) { this.totalTimeInMillis = value; return this; } @@ -162,8 +233,10 @@ public RecoveryStartStatus build() { protected static void setupRecoveryStartStatusDeserializer(ObjectDeserializer op) { - op.add(Builder::checkIndexTime, JsonpDeserializer.longDeserializer(), "check_index_time"); - op.add(Builder::totalTimeInMillis, JsonpDeserializer.stringDeserializer(), "total_time_in_millis"); + op.add(Builder::checkIndexTime, Time._DESERIALIZER, "check_index_time"); + op.add(Builder::checkIndexTimeInMillis, JsonpDeserializer.longDeserializer(), "check_index_time_in_millis"); + op.add(Builder::totalTime, Time._DESERIALIZER, "total_time"); + op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/recovery/ShardRecovery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/recovery/ShardRecovery.java index 28cc83c15..7d19ca69a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/recovery/ShardRecovery.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/recovery/ShardRecovery.java @@ -23,6 +23,7 @@ package co.elastic.clients.elasticsearch.indices.recovery; +import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -68,19 +69,20 @@ public class ShardRecovery implements JsonpSerializable { @Nullable private final DateTime startTime; - private final DateTime startTimeInMillis; + private final long startTimeInMillis; @Nullable private final DateTime stopTime; - private final DateTime stopTimeInMillis; + @Nullable + private final Long stopTimeInMillis; private final RecoveryOrigin target; @Nullable - private final DateTime totalTime; + private final Time totalTime; - private final DateTime totalTimeInMillis; + private final long totalTimeInMillis; private final TranslogStatus translog; @@ -101,7 +103,7 @@ private ShardRecovery(Builder builder) { this.startTime = builder.startTime; this.startTimeInMillis = ApiTypeHelper.requireNonNull(builder.startTimeInMillis, this, "startTimeInMillis"); this.stopTime = builder.stopTime; - this.stopTimeInMillis = ApiTypeHelper.requireNonNull(builder.stopTimeInMillis, this, "stopTimeInMillis"); + this.stopTimeInMillis = builder.stopTimeInMillis; this.target = ApiTypeHelper.requireNonNull(builder.target, this, "target"); this.totalTime = builder.totalTime; this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); @@ -169,7 +171,7 @@ public final DateTime startTime() { /** * Required - API name: {@code start_time_in_millis} */ - public final DateTime startTimeInMillis() { + public final long startTimeInMillis() { return this.startTimeInMillis; } @@ -182,9 +184,10 @@ public final DateTime stopTime() { } /** - * Required - API name: {@code stop_time_in_millis} + * API name: {@code stop_time_in_millis} */ - public final DateTime stopTimeInMillis() { + @Nullable + public final Long stopTimeInMillis() { return this.stopTimeInMillis; } @@ -199,14 +202,14 @@ public final RecoveryOrigin target() { * API name: {@code total_time} */ @Nullable - public final DateTime totalTime() { + public final Time totalTime() { return this.totalTime; } /** * Required - API name: {@code total_time_in_millis} */ - public final DateTime totalTimeInMillis() { + public final long totalTimeInMillis() { return this.totalTimeInMillis; } @@ -267,22 +270,28 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.startTime.serialize(generator, mapper); } generator.writeKey("start_time_in_millis"); - this.startTimeInMillis.serialize(generator, mapper); + generator.write(this.startTimeInMillis); + if (this.stopTime != null) { generator.writeKey("stop_time"); this.stopTime.serialize(generator, mapper); } - generator.writeKey("stop_time_in_millis"); - this.stopTimeInMillis.serialize(generator, mapper); + if (this.stopTimeInMillis != null) { + generator.writeKey("stop_time_in_millis"); + generator.write(this.stopTimeInMillis); + + } generator.writeKey("target"); this.target.serialize(generator, mapper); if (this.totalTime != null) { generator.writeKey("total_time"); this.totalTime.serialize(generator, mapper); + } generator.writeKey("total_time_in_millis"); - this.totalTimeInMillis.serialize(generator, mapper); + generator.write(this.totalTimeInMillis); + generator.writeKey("translog"); this.translog.serialize(generator, mapper); @@ -322,19 +331,20 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private DateTime startTime; - private DateTime startTimeInMillis; + private Long startTimeInMillis; @Nullable private DateTime stopTime; - private DateTime stopTimeInMillis; + @Nullable + private Long stopTimeInMillis; private RecoveryOrigin target; @Nullable - private DateTime totalTime; + private Time totalTime; - private DateTime totalTimeInMillis; + private Long totalTimeInMillis; private TranslogStatus translog; @@ -422,7 +432,7 @@ public final Builder startTime(@Nullable DateTime value) { /** * Required - API name: {@code start_time_in_millis} */ - public final Builder startTimeInMillis(DateTime value) { + public final Builder startTimeInMillis(long value) { this.startTimeInMillis = value; return this; } @@ -436,9 +446,9 @@ public final Builder stopTime(@Nullable DateTime value) { } /** - * Required - API name: {@code stop_time_in_millis} + * API name: {@code stop_time_in_millis} */ - public final Builder stopTimeInMillis(DateTime value) { + public final Builder stopTimeInMillis(@Nullable Long value) { this.stopTimeInMillis = value; return this; } @@ -461,15 +471,22 @@ public final Builder target(Function> fn) { + return this.totalTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_time_in_millis} */ - public final Builder totalTimeInMillis(DateTime value) { + public final Builder totalTimeInMillis(long value) { this.totalTimeInMillis = value; return this; } @@ -547,12 +564,12 @@ protected static void setupShardRecoveryDeserializer(ObjectDeserializer implement private Long totalOnStart; @Nullable - private String totalTime; + private Time totalTime; - private DateTime totalTimeInMillis; + private Long totalTimeInMillis; /** * Required - API name: {@code percent} @@ -217,15 +217,22 @@ public final Builder totalOnStart(long value) { /** * API name: {@code total_time} */ - public final Builder totalTime(@Nullable String value) { + public final Builder totalTime(@Nullable Time value) { this.totalTime = value; return this; } + /** + * API name: {@code total_time} + */ + public final Builder totalTime(Function> fn) { + return this.totalTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_time_in_millis} */ - public final Builder totalTimeInMillis(DateTime value) { + public final Builder totalTimeInMillis(long value) { this.totalTimeInMillis = value; return this; } @@ -262,8 +269,8 @@ protected static void setupTranslogStatusDeserializer(ObjectDeserializer implement @Nullable private Time checkIndexTime; - private DateTime checkIndexTimeInMillis; + private Long checkIndexTimeInMillis; @Nullable private Time totalTime; - private DateTime totalTimeInMillis; + private Long totalTimeInMillis; /** * API name: {@code check_index_time} @@ -173,7 +174,7 @@ public final Builder checkIndexTime(Function> /** * Required - API name: {@code check_index_time_in_millis} */ - public final Builder checkIndexTimeInMillis(DateTime value) { + public final Builder checkIndexTimeInMillis(long value) { this.checkIndexTimeInMillis = value; return this; } @@ -196,7 +197,7 @@ public final Builder totalTime(Function> fn) { /** * Required - API name: {@code total_time_in_millis} */ - public final Builder totalTimeInMillis(DateTime value) { + public final Builder totalTimeInMillis(long value) { this.totalTimeInMillis = value; return this; } @@ -230,9 +231,9 @@ public VerifyIndex build() { protected static void setupVerifyIndexDeserializer(ObjectDeserializer op) { op.add(Builder::checkIndexTime, Time._DESERIALIZER, "check_index_time"); - op.add(Builder::checkIndexTimeInMillis, DateTime._DESERIALIZER, "check_index_time_in_millis"); + op.add(Builder::checkIndexTimeInMillis, JsonpDeserializer.longDeserializer(), "check_index_time_in_millis"); op.add(Builder::totalTime, Time._DESERIALIZER, "total_time"); - op.add(Builder::totalTimeInMillis, DateTime._DESERIALIZER, "total_time_in_millis"); + op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/rollover/RolloverConditions.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/rollover/RolloverConditions.java index 17571494d..f2f56ead6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/rollover/RolloverConditions.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/rollover/RolloverConditions.java @@ -31,7 +31,6 @@ import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.DateTime; import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; @@ -54,6 +53,9 @@ public class RolloverConditions implements JsonpSerializable { @Nullable private final Time maxAge; + @Nullable + private final Long maxAgeMillis; + @Nullable private final Long maxDocs; @@ -69,20 +71,17 @@ public class RolloverConditions implements JsonpSerializable { @Nullable private final String maxPrimaryShardSizeBytes; - @Nullable - private final DateTime maxAgeMillis; - // --------------------------------------------------------------------------------------------- private RolloverConditions(Builder builder) { this.maxAge = builder.maxAge; + this.maxAgeMillis = builder.maxAgeMillis; this.maxDocs = builder.maxDocs; this.maxSize = builder.maxSize; this.maxSizeBytes = builder.maxSizeBytes; this.maxPrimaryShardSize = builder.maxPrimaryShardSize; this.maxPrimaryShardSizeBytes = builder.maxPrimaryShardSizeBytes; - this.maxAgeMillis = builder.maxAgeMillis; } @@ -98,6 +97,14 @@ public final Time maxAge() { return this.maxAge; } + /** + * API name: {@code max_age_millis} + */ + @Nullable + public final Long maxAgeMillis() { + return this.maxAgeMillis; + } + /** * API name: {@code max_docs} */ @@ -138,14 +145,6 @@ public final String maxPrimaryShardSizeBytes() { return this.maxPrimaryShardSizeBytes; } - /** - * API name: {@code max_age_millis} - */ - @Nullable - public final DateTime maxAgeMillis() { - return this.maxAgeMillis; - } - /** * Serialize this object to JSON. */ @@ -161,6 +160,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("max_age"); this.maxAge.serialize(generator, mapper); + } + if (this.maxAgeMillis != null) { + generator.writeKey("max_age_millis"); + generator.write(this.maxAgeMillis); + } if (this.maxDocs != null) { generator.writeKey("max_docs"); @@ -187,10 +191,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.maxPrimaryShardSizeBytes); } - if (this.maxAgeMillis != null) { - generator.writeKey("max_age_millis"); - this.maxAgeMillis.serialize(generator, mapper); - } } @@ -211,6 +211,9 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private Time maxAge; + @Nullable + private Long maxAgeMillis; + @Nullable private Long maxDocs; @@ -226,9 +229,6 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private String maxPrimaryShardSizeBytes; - @Nullable - private DateTime maxAgeMillis; - /** * API name: {@code max_age} */ @@ -244,6 +244,14 @@ public final Builder maxAge(Function> fn) { return this.maxAge(fn.apply(new Time.Builder()).build()); } + /** + * API name: {@code max_age_millis} + */ + public final Builder maxAgeMillis(@Nullable Long value) { + this.maxAgeMillis = value; + return this; + } + /** * API name: {@code max_docs} */ @@ -284,14 +292,6 @@ public final Builder maxPrimaryShardSizeBytes(@Nullable String value) { return this; } - /** - * API name: {@code max_age_millis} - */ - public final Builder maxAgeMillis(@Nullable DateTime value) { - this.maxAgeMillis = value; - return this; - } - @Override protected Builder self() { return this; @@ -321,13 +321,13 @@ public RolloverConditions build() { protected static void setupRolloverConditionsDeserializer(ObjectDeserializer op) { op.add(Builder::maxAge, Time._DESERIALIZER, "max_age"); + op.add(Builder::maxAgeMillis, JsonpDeserializer.longDeserializer(), "max_age_millis"); op.add(Builder::maxDocs, JsonpDeserializer.longDeserializer(), "max_docs"); op.add(Builder::maxSize, JsonpDeserializer.stringDeserializer(), "max_size"); op.add(Builder::maxSizeBytes, JsonpDeserializer.stringDeserializer(), "max_size_bytes"); op.add(Builder::maxPrimaryShardSize, JsonpDeserializer.stringDeserializer(), "max_primary_shard_size"); op.add(Builder::maxPrimaryShardSizeBytes, JsonpDeserializer.stringDeserializer(), "max_primary_shard_size_bytes"); - op.add(Builder::maxAgeMillis, DateTime._DESERIALIZER, "max_age_millis"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/geo_ip_stats/GeoIpDownloadStatistics.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/geo_ip_stats/GeoIpDownloadStatistics.java index 4ede8ebfa..f9058b0bc 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/geo_ip_stats/GeoIpDownloadStatistics.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/geo_ip_stats/GeoIpDownloadStatistics.java @@ -35,6 +35,7 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.Integer; +import java.lang.Long; import java.util.Objects; import java.util.function.Function; @@ -52,7 +53,7 @@ public class GeoIpDownloadStatistics implements JsonpSerializable { private final int failedDownloads; - private final int totalDownloadTime; + private final long totalDownloadTime; private final int databaseCount; @@ -98,7 +99,7 @@ public final int failedDownloads() { *

* API name: {@code total_download_time} */ - public final int totalDownloadTime() { + public final long totalDownloadTime() { return this.totalDownloadTime; } @@ -166,7 +167,7 @@ public static class Builder extends WithJsonObjectBuilderBase private Integer failedDownloads; - private Integer totalDownloadTime; + private Long totalDownloadTime; private Integer databaseCount; @@ -197,7 +198,7 @@ public final Builder failedDownloads(int value) { *

* API name: {@code total_download_time} */ - public final Builder totalDownloadTime(int value) { + public final Builder totalDownloadTime(long value) { this.totalDownloadTime = value; return this; } @@ -253,7 +254,7 @@ protected static void setupGeoIpDownloadStatisticsDeserializer( op.add(Builder::successfulDownloads, JsonpDeserializer.integerDeserializer(), "successful_downloads"); op.add(Builder::failedDownloads, JsonpDeserializer.integerDeserializer(), "failed_downloads"); - op.add(Builder::totalDownloadTime, JsonpDeserializer.integerDeserializer(), "total_download_time"); + op.add(Builder::totalDownloadTime, JsonpDeserializer.longDeserializer(), "total_download_time"); op.add(Builder::databaseCount, JsonpDeserializer.integerDeserializer(), "database_count"); op.add(Builder::skippedUpdates, JsonpDeserializer.integerDeserializer(), "skipped_updates"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/license/License.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/license/License.java index 8e3b35c51..860dbaf04 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/license/License.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/license/License.java @@ -31,7 +31,6 @@ 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; @@ -50,12 +49,12 @@ */ @JsonpDeserializable public class License implements JsonpSerializable { - private final DateTime expiryDateInMillis; + private final long expiryDateInMillis; - private final DateTime issueDateInMillis; + private final long issueDateInMillis; @Nullable - private final DateTime startDateInMillis; + private final Long startDateInMillis; private final String issuedTo; @@ -97,14 +96,14 @@ public static License of(Function> fn) { /** * Required - API name: {@code expiry_date_in_millis} */ - public final DateTime expiryDateInMillis() { + public final long expiryDateInMillis() { return this.expiryDateInMillis; } /** * Required - API name: {@code issue_date_in_millis} */ - public final DateTime issueDateInMillis() { + public final long issueDateInMillis() { return this.issueDateInMillis; } @@ -112,7 +111,7 @@ public final DateTime issueDateInMillis() { * API name: {@code start_date_in_millis} */ @Nullable - public final DateTime startDateInMillis() { + public final Long startDateInMillis() { return this.startDateInMillis; } @@ -179,12 +178,15 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("expiry_date_in_millis"); - this.expiryDateInMillis.serialize(generator, mapper); + generator.write(this.expiryDateInMillis); + generator.writeKey("issue_date_in_millis"); - this.issueDateInMillis.serialize(generator, mapper); + generator.write(this.issueDateInMillis); + if (this.startDateInMillis != null) { generator.writeKey("start_date_in_millis"); - this.startDateInMillis.serialize(generator, mapper); + generator.write(this.startDateInMillis); + } generator.writeKey("issued_to"); generator.write(this.issuedTo); @@ -224,12 +226,12 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private DateTime expiryDateInMillis; + private Long expiryDateInMillis; - private DateTime issueDateInMillis; + private Long issueDateInMillis; @Nullable - private DateTime startDateInMillis; + private Long startDateInMillis; private String issuedTo; @@ -250,7 +252,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement /** * Required - API name: {@code expiry_date_in_millis} */ - public final Builder expiryDateInMillis(DateTime value) { + public final Builder expiryDateInMillis(long value) { this.expiryDateInMillis = value; return this; } @@ -258,7 +260,7 @@ public final Builder expiryDateInMillis(DateTime value) { /** * Required - API name: {@code issue_date_in_millis} */ - public final Builder issueDateInMillis(DateTime value) { + public final Builder issueDateInMillis(long value) { this.issueDateInMillis = value; return this; } @@ -266,7 +268,7 @@ public final Builder issueDateInMillis(DateTime value) { /** * API name: {@code start_date_in_millis} */ - public final Builder startDateInMillis(@Nullable DateTime value) { + public final Builder startDateInMillis(@Nullable Long value) { this.startDateInMillis = value; return this; } @@ -355,9 +357,9 @@ public License build() { protected static void setupLicenseDeserializer(ObjectDeserializer op) { - op.add(Builder::expiryDateInMillis, DateTime._DESERIALIZER, "expiry_date_in_millis"); - op.add(Builder::issueDateInMillis, DateTime._DESERIALIZER, "issue_date_in_millis"); - op.add(Builder::startDateInMillis, DateTime._DESERIALIZER, "start_date_in_millis"); + op.add(Builder::expiryDateInMillis, JsonpDeserializer.longDeserializer(), "expiry_date_in_millis"); + op.add(Builder::issueDateInMillis, JsonpDeserializer.longDeserializer(), "issue_date_in_millis"); + op.add(Builder::startDateInMillis, JsonpDeserializer.longDeserializer(), "start_date_in_millis"); op.add(Builder::issuedTo, JsonpDeserializer.stringDeserializer(), "issued_to"); op.add(Builder::issuer, JsonpDeserializer.stringDeserializer(), "issuer"); op.add(Builder::maxNodes, JsonpDeserializer.longDeserializer(), "max_nodes"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/license/get/LicenseInformation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/license/get/LicenseInformation.java index 0be381f16..6bfa7d363 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/license/get/LicenseInformation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/license/get/LicenseInformation.java @@ -58,11 +58,11 @@ public class LicenseInformation implements JsonpSerializable { private final DateTime expiryDate; @Nullable - private final DateTime expiryDateInMillis; + private final Long expiryDateInMillis; private final DateTime issueDate; - private final DateTime issueDateInMillis; + private final long issueDateInMillis; private final String issuedTo; @@ -79,7 +79,7 @@ public class LicenseInformation implements JsonpSerializable { private final String uid; - private final DateTime startDateInMillis; + private final long startDateInMillis; // --------------------------------------------------------------------------------------------- @@ -116,7 +116,7 @@ public final DateTime expiryDate() { * API name: {@code expiry_date_in_millis} */ @Nullable - public final DateTime expiryDateInMillis() { + public final Long expiryDateInMillis() { return this.expiryDateInMillis; } @@ -130,7 +130,7 @@ public final DateTime issueDate() { /** * Required - API name: {@code issue_date_in_millis} */ - public final DateTime issueDateInMillis() { + public final long issueDateInMillis() { return this.issueDateInMillis; } @@ -189,7 +189,7 @@ public final String uid() { /** * Required - API name: {@code start_date_in_millis} */ - public final DateTime startDateInMillis() { + public final long startDateInMillis() { return this.startDateInMillis; } @@ -210,12 +210,14 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.expiryDateInMillis != null) { generator.writeKey("expiry_date_in_millis"); - this.expiryDateInMillis.serialize(generator, mapper); + generator.write(this.expiryDateInMillis); + } generator.writeKey("issue_date"); this.issueDate.serialize(generator, mapper); generator.writeKey("issue_date_in_millis"); - this.issueDateInMillis.serialize(generator, mapper); + generator.write(this.issueDateInMillis); + generator.writeKey("issued_to"); generator.write(this.issuedTo); @@ -237,7 +239,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.uid); generator.writeKey("start_date_in_millis"); - this.startDateInMillis.serialize(generator, mapper); + generator.write(this.startDateInMillis); } @@ -259,11 +261,11 @@ public static class Builder extends WithJsonObjectBuilderBase private DateTime expiryDate; @Nullable - private DateTime expiryDateInMillis; + private Long expiryDateInMillis; private DateTime issueDate; - private DateTime issueDateInMillis; + private Long issueDateInMillis; private String issuedTo; @@ -280,7 +282,7 @@ public static class Builder extends WithJsonObjectBuilderBase private String uid; - private DateTime startDateInMillis; + private Long startDateInMillis; /** * API name: {@code expiry_date} @@ -293,7 +295,7 @@ public final Builder expiryDate(@Nullable DateTime value) { /** * API name: {@code expiry_date_in_millis} */ - public final Builder expiryDateInMillis(@Nullable DateTime value) { + public final Builder expiryDateInMillis(@Nullable Long value) { this.expiryDateInMillis = value; return this; } @@ -309,7 +311,7 @@ public final Builder issueDate(DateTime value) { /** * Required - API name: {@code issue_date_in_millis} */ - public final Builder issueDateInMillis(DateTime value) { + public final Builder issueDateInMillis(long value) { this.issueDateInMillis = value; return this; } @@ -375,7 +377,7 @@ public final Builder uid(String value) { /** * Required - API name: {@code start_date_in_millis} */ - public final Builder startDateInMillis(DateTime value) { + public final Builder startDateInMillis(long value) { this.startDateInMillis = value; return this; } @@ -409,9 +411,9 @@ public LicenseInformation build() { protected static void setupLicenseInformationDeserializer(ObjectDeserializer op) { op.add(Builder::expiryDate, DateTime._DESERIALIZER, "expiry_date"); - op.add(Builder::expiryDateInMillis, DateTime._DESERIALIZER, "expiry_date_in_millis"); + op.add(Builder::expiryDateInMillis, JsonpDeserializer.longDeserializer(), "expiry_date_in_millis"); op.add(Builder::issueDate, DateTime._DESERIALIZER, "issue_date"); - op.add(Builder::issueDateInMillis, DateTime._DESERIALIZER, "issue_date_in_millis"); + op.add(Builder::issueDateInMillis, JsonpDeserializer.longDeserializer(), "issue_date_in_millis"); op.add(Builder::issuedTo, JsonpDeserializer.stringDeserializer(), "issued_to"); op.add(Builder::issuer, JsonpDeserializer.stringDeserializer(), "issuer"); op.add(Builder::maxNodes, JsonpDeserializer.longDeserializer(), "max_nodes"); @@ -419,7 +421,7 @@ protected static void setupLicenseInformationDeserializer(ObjectDeserializer> *

* API name: {@code bucket_span} */ - public final String bucketSpan() { + public final Time bucketSpan() { return this.bucketSpan; } @@ -282,7 +282,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("bucket_span"); - generator.write(this.bucketSpan); + this.bucketSpan.serialize(generator, mapper); if (this.categorizationAnalyzer != null) { generator.writeKey("categorization_analyzer"); @@ -364,7 +364,7 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String bucketSpan; + private Time bucketSpan; @Nullable private CategorizationAnalyzer categorizationAnalyzer; @@ -408,11 +408,28 @@ public static class Builder extends WithJsonObjectBuilderBase implement *

* API name: {@code bucket_span} */ - public final Builder bucketSpan(String value) { + public final Builder bucketSpan(Time value) { this.bucketSpan = value; return this; } + /** + * Required - The size of the interval that the analysis is aggregated into, + * typically between 5m and 1h. This value should be + * either a whole number of days or equate to a whole number of buckets in one + * day. If the anomaly detection job uses a datafeed with aggregations, this + * value must also be divisible by the interval of the date histogram + * aggregation. + *

+ *

+ * API name: {@code bucket_span} + */ + public final Builder bucketSpan(Function> fn) { + return this.bucketSpan(fn.apply(new Time.Builder()).build()); + } + /** * If categorization_field_name is specified, you can also define * the analyzer that is used to interpret the categorization field. This @@ -723,7 +740,7 @@ public AnalysisConfig build() { protected static void setupAnalysisConfigDeserializer(ObjectDeserializer op) { - op.add(Builder::bucketSpan, JsonpDeserializer.stringDeserializer(), "bucket_span"); + op.add(Builder::bucketSpan, Time._DESERIALIZER, "bucket_span"); op.add(Builder::categorizationAnalyzer, CategorizationAnalyzer._DESERIALIZER, "categorization_analyzer"); op.add(Builder::categorizationFieldName, JsonpDeserializer.stringDeserializer(), "categorization_field_name"); op.add(Builder::categorizationFilters, diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/AnalysisConfigRead.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/AnalysisConfigRead.java index 428ab6f07..d4b915989 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/AnalysisConfigRead.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/AnalysisConfigRead.java @@ -51,7 +51,7 @@ */ @JsonpDeserializable public class AnalysisConfigRead implements JsonpSerializable { - private final String bucketSpan; + private final Time bucketSpan; @Nullable private final CategorizationAnalyzer categorizationAnalyzer; @@ -115,7 +115,7 @@ public static AnalysisConfigRead of(Function * API name: {@code bucket_span} */ - public final String bucketSpan() { + public final Time bucketSpan() { return this.bucketSpan; } @@ -282,7 +282,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("bucket_span"); - generator.write(this.bucketSpan); + this.bucketSpan.serialize(generator, mapper); if (this.categorizationAnalyzer != null) { generator.writeKey("categorization_analyzer"); @@ -366,7 +366,7 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String bucketSpan; + private Time bucketSpan; @Nullable private CategorizationAnalyzer categorizationAnalyzer; @@ -409,11 +409,28 @@ public static class Builder extends WithJsonObjectBuilderBase *

* API name: {@code bucket_span} */ - public final Builder bucketSpan(String value) { + public final Builder bucketSpan(Time value) { this.bucketSpan = value; return this; } + /** + * Required - The size of the interval that the analysis is aggregated into, + * typically between 5m and 1h. This value should be + * either a whole number of days or equate to a whole number of buckets in one + * day. If the anomaly detection job uses a datafeed with aggregations, this + * value must also be divisible by the interval of the date histogram + * aggregation. + *

    + *
  • @server_default 5m
  • + *
+ *

+ * API name: {@code bucket_span} + */ + public final Builder bucketSpan(Function> fn) { + return this.bucketSpan(fn.apply(new Time.Builder()).build()); + } + /** * If categorization_field_name is specified, you can also define * the analyzer that is used to interpret the categorization field. This @@ -724,7 +741,7 @@ public AnalysisConfigRead build() { protected static void setupAnalysisConfigReadDeserializer(ObjectDeserializer op) { - op.add(Builder::bucketSpan, JsonpDeserializer.stringDeserializer(), "bucket_span"); + op.add(Builder::bucketSpan, Time._DESERIALIZER, "bucket_span"); op.add(Builder::categorizationAnalyzer, CategorizationAnalyzer._DESERIALIZER, "categorization_analyzer"); op.add(Builder::categorizationFieldName, JsonpDeserializer.stringDeserializer(), "categorization_field_name"); op.add(Builder::categorizationFilters, diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/Anomaly.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/Anomaly.java index 4581370a2..e44796c39 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/Anomaly.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/Anomaly.java @@ -23,7 +23,6 @@ package co.elastic.clients.elasticsearch.ml; -import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -32,13 +31,13 @@ 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.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; @@ -56,7 +55,7 @@ public class Anomaly implements JsonpSerializable { private final List actual; - private final Time bucketSpan; + private final long bucketSpan; @Nullable private final String byFieldName; @@ -103,7 +102,7 @@ public class Anomaly implements JsonpSerializable { private final String resultType; - private final DateTime timestamp; + private final long timestamp; private final List typical; @@ -150,7 +149,7 @@ public final List actual() { /** * Required - API name: {@code bucket_span} */ - public final Time bucketSpan() { + public final long bucketSpan() { return this.bucketSpan; } @@ -292,7 +291,7 @@ public final String resultType() { /** * Required - API name: {@code timestamp} */ - public final DateTime timestamp() { + public final long timestamp() { return this.timestamp; } @@ -325,7 +324,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeKey("bucket_span"); - this.bucketSpan.serialize(generator, mapper); + generator.write(this.bucketSpan); if (this.byFieldName != null) { generator.writeKey("by_field_name"); @@ -414,7 +413,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.resultType); generator.writeKey("timestamp"); - this.timestamp.serialize(generator, mapper); + generator.write(this.timestamp); + if (ApiTypeHelper.isDefined(this.typical)) { generator.writeKey("typical"); generator.writeStartArray(); @@ -443,7 +443,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private List actual; - private Time bucketSpan; + private Long bucketSpan; @Nullable private String byFieldName; @@ -492,7 +492,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private String resultType; - private DateTime timestamp; + private Long timestamp; @Nullable private List typical; @@ -520,18 +520,11 @@ public final Builder actual(Double value, Double... values) { /** * Required - API name: {@code bucket_span} */ - public final Builder bucketSpan(Time value) { + public final Builder bucketSpan(long value) { this.bucketSpan = value; return this; } - /** - * Required - API name: {@code bucket_span} - */ - public final Builder bucketSpan(Function> fn) { - return this.bucketSpan(fn.apply(new Time.Builder()).build()); - } - /** * API name: {@code by_field_name} */ @@ -721,7 +714,7 @@ public final Builder resultType(String value) { /** * Required - API name: {@code timestamp} */ - public final Builder timestamp(DateTime value) { + public final Builder timestamp(long value) { this.timestamp = value; return this; } @@ -775,7 +768,7 @@ public Anomaly build() { protected static void setupAnomalyDeserializer(ObjectDeserializer op) { op.add(Builder::actual, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer()), "actual"); - op.add(Builder::bucketSpan, Time._DESERIALIZER, "bucket_span"); + op.add(Builder::bucketSpan, JsonpDeserializer.longDeserializer(), "bucket_span"); op.add(Builder::byFieldName, JsonpDeserializer.stringDeserializer(), "by_field_name"); op.add(Builder::byFieldValue, JsonpDeserializer.stringDeserializer(), "by_field_value"); op.add(Builder::causes, JsonpDeserializer.arrayDeserializer(AnomalyCause._DESERIALIZER), "causes"); @@ -794,7 +787,7 @@ protected static void setupAnomalyDeserializer(ObjectDeserializer * API name: {@code timestamp} */ - public final Time timestamp() { + public final long timestamp() { return this.timestamp; } + /** + * The start time of the bucket for which these results were calculated. + *

+ * API name: {@code timestamp_string} + */ + @Nullable + public final DateTime timestampString() { + return this.timestampString; + } + /** * Serialize this object to JSON. */ @@ -233,7 +247,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.resultType); generator.writeKey("timestamp"); - this.timestamp.serialize(generator, mapper); + generator.write(this.timestamp); + + if (this.timestampString != null) { + generator.writeKey("timestamp_string"); + this.timestampString.serialize(generator, mapper); + } } @@ -267,7 +286,10 @@ public static class Builder extends WithJsonObjectBuilderBase implement private String resultType; - private Time timestamp; + private Long timestamp; + + @Nullable + private DateTime timestampString; /** * Required - A normalized score between 0-100, which is calculated for each @@ -373,19 +395,19 @@ public final Builder resultType(String value) { *

* API name: {@code timestamp} */ - public final Builder timestamp(Time value) { + public final Builder timestamp(long value) { this.timestamp = value; return this; } /** - * Required - The start time of the bucket for which these results were - * calculated. + * The start time of the bucket for which these results were calculated. *

- * API name: {@code timestamp} + * API name: {@code timestamp_string} */ - public final Builder timestamp(Function> fn) { - return this.timestamp(fn.apply(new Time.Builder()).build()); + public final Builder timestampString(@Nullable DateTime value) { + this.timestampString = value; + return this; } @Override @@ -425,7 +447,8 @@ protected static void setupBucketInfluencerDeserializer(ObjectDeserializer bucketInfluencers; - private final Time bucketSpan; + private final long bucketSpan; private final long eventCount; @@ -67,11 +67,14 @@ public class BucketSummary implements JsonpSerializable { private final String jobId; - private final double processingTimeMs; + private final long processingTimeMs; private final String resultType; - private final Time timestamp; + private final long timestamp; + + @Nullable + private final DateTime timestampString; // --------------------------------------------------------------------------------------------- @@ -89,6 +92,7 @@ private BucketSummary(Builder builder) { this.processingTimeMs = ApiTypeHelper.requireNonNull(builder.processingTimeMs, this, "processingTimeMs"); this.resultType = ApiTypeHelper.requireNonNull(builder.resultType, this, "resultType"); this.timestamp = ApiTypeHelper.requireNonNull(builder.timestamp, this, "timestamp"); + this.timestampString = builder.timestampString; } @@ -121,7 +125,7 @@ public final List bucketInfluencers() { *

* API name: {@code bucket_span} */ - public final Time bucketSpan() { + public final long bucketSpan() { return this.bucketSpan; } @@ -170,7 +174,7 @@ public final String jobId() { *

* API name: {@code processing_time_ms} */ - public final double processingTimeMs() { + public final long processingTimeMs() { return this.processingTimeMs; } @@ -190,10 +194,22 @@ public final String resultType() { *

* API name: {@code timestamp} */ - public final Time timestamp() { + public final long timestamp() { return this.timestamp; } + /** + * The start time of the bucket. This timestamp uniquely identifies the bucket. + * Events that occur exactly at the timestamp of the bucket are included in the + * results for the bucket. + *

+ * API name: {@code timestamp_string} + */ + @Nullable + public final DateTime timestampString() { + return this.timestampString; + } + /** * Serialize this object to JSON. */ @@ -219,7 +235,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeKey("bucket_span"); - this.bucketSpan.serialize(generator, mapper); + generator.write(this.bucketSpan); generator.writeKey("event_count"); generator.write(this.eventCount); @@ -240,7 +256,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.resultType); generator.writeKey("timestamp"); - this.timestamp.serialize(generator, mapper); + generator.write(this.timestamp); + + if (this.timestampString != null) { + generator.writeKey("timestamp_string"); + this.timestampString.serialize(generator, mapper); + } } @@ -260,7 +281,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private List bucketInfluencers; - private Time bucketSpan; + private Long bucketSpan; private Long eventCount; @@ -270,11 +291,14 @@ public static class Builder extends WithJsonObjectBuilderBase implement private String jobId; - private Double processingTimeMs; + private Long processingTimeMs; private String resultType; - private Time timestamp; + private Long timestamp; + + @Nullable + private DateTime timestampString; /** * Required - The maximum anomaly score, between 0-100, for any of the bucket @@ -324,21 +348,11 @@ public final Builder bucketInfluencers(Function * API name: {@code bucket_span} */ - public final Builder bucketSpan(Time value) { + public final Builder bucketSpan(long value) { this.bucketSpan = value; return this; } - /** - * Required - The length of the bucket in seconds. This value matches the bucket - * span that is specified in the job. - *

- * API name: {@code bucket_span} - */ - public final Builder bucketSpan(Function> fn) { - return this.bucketSpan(fn.apply(new Time.Builder()).build()); - } - /** * Required - The number of input data records processed in this bucket. *

@@ -388,7 +402,7 @@ public final Builder jobId(String value) { *

* API name: {@code processing_time_ms} */ - public final Builder processingTimeMs(double value) { + public final Builder processingTimeMs(long value) { this.processingTimeMs = value; return this; } @@ -410,20 +424,21 @@ public final Builder resultType(String value) { *

* API name: {@code timestamp} */ - public final Builder timestamp(Time value) { + public final Builder timestamp(long value) { this.timestamp = value; return this; } /** - * Required - The start time of the bucket. This timestamp uniquely identifies - * the bucket. Events that occur exactly at the timestamp of the bucket are - * included in the results for the bucket. + * The start time of the bucket. This timestamp uniquely identifies the bucket. + * Events that occur exactly at the timestamp of the bucket are included in the + * results for the bucket. *

- * API name: {@code timestamp} + * API name: {@code timestamp_string} */ - public final Builder timestamp(Function> fn) { - return this.timestamp(fn.apply(new Time.Builder()).build()); + public final Builder timestampString(@Nullable DateTime value) { + this.timestampString = value; + return this; } @Override @@ -457,14 +472,15 @@ protected static void setupBucketSummaryDeserializer(ObjectDeserializer indices; @@ -79,7 +79,7 @@ public class Datafeed implements JsonpSerializable { private final Query query; @Nullable - private final DateTime queryDelay; + private final Time queryDelay; private final Map scriptFields; @@ -146,7 +146,7 @@ public final String datafeedId() { * API name: {@code frequency} */ @Nullable - public final DateTime frequency() { + public final Time frequency() { return this.frequency; } @@ -190,7 +190,7 @@ public final Query query() { * API name: {@code query_delay} */ @Nullable - public final DateTime queryDelay() { + public final Time queryDelay() { return this.queryDelay; } @@ -264,6 +264,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.frequency != null) { generator.writeKey("frequency"); this.frequency.serialize(generator, mapper); + } if (ApiTypeHelper.isDefined(this.indices)) { generator.writeKey("indices"); @@ -299,6 +300,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.queryDelay != null) { generator.writeKey("query_delay"); this.queryDelay.serialize(generator, mapper); + } if (ApiTypeHelper.isDefined(this.scriptFields)) { generator.writeKey("script_fields"); @@ -366,7 +368,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private String datafeedId; @Nullable - private DateTime frequency; + private Time frequency; private List indices; @@ -381,7 +383,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Query query; @Nullable - private DateTime queryDelay; + private Time queryDelay; @Nullable private Map scriptFields; @@ -452,11 +454,18 @@ public final Builder datafeedId(String value) { /** * API name: {@code frequency} */ - public final Builder frequency(@Nullable DateTime value) { + public final Builder frequency(@Nullable Time value) { this.frequency = value; return this; } + /** + * API name: {@code frequency} + */ + public final Builder frequency(Function> fn) { + return this.frequency(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code indices} *

@@ -531,11 +540,18 @@ public final Builder query(Function> fn) { /** * API name: {@code query_delay} */ - public final Builder queryDelay(@Nullable DateTime value) { + public final Builder queryDelay(@Nullable Time value) { this.queryDelay = value; return this; } + /** + * API name: {@code query_delay} + */ + public final Builder queryDelay(Function> fn) { + return this.queryDelay(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code script_fields} *

@@ -656,7 +672,7 @@ protected static void setupDatafeedDeserializer(ObjectDeserializer indexes; @@ -87,7 +87,7 @@ public class DatafeedConfig implements JsonpSerializable { private final Query query; @Nullable - private final DateTime queryDelay; + private final Time queryDelay; private final Map> runtimeMappings; @@ -188,7 +188,7 @@ public final DelayedDataCheckConfig delayedDataCheckConfig() { * API name: {@code frequency} */ @Nullable - public final DateTime frequency() { + public final Time frequency() { return this.frequency; } @@ -267,7 +267,7 @@ public final Query query() { * API name: {@code query_delay} */ @Nullable - public final DateTime queryDelay() { + public final Time queryDelay() { return this.queryDelay; } @@ -343,6 +343,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.frequency != null) { generator.writeKey("frequency"); this.frequency.serialize(generator, mapper); + } if (ApiTypeHelper.isDefined(this.indexes)) { generator.writeKey("indexes"); @@ -385,6 +386,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.queryDelay != null) { generator.writeKey("query_delay"); this.queryDelay.serialize(generator, mapper); + } if (ApiTypeHelper.isDefined(this.runtimeMappings)) { generator.writeKey("runtime_mappings"); @@ -448,7 +450,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private DelayedDataCheckConfig delayedDataCheckConfig; @Nullable - private DateTime frequency; + private Time frequency; @Nullable private List indexes; @@ -467,7 +469,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Query query; @Nullable - private DateTime queryDelay; + private Time queryDelay; @Nullable private Map> runtimeMappings; @@ -600,11 +602,27 @@ public final Builder delayedDataCheckConfig( *

* API name: {@code frequency} */ - public final Builder frequency(@Nullable DateTime value) { + public final Builder frequency(@Nullable Time value) { this.frequency = value; return this; } + /** + * The interval at which scheduled queries are made while the datafeed runs in + * real time. The default value is either the bucket span for short bucket + * spans, or, for longer bucket spans, a sensible fraction of the bucket span. + * For example: 150s. When frequency is shorter than + * the bucket span, interim results for the last (partial) bucket are written + * then eventually overwritten by the full bucket results. If the datafeed uses + * aggregations, this value must be divisible by the interval of the date + * histogram aggregation. + *

+ * API name: {@code frequency} + */ + public final Builder frequency(Function> fn) { + return this.frequency(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code indexes} *

@@ -731,11 +749,25 @@ public final Builder query(Function> fn) { *

* API name: {@code query_delay} */ - public final Builder queryDelay(@Nullable DateTime value) { + public final Builder queryDelay(@Nullable Time value) { this.queryDelay = value; return this; } + /** + * The number of seconds behind real time that data is queried. For example, if + * data from 10:04 a.m. might not be searchable in Elasticsearch until 10:06 + * a.m., set this property to 120 seconds. The default value is randomly + * selected between 60s and 120s. This randomness + * improves the query performance when there are multiple jobs running on the + * same node. + *

+ * API name: {@code query_delay} + */ + public final Builder queryDelay(Function> fn) { + return this.queryDelay(fn.apply(new Time.Builder()).build()); + } + /** * Specifies runtime fields for the datafeed search. *

@@ -846,7 +878,7 @@ protected static void setupDatafeedConfigDeserializer(ObjectDeserializer private Double totalSearchTimeMs; @Nullable - private Number averageSearchTimePerBucketMs; + private Double averageSearchTimePerBucketMs; /** * Required - API name: {@code bucket_count} @@ -229,7 +228,7 @@ public final Builder totalSearchTimeMs(double value) { /** * API name: {@code average_search_time_per_bucket_ms} */ - public final Builder averageSearchTimePerBucketMs(@Nullable Number value) { + public final Builder averageSearchTimePerBucketMs(@Nullable Double value) { this.averageSearchTimePerBucketMs = value; return this; } @@ -268,7 +267,7 @@ protected static void setupDatafeedTimingStatsDeserializer(ObjectDeserializer private Integer iteration; - private DateTime timestamp; + private Long timestamp; private TimingStats timingStats; @@ -201,7 +202,7 @@ public final Builder iteration(int value) { /** * Required - API name: {@code timestamp} */ - public final Builder timestamp(DateTime value) { + public final Builder timestamp(long value) { this.timestamp = value; return this; } @@ -268,7 +269,7 @@ protected static void setupDataframeAnalyticsStatsHyperparametersDeserializer( op.add(Builder::hyperparameters, Hyperparameters._DESERIALIZER, "hyperparameters"); op.add(Builder::iteration, JsonpDeserializer.integerDeserializer(), "iteration"); - op.add(Builder::timestamp, DateTime._DESERIALIZER, "timestamp"); + op.add(Builder::timestamp, JsonpDeserializer.longDeserializer(), "timestamp"); op.add(Builder::timingStats, TimingStats._DESERIALIZER, "timing_stats"); op.add(Builder::validationLoss, ValidationLoss._DESERIALIZER, "validation_loss"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/DataframeAnalyticsStatsMemoryUsage.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/DataframeAnalyticsStatsMemoryUsage.java index 46622de70..45dfbd519 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/DataframeAnalyticsStatsMemoryUsage.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/DataframeAnalyticsStatsMemoryUsage.java @@ -31,7 +31,6 @@ 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; @@ -59,7 +58,7 @@ public class DataframeAnalyticsStatsMemoryUsage implements JsonpSerializable { private final String status; @Nullable - private final DateTime timestamp; + private final Long timestamp; // --------------------------------------------------------------------------------------------- @@ -112,7 +111,7 @@ public final String status() { * API name: {@code timestamp} */ @Nullable - public final DateTime timestamp() { + public final Long timestamp() { return this.timestamp; } @@ -140,7 +139,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.timestamp != null) { generator.writeKey("timestamp"); - this.timestamp.serialize(generator, mapper); + generator.write(this.timestamp); + } } @@ -167,7 +167,7 @@ public static class Builder extends WithJsonObjectBuilderBase private String status; @Nullable - private DateTime timestamp; + private Long timestamp; /** * This value is present when the status is hard_limit and it is a new estimate @@ -205,7 +205,7 @@ public final Builder status(String value) { *

* API name: {@code timestamp} */ - public final Builder timestamp(@Nullable DateTime value) { + public final Builder timestamp(@Nullable Long value) { this.timestamp = value; return this; } @@ -243,7 +243,7 @@ protected static void setupDataframeAnalyticsStatsMemoryUsageDeserializer( op.add(Builder::memoryReestimateBytes, JsonpDeserializer.longDeserializer(), "memory_reestimate_bytes"); op.add(Builder::peakUsageBytes, JsonpDeserializer.longDeserializer(), "peak_usage_bytes"); op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status"); - op.add(Builder::timestamp, DateTime._DESERIALIZER, "timestamp"); + op.add(Builder::timestamp, JsonpDeserializer.longDeserializer(), "timestamp"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/DataframeAnalyticsStatsOutlierDetection.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/DataframeAnalyticsStatsOutlierDetection.java index cc5a40324..b0764c652 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/DataframeAnalyticsStatsOutlierDetection.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/DataframeAnalyticsStatsOutlierDetection.java @@ -31,10 +31,10 @@ 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.Long; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -51,7 +51,7 @@ public class DataframeAnalyticsStatsOutlierDetection implements DataframeAnalyticsStatsVariant, JsonpSerializable { private final OutlierDetectionParameters parameters; - private final DateTime timestamp; + private final long timestamp; private final TimingStats timingStats; @@ -88,7 +88,7 @@ public final OutlierDetectionParameters parameters() { /** * Required - API name: {@code timestamp} */ - public final DateTime timestamp() { + public final long timestamp() { return this.timestamp; } @@ -114,7 +114,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.parameters.serialize(generator, mapper); generator.writeKey("timestamp"); - this.timestamp.serialize(generator, mapper); + generator.write(this.timestamp); + generator.writeKey("timing_stats"); this.timingStats.serialize(generator, mapper); @@ -136,7 +137,7 @@ public static class Builder extends WithJsonObjectBuilderBase ObjectBuilder { private OutlierDetectionParameters parameters; - private DateTime timestamp; + private Long timestamp; private TimingStats timingStats; @@ -159,7 +160,7 @@ public final Builder parameters( /** * Required - API name: {@code timestamp} */ - public final Builder timestamp(DateTime value) { + public final Builder timestamp(long value) { this.timestamp = value; return this; } @@ -210,7 +211,7 @@ protected static void setupDataframeAnalyticsStatsOutlierDetectionDeserializer( ObjectDeserializer op) { op.add(Builder::parameters, OutlierDetectionParameters._DESERIALIZER, "parameters"); - op.add(Builder::timestamp, DateTime._DESERIALIZER, "timestamp"); + op.add(Builder::timestamp, JsonpDeserializer.longDeserializer(), "timestamp"); op.add(Builder::timingStats, TimingStats._DESERIALIZER, "timing_stats"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlAsyncClient.java index fbe29d617..34316e754 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlAsyncClient.java @@ -61,7 +61,7 @@ public ElasticsearchMlAsyncClient withTransportOptions(@Nullable TransportOption * multiple times throughout its lifecycle. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-close-job.html">Documentation * on elastic.co */ @@ -80,7 +80,7 @@ public CompletableFuture closeJob(CloseJobRequest request) { * a function that initializes a builder to create the * {@link CloseJobRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-close-job.html">Documentation * on elastic.co */ @@ -95,7 +95,7 @@ public final CompletableFuture closeJob( * Deletes a calendar. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-delete-calendar.html">Documentation * on elastic.co */ @@ -113,7 +113,7 @@ public CompletableFuture deleteCalendar(DeleteCalendarRe * a function that initializes a builder to create the * {@link DeleteCalendarRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-delete-calendar.html">Documentation * on elastic.co */ @@ -128,7 +128,7 @@ public final CompletableFuture deleteCalendar( * Deletes scheduled events from a calendar. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-delete-calendar-event.html">Documentation * on elastic.co */ @@ -146,7 +146,7 @@ public CompletableFuture deleteCalendarEvent(Delete * a function that initializes a builder to create the * {@link DeleteCalendarEventRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-delete-calendar-event.html">Documentation * on elastic.co */ @@ -161,7 +161,7 @@ public final CompletableFuture deleteCalendarEvent( * Deletes anomaly detection jobs from a calendar. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-delete-calendar-job.html">Documentation * on elastic.co */ @@ -179,7 +179,7 @@ public CompletableFuture deleteCalendarJob(DeleteCale * a function that initializes a builder to create the * {@link DeleteCalendarJobRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-delete-calendar-job.html">Documentation * on elastic.co */ @@ -194,7 +194,7 @@ public final CompletableFuture deleteCalendarJob( * Deletes an existing data frame analytics job. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/delete-dfanalytics.html">Documentation * on elastic.co */ @@ -213,7 +213,7 @@ public CompletableFuture deleteDataFrameAnalyt * a function that initializes a builder to create the * {@link DeleteDataFrameAnalyticsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/delete-dfanalytics.html">Documentation * on elastic.co */ @@ -228,7 +228,7 @@ public final CompletableFuture deleteDataFrame * Deletes an existing datafeed. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-delete-datafeed.html">Documentation * on elastic.co */ @@ -246,7 +246,7 @@ public CompletableFuture deleteDatafeed(DeleteDatafeedRe * a function that initializes a builder to create the * {@link DeleteDatafeedRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-delete-datafeed.html">Documentation * on elastic.co */ @@ -1776,7 +1776,7 @@ public final CompletableFuture putCalendarJob( * Instantiates a data frame analytics job. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/put-dfanalytics.html">Documentation * on elastic.co */ @@ -1795,7 +1795,7 @@ public CompletableFuture putDataFrameAnalytics( * a function that initializes a builder to create the * {@link PutDataFrameAnalyticsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/put-dfanalytics.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlClient.java index ba2b638d7..253e3f60a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlClient.java @@ -62,7 +62,7 @@ public ElasticsearchMlClient withTransportOptions(@Nullable TransportOptions tra * multiple times throughout its lifecycle. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-close-job.html">Documentation * on elastic.co */ @@ -81,7 +81,7 @@ public CloseJobResponse closeJob(CloseJobRequest request) throws IOException, El * a function that initializes a builder to create the * {@link CloseJobRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-close-job.html">Documentation * on elastic.co */ @@ -96,7 +96,7 @@ public final CloseJobResponse closeJob(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-delete-calendar.html">Documentation * on elastic.co */ @@ -115,7 +115,7 @@ public DeleteCalendarResponse deleteCalendar(DeleteCalendarRequest request) * a function that initializes a builder to create the * {@link DeleteCalendarRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-delete-calendar.html">Documentation * on elastic.co */ @@ -131,7 +131,7 @@ public final DeleteCalendarResponse deleteCalendar( * Deletes scheduled events from a calendar. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-delete-calendar-event.html">Documentation * on elastic.co */ @@ -150,7 +150,7 @@ public DeleteCalendarEventResponse deleteCalendarEvent(DeleteCalendarEventReques * a function that initializes a builder to create the * {@link DeleteCalendarEventRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-delete-calendar-event.html">Documentation * on elastic.co */ @@ -166,7 +166,7 @@ public final DeleteCalendarEventResponse deleteCalendarEvent( * Deletes anomaly detection jobs from a calendar. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-delete-calendar-job.html">Documentation * on elastic.co */ @@ -185,7 +185,7 @@ public DeleteCalendarJobResponse deleteCalendarJob(DeleteCalendarJobRequest requ * a function that initializes a builder to create the * {@link DeleteCalendarJobRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-delete-calendar-job.html">Documentation * on elastic.co */ @@ -201,7 +201,7 @@ public final DeleteCalendarJobResponse deleteCalendarJob( * Deletes an existing data frame analytics job. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/delete-dfanalytics.html">Documentation * on elastic.co */ @@ -220,7 +220,7 @@ public DeleteDataFrameAnalyticsResponse deleteDataFrameAnalytics(DeleteDataFrame * a function that initializes a builder to create the * {@link DeleteDataFrameAnalyticsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/delete-dfanalytics.html">Documentation * on elastic.co */ @@ -236,7 +236,7 @@ public final DeleteDataFrameAnalyticsResponse deleteDataFrameAnalytics( * Deletes an existing datafeed. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-delete-datafeed.html">Documentation * on elastic.co */ @@ -255,7 +255,7 @@ public DeleteDatafeedResponse deleteDatafeed(DeleteDatafeedRequest request) * a function that initializes a builder to create the * {@link DeleteDatafeedRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/ml-delete-datafeed.html">Documentation * on elastic.co */ @@ -1833,7 +1833,7 @@ public final PutCalendarJobResponse putCalendarJob( * Instantiates a data frame analytics job. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/put-dfanalytics.html">Documentation * on elastic.co */ @@ -1852,7 +1852,7 @@ public PutDataFrameAnalyticsResponse putDataFrameAnalytics(PutDataFrameAnalytics * a function that initializes a builder to create the * {@link PutDataFrameAnalyticsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/put-dfanalytics.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetCalendarEventsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetCalendarEventsRequest.java index c7672fd7a..7a4807994 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetCalendarEventsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetCalendarEventsRequest.java @@ -69,7 +69,7 @@ public class GetCalendarEventsRequest extends RequestBase { private final Integer size; @Nullable - private final String start; + private final DateTime start; // --------------------------------------------------------------------------------------------- @@ -148,7 +148,7 @@ public final Integer size() { * API name: {@code start} */ @Nullable - public final String start() { + public final DateTime start() { return this.start; } @@ -174,7 +174,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder * API name: {@code start} */ - public final Builder start(@Nullable String value) { + public final Builder start(@Nullable DateTime value) { this.start = value; return this; } @@ -299,7 +299,7 @@ public GetCalendarEventsRequest build() { params.put("job_id", request.jobId); } if (request.start != null) { - params.put("start", request.start); + params.put("start", request.start.toString()); } if (request.end != null) { params.put("end", request.end.toString()); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetModelSnapshotsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetModelSnapshotsRequest.java index 844955afa..93074496b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetModelSnapshotsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetModelSnapshotsRequest.java @@ -25,7 +25,6 @@ import co.elastic.clients.elasticsearch._types.ErrorResponse; import co.elastic.clients.elasticsearch._types.RequestBase; -import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -35,6 +34,7 @@ import co.elastic.clients.transport.Endpoint; import co.elastic.clients.transport.endpoints.SimpleEndpoint; 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; @@ -61,7 +61,7 @@ public class GetModelSnapshotsRequest extends RequestBase implements JsonpSerial private final Boolean desc; @Nullable - private final Time end; + private final DateTime end; @Nullable private final Integer from; @@ -81,7 +81,7 @@ public class GetModelSnapshotsRequest extends RequestBase implements JsonpSerial private final String sort; @Nullable - private final Time start; + private final DateTime start; // --------------------------------------------------------------------------------------------- @@ -119,7 +119,7 @@ public final Boolean desc() { * API name: {@code end} */ @Nullable - public final Time end() { + public final DateTime end() { return this.end; } @@ -190,7 +190,7 @@ public final String sort() { * API name: {@code start} */ @Nullable - public final Time start() { + public final DateTime start() { return this.start; } @@ -213,7 +213,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.end != null) { generator.writeKey("end"); this.end.serialize(generator, mapper); - } if (this.page != null) { generator.writeKey("page"); @@ -228,7 +227,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.start != null) { generator.writeKey("start"); this.start.serialize(generator, mapper); - } } @@ -246,7 +244,7 @@ public static class Builder extends WithJsonObjectBuilderBase private Boolean desc; @Nullable - private Time end; + private DateTime end; @Nullable private Integer from; @@ -266,7 +264,7 @@ public static class Builder extends WithJsonObjectBuilderBase private String sort; @Nullable - private Time start; + private DateTime start; /** * Refer to the description for the desc query parameter. @@ -283,20 +281,11 @@ public final Builder desc(@Nullable Boolean value) { *

* API name: {@code end} */ - public final Builder end(@Nullable Time value) { + public final Builder end(@Nullable DateTime value) { this.end = value; return this; } - /** - * Refer to the description for the end query parameter. - *

- * API name: {@code end} - */ - public final Builder end(Function> fn) { - return this.end(fn.apply(new Time.Builder()).build()); - } - /** * Skips the specified number of snapshots. *

@@ -371,20 +360,11 @@ public final Builder sort(@Nullable String value) { *

* API name: {@code start} */ - public final Builder start(@Nullable Time value) { + public final Builder start(@Nullable DateTime value) { this.start = value; return this; } - /** - * Refer to the description for the start query parameter. - *

- * API name: {@code start} - */ - public final Builder start(Function> fn) { - return this.start(fn.apply(new Time.Builder()).build()); - } - @Override protected Builder self() { return this; @@ -415,10 +395,10 @@ protected static void setupGetModelSnapshotsRequestDeserializer( ObjectDeserializer op) { op.add(Builder::desc, JsonpDeserializer.booleanDeserializer(), "desc"); - op.add(Builder::end, Time._DESERIALIZER, "end"); + op.add(Builder::end, DateTime._DESERIALIZER, "end"); op.add(Builder::page, Page._DESERIALIZER, "page"); op.add(Builder::sort, JsonpDeserializer.stringDeserializer(), "sort"); - op.add(Builder::start, Time._DESERIALIZER, "start"); + op.add(Builder::start, DateTime._DESERIALIZER, "start"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetOverallBucketsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetOverallBucketsRequest.java index f7bbafb8f..5348c8a7f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetOverallBucketsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/GetOverallBucketsRequest.java @@ -35,6 +35,7 @@ import co.elastic.clients.transport.Endpoint; import co.elastic.clients.transport.endpoints.SimpleEndpoint; 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; @@ -79,7 +80,7 @@ public class GetOverallBucketsRequest extends RequestBase implements JsonpSerial private final Time bucketSpan; @Nullable - private final Time end; + private final DateTime end; @Nullable private final Boolean excludeInterim; @@ -90,7 +91,7 @@ public class GetOverallBucketsRequest extends RequestBase implements JsonpSerial private final String overallScore; @Nullable - private final Time start; + private final DateTime start; @Nullable private final Integer topN; @@ -140,7 +141,7 @@ public final Time bucketSpan() { * API name: {@code end} */ @Nullable - public final Time end() { + public final DateTime end() { return this.end; } @@ -186,7 +187,7 @@ public final String overallScore() { * API name: {@code start} */ @Nullable - public final Time start() { + public final DateTime start() { return this.start; } @@ -224,7 +225,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.end != null) { generator.writeKey("end"); this.end.serialize(generator, mapper); - } if (this.excludeInterim != null) { generator.writeKey("exclude_interim"); @@ -239,7 +239,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.start != null) { generator.writeKey("start"); this.start.serialize(generator, mapper); - } if (this.topN != null) { generator.writeKey("top_n"); @@ -265,7 +264,7 @@ public static class Builder extends WithJsonObjectBuilderBase private Time bucketSpan; @Nullable - private Time end; + private DateTime end; @Nullable private Boolean excludeInterim; @@ -276,7 +275,7 @@ public static class Builder extends WithJsonObjectBuilderBase private String overallScore; @Nullable - private Time start; + private DateTime start; @Nullable private Integer topN; @@ -315,20 +314,11 @@ public final Builder bucketSpan(Function> fn) *

* API name: {@code end} */ - public final Builder end(@Nullable Time value) { + public final Builder end(@Nullable DateTime value) { this.end = value; return this; } - /** - * Refer to the description for the end query parameter. - *

- * API name: {@code end} - */ - public final Builder end(Function> fn) { - return this.end(fn.apply(new Time.Builder()).build()); - } - /** * Refer to the description for the exclude_interim query * parameter. @@ -371,20 +361,11 @@ public final Builder overallScore(@Nullable String value) { *

* API name: {@code start} */ - public final Builder start(@Nullable Time value) { + public final Builder start(@Nullable DateTime value) { this.start = value; return this; } - /** - * Refer to the description for the start query parameter. - *

- * API name: {@code start} - */ - public final Builder start(Function> fn) { - return this.start(fn.apply(new Time.Builder()).build()); - } - /** * Refer to the description for the top_n query parameter. *

@@ -426,10 +407,10 @@ protected static void setupGetOverallBucketsRequestDeserializer( op.add(Builder::allowNoMatch, JsonpDeserializer.booleanDeserializer(), "allow_no_match"); op.add(Builder::bucketSpan, Time._DESERIALIZER, "bucket_span"); - op.add(Builder::end, Time._DESERIALIZER, "end"); + op.add(Builder::end, DateTime._DESERIALIZER, "end"); op.add(Builder::excludeInterim, JsonpDeserializer.booleanDeserializer(), "exclude_interim"); op.add(Builder::overallScore, JsonpDeserializer.stringDeserializer(), "overall_score"); - op.add(Builder::start, Time._DESERIALIZER, "start"); + op.add(Builder::start, DateTime._DESERIALIZER, "start"); op.add(Builder::topN, JsonpDeserializer.integerDeserializer(), "top_n"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/Influencer.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/Influencer.java index 77f76965e..1688b5b5f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/Influencer.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/Influencer.java @@ -23,7 +23,6 @@ package co.elastic.clients.elasticsearch.ml; -import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -70,7 +69,7 @@ public class Influencer implements JsonpSerializable { private final String resultType; - private final Time timestamp; + private final long timestamp; @Nullable private final String foo; @@ -198,7 +197,7 @@ public final String resultType() { *

* API name: {@code timestamp} */ - public final Time timestamp() { + public final long timestamp() { return this.timestamp; } @@ -254,7 +253,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.resultType); generator.writeKey("timestamp"); - this.timestamp.serialize(generator, mapper); + generator.write(this.timestamp); if (this.foo != null) { generator.writeKey("foo"); @@ -294,7 +293,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private String resultType; - private Time timestamp; + private Long timestamp; @Nullable private String foo; @@ -406,21 +405,11 @@ public final Builder resultType(String value) { *

* API name: {@code timestamp} */ - public final Builder timestamp(Time value) { + public final Builder timestamp(long value) { this.timestamp = value; return this; } - /** - * Required - The start time of the bucket for which these results were - * calculated. - *

- * API name: {@code timestamp} - */ - public final Builder timestamp(Function> fn) { - return this.timestamp(fn.apply(new Time.Builder()).build()); - } - /** * Additional influencer properties are added, depending on the fields being * analyzed. For example, if it’s analyzing user_name as an @@ -471,7 +460,7 @@ protected static void setupInfluencerDeserializer(ObjectDeserializer groups; @@ -192,7 +192,7 @@ public final JobBlocked blocked() { * API name: {@code create_time} */ @Nullable - public final Integer createTime() { + public final DateTime createTime() { return this.createTime; } @@ -247,7 +247,7 @@ public final String description() { * API name: {@code finished_time} */ @Nullable - public final Integer finishedTime() { + public final DateTime finishedTime() { return this.finishedTime; } @@ -361,8 +361,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.createTime != null) { generator.writeKey("create_time"); - generator.write(this.createTime); - + this.createTime.serialize(generator, mapper); } if (this.customSettings != null) { generator.writeKey("custom_settings"); @@ -394,8 +393,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.finishedTime != null) { generator.writeKey("finished_time"); - generator.write(this.finishedTime); - + this.finishedTime.serialize(generator, mapper); } if (ApiTypeHelper.isDefined(this.groups)) { generator.writeKey("groups"); @@ -475,7 +473,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private JobBlocked blocked; @Nullable - private Integer createTime; + private DateTime createTime; @Nullable private JsonData customSettings; @@ -495,7 +493,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private String description; @Nullable - private Integer finishedTime; + private DateTime finishedTime; @Nullable private List groups; @@ -595,7 +593,7 @@ public final Builder blocked(Function op) { op.add(Builder::analysisLimits, AnalysisLimits._DESERIALIZER, "analysis_limits"); op.add(Builder::backgroundPersistInterval, Time._DESERIALIZER, "background_persist_interval"); op.add(Builder::blocked, JobBlocked._DESERIALIZER, "blocked"); - op.add(Builder::createTime, JsonpDeserializer.integerDeserializer(), "create_time"); + op.add(Builder::createTime, DateTime._DESERIALIZER, "create_time"); op.add(Builder::customSettings, JsonData._DESERIALIZER, "custom_settings"); op.add(Builder::dailyModelSnapshotRetentionAfterDays, JsonpDeserializer.longDeserializer(), "daily_model_snapshot_retention_after_days"); @@ -810,7 +808,7 @@ protected static void setupJobDeserializer(ObjectDeserializer op) { op.add(Builder::datafeedConfig, Datafeed._DESERIALIZER, "datafeed_config"); op.add(Builder::deleting, JsonpDeserializer.booleanDeserializer(), "deleting"); op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); - op.add(Builder::finishedTime, JsonpDeserializer.integerDeserializer(), "finished_time"); + op.add(Builder::finishedTime, DateTime._DESERIALIZER, "finished_time"); op.add(Builder::groups, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "groups"); op.add(Builder::jobId, JsonpDeserializer.stringDeserializer(), "job_id"); op.add(Builder::jobType, JsonpDeserializer.stringDeserializer(), "job_type"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ModelSizeStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ModelSizeStats.java index 2848a823b..a5d1aa339 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ModelSizeStats.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ModelSizeStats.java @@ -23,7 +23,6 @@ package co.elastic.clients.elasticsearch.ml; -import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -32,6 +31,7 @@ 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; @@ -55,7 +55,7 @@ public class ModelSizeStats implements JsonpSerializable { private final String jobId; - private final Time logTime; + private final DateTime logTime; private final MemoryStatus memoryStatus; @@ -154,7 +154,7 @@ public final String jobId() { /** * Required - API name: {@code log_time} */ - public final Time logTime() { + public final DateTime logTime() { return this.logTime; } @@ -308,7 +308,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("log_time"); this.logTime.serialize(generator, mapper); - generator.writeKey("memory_status"); this.memoryStatus.serialize(generator, mapper); generator.writeKey("model_bytes"); @@ -390,7 +389,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private String jobId; - private Time logTime; + private DateTime logTime; private MemoryStatus memoryStatus; @@ -452,18 +451,11 @@ public final Builder jobId(String value) { /** * Required - API name: {@code log_time} */ - public final Builder logTime(Time value) { + public final Builder logTime(DateTime value) { this.logTime = value; return this; } - /** - * Required - API name: {@code log_time} - */ - public final Builder logTime(Function> fn) { - return this.logTime(fn.apply(new Time.Builder()).build()); - } - /** * Required - API name: {@code memory_status} */ @@ -639,7 +631,7 @@ protected static void setupModelSizeStatsDeserializer(ObjectDeserializer * API name: {@code timestamp} */ - public final Time timestamp() { + public final long timestamp() { return this.timestamp; } + /** + * Required - The start time of the bucket for which these results were + * calculated. + *

+ * API name: {@code timestamp_string} + */ + public final DateTime timestampString() { + return this.timestampString; + } + /** * Serialize this object to JSON. */ @@ -173,7 +186,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.resultType); generator.writeKey("timestamp"); - this.timestamp.serialize(generator, mapper); + generator.write(this.timestamp); + + generator.writeKey("timestamp_string"); + this.timestampString.serialize(generator, mapper); } @@ -199,7 +215,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement private String resultType; - private Time timestamp; + private Long timestamp; + + private DateTime timestampString; /** * Required - The length of the bucket in seconds. Matches the job with the @@ -284,7 +302,7 @@ public final Builder resultType(String value) { *

* API name: {@code timestamp} */ - public final Builder timestamp(Time value) { + public final Builder timestamp(long value) { this.timestamp = value; return this; } @@ -293,10 +311,11 @@ public final Builder timestamp(Time value) { * Required - The start time of the bucket for which these results were * calculated. *

- * API name: {@code timestamp} + * API name: {@code timestamp_string} */ - public final Builder timestamp(Function> fn) { - return this.timestamp(fn.apply(new Time.Builder()).build()); + public final Builder timestampString(DateTime value) { + this.timestampString = value; + return this; } @Override @@ -332,7 +351,8 @@ protected static void setupOverallBucketDeserializer(ObjectDeserializerbackground_persist_interval value too low. *

* API name: {@code background_persist_interval} */ + @Nullable public final Time backgroundPersistInterval() { return this.backgroundPersistInterval; } @@ -364,9 +365,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.analysisLimits.serialize(generator, mapper); } - generator.writeKey("background_persist_interval"); - this.backgroundPersistInterval.serialize(generator, mapper); + if (this.backgroundPersistInterval != null) { + generator.writeKey("background_persist_interval"); + this.backgroundPersistInterval.serialize(generator, mapper); + } if (this.customSettings != null) { generator.writeKey("custom_settings"); this.customSettings.serialize(generator, mapper); @@ -443,6 +446,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private AnalysisLimits analysisLimits; + @Nullable private Time backgroundPersistInterval; @Nullable @@ -546,26 +550,26 @@ public final Builder analysisLimits(Functionbackground_persist_interval value too low. *

* API name: {@code background_persist_interval} */ - public final Builder backgroundPersistInterval(Time value) { + public final Builder backgroundPersistInterval(@Nullable Time value) { this.backgroundPersistInterval = value; return this; } /** - * Required - Advanced configuration option. The time between each periodic - * persistence of the model. The default value is a randomized value between 3 - * to 4 hours, which avoids all jobs persisting at exactly the same time. The - * smallest allowed value is 1 hour. For very large models (several GB), - * persistence could take 10-20 minutes, so do not set the + * Advanced configuration option. The time between each periodic persistence of + * the model. The default value is a randomized value between 3 to 4 hours, + * which avoids all jobs persisting at exactly the same time. The smallest + * allowed value is 1 hour. For very large models (several GB), persistence + * could take 10-20 minutes, so do not set the * background_persist_interval value too low. *

* API name: {@code background_persist_interval} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/RunningStateSearchInterval.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/RunningStateSearchInterval.java index 2a9353bdd..82906ec8e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/RunningStateSearchInterval.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/RunningStateSearchInterval.java @@ -23,6 +23,7 @@ package co.elastic.clients.elasticsearch.ml; +import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -37,6 +38,7 @@ import java.lang.Long; import java.util.Objects; import java.util.function.Function; +import javax.annotation.Nullable; // typedef: ml._types.RunningStateSearchInterval @@ -48,15 +50,23 @@ */ @JsonpDeserializable public class RunningStateSearchInterval implements JsonpSerializable { + @Nullable + private final Time end; + private final long endMs; + @Nullable + private final Time start; + private final long startMs; // --------------------------------------------------------------------------------------------- private RunningStateSearchInterval(Builder builder) { + this.end = builder.end; this.endMs = ApiTypeHelper.requireNonNull(builder.endMs, this, "endMs"); + this.start = builder.start; this.startMs = ApiTypeHelper.requireNonNull(builder.startMs, this, "startMs"); } @@ -65,6 +75,14 @@ public static RunningStateSearchInterval of(Function implements ObjectBuilder { + @Nullable + private Time end; + private Long endMs; + @Nullable + private Time start; + private Long startMs; + /** + * API name: {@code end} + */ + public final Builder end(@Nullable Time value) { + this.end = value; + return this; + } + + /** + * API name: {@code end} + */ + public final Builder end(Function> fn) { + return this.end(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code end_ms} */ @@ -124,6 +181,21 @@ public final Builder endMs(long value) { return this; } + /** + * API name: {@code start} + */ + public final Builder start(@Nullable Time value) { + this.start = value; + return this; + } + + /** + * API name: {@code start} + */ + public final Builder start(Function> fn) { + return this.start(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code start_ms} */ @@ -161,7 +233,9 @@ public RunningStateSearchInterval build() { protected static void setupRunningStateSearchIntervalDeserializer( ObjectDeserializer op) { + op.add(Builder::end, Time._DESERIALIZER, "end"); op.add(Builder::endMs, JsonpDeserializer.longDeserializer(), "end_ms"); + op.add(Builder::start, Time._DESERIALIZER, "start"); op.add(Builder::startMs, JsonpDeserializer.longDeserializer(), "start_ms"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/StartDatafeedRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/StartDatafeedRequest.java index 80e254dec..4148ba5a5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/StartDatafeedRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/StartDatafeedRequest.java @@ -35,6 +35,7 @@ import co.elastic.clients.transport.Endpoint; import co.elastic.clients.transport.endpoints.SimpleEndpoint; 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; @@ -73,10 +74,10 @@ public class StartDatafeedRequest extends RequestBase implements JsonpSerializab private final String datafeedId; @Nullable - private final Time end; + private final DateTime end; @Nullable - private final Time start; + private final DateTime start; @Nullable private final Time timeout; @@ -114,7 +115,7 @@ public final String datafeedId() { * API name: {@code end} */ @Nullable - public final Time end() { + public final DateTime end() { return this.end; } @@ -124,7 +125,7 @@ public final Time end() { * API name: {@code start} */ @Nullable - public final Time start() { + public final DateTime start() { return this.start; } @@ -152,12 +153,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.end != null) { generator.writeKey("end"); this.end.serialize(generator, mapper); - } if (this.start != null) { generator.writeKey("start"); this.start.serialize(generator, mapper); - } if (this.timeout != null) { generator.writeKey("timeout"); @@ -179,10 +178,10 @@ public static class Builder extends WithJsonObjectBuilderBase private String datafeedId; @Nullable - private Time end; + private DateTime end; @Nullable - private Time start; + private DateTime start; @Nullable private Time timeout; @@ -205,39 +204,21 @@ public final Builder datafeedId(String value) { *

* API name: {@code end} */ - public final Builder end(@Nullable Time value) { + public final Builder end(@Nullable DateTime value) { this.end = value; return this; } - /** - * Refer to the description for the end query parameter. - *

- * API name: {@code end} - */ - public final Builder end(Function> fn) { - return this.end(fn.apply(new Time.Builder()).build()); - } - /** * Refer to the description for the start query parameter. *

* API name: {@code start} */ - public final Builder start(@Nullable Time value) { + public final Builder start(@Nullable DateTime value) { this.start = value; return this; } - /** - * Refer to the description for the start query parameter. - *

- * API name: {@code start} - */ - public final Builder start(Function> fn) { - return this.start(fn.apply(new Time.Builder()).build()); - } - /** * Refer to the description for the timeout query parameter. *

@@ -285,8 +266,8 @@ public StartDatafeedRequest build() { protected static void setupStartDatafeedRequestDeserializer(ObjectDeserializer op) { - op.add(Builder::end, Time._DESERIALIZER, "end"); - op.add(Builder::start, Time._DESERIALIZER, "start"); + op.add(Builder::end, DateTime._DESERIALIZER, "end"); + op.add(Builder::start, DateTime._DESERIALIZER, "start"); op.add(Builder::timeout, Time._DESERIALIZER, "timeout"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TimingStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TimingStats.java index 8c3de97d9..6336f13b1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TimingStats.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TimingStats.java @@ -34,7 +34,7 @@ import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; -import java.lang.Integer; +import java.lang.Long; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -48,10 +48,10 @@ */ @JsonpDeserializable public class TimingStats implements JsonpSerializable { - private final int elapsedTime; + private final long elapsedTime; @Nullable - private final Integer iterationTime; + private final Long iterationTime; // --------------------------------------------------------------------------------------------- @@ -71,7 +71,7 @@ public static TimingStats of(Function> fn) { *

* API name: {@code elapsed_time} */ - public final int elapsedTime() { + public final long elapsedTime() { return this.elapsedTime; } @@ -81,7 +81,7 @@ public final int elapsedTime() { * API name: {@code iteration_time} */ @Nullable - public final Integer iterationTime() { + public final Long iterationTime() { return this.iterationTime; } @@ -119,17 +119,17 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Integer elapsedTime; + private Long elapsedTime; @Nullable - private Integer iterationTime; + private Long iterationTime; /** * Required - Runtime of the analysis in milliseconds. *

* API name: {@code elapsed_time} */ - public final Builder elapsedTime(int value) { + public final Builder elapsedTime(long value) { this.elapsedTime = value; return this; } @@ -139,7 +139,7 @@ public final Builder elapsedTime(int value) { *

* API name: {@code iteration_time} */ - public final Builder iterationTime(@Nullable Integer value) { + public final Builder iterationTime(@Nullable Long value) { this.iterationTime = value; return this; } @@ -172,8 +172,8 @@ public TimingStats build() { protected static void setupTimingStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::elapsedTime, JsonpDeserializer.integerDeserializer(), "elapsed_time"); - op.add(Builder::iterationTime, JsonpDeserializer.integerDeserializer(), "iteration_time"); + op.add(Builder::elapsedTime, JsonpDeserializer.longDeserializer(), "elapsed_time"); + op.add(Builder::iterationTime, JsonpDeserializer.longDeserializer(), "iteration_time"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelConfig.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelConfig.java index b5a03ccd3..a8b1c4b3e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelConfig.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelConfig.java @@ -23,7 +23,6 @@ package co.elastic.clients.elasticsearch.ml; -import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -32,6 +31,7 @@ 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; @@ -69,7 +69,7 @@ public class TrainedModelConfig implements JsonpSerializable { private final String createdBy; @Nullable - private final Time createTime; + private final DateTime createTime; private final Map defaultFieldMap; @@ -189,7 +189,7 @@ public final String createdBy() { * API name: {@code create_time} */ @Nullable - public final Time createTime() { + public final DateTime createTime() { return this.createTime; } @@ -335,7 +335,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.createTime != null) { generator.writeKey("create_time"); this.createTime.serialize(generator, mapper); - } if (ApiTypeHelper.isDefined(this.defaultFieldMap)) { generator.writeKey("default_field_map"); @@ -444,7 +443,7 @@ protected abstract static class AbstractBuilder defaultFieldMap; @@ -553,20 +552,11 @@ public final BuilderT createdBy(@Nullable String value) { *

* API name: {@code create_time} */ - public final BuilderT createTime(@Nullable Time value) { + public final BuilderT createTime(@Nullable DateTime value) { this.createTime = value; return self(); } - /** - * The time when the trained model was created. - *

- * API name: {@code create_time} - */ - public final BuilderT createTime(Function> fn) { - return this.createTime(fn.apply(new Time.Builder()).build()); - } - /** * Any field map described in the inference configuration takes precedence. *

@@ -742,7 +732,7 @@ protected static > void setupTrainedM op.add(AbstractBuilder::version, JsonpDeserializer.stringDeserializer(), "version"); op.add(AbstractBuilder::compressedDefinition, JsonpDeserializer.stringDeserializer(), "compressed_definition"); op.add(AbstractBuilder::createdBy, JsonpDeserializer.stringDeserializer(), "created_by"); - op.add(AbstractBuilder::createTime, Time._DESERIALIZER, "create_time"); + op.add(AbstractBuilder::createTime, DateTime._DESERIALIZER, "create_time"); op.add(AbstractBuilder::defaultFieldMap, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "default_field_map"); op.add(AbstractBuilder::description, JsonpDeserializer.stringDeserializer(), "description"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelInferenceStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelInferenceStats.java index 02c2c248e..aa94cb2ef 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelInferenceStats.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/TrainedModelInferenceStats.java @@ -23,7 +23,6 @@ package co.elastic.clients.elasticsearch.ml; -import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -32,6 +31,7 @@ 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; @@ -58,7 +58,7 @@ public class TrainedModelInferenceStats implements JsonpSerializable { private final int missingAllFieldsCount; - private final Time timestamp; + private final DateTime timestamp; // --------------------------------------------------------------------------------------------- @@ -124,7 +124,7 @@ public final int missingAllFieldsCount() { *

* API name: {@code timestamp} */ - public final Time timestamp() { + public final DateTime timestamp() { return this.timestamp; } @@ -178,7 +178,7 @@ public static class Builder extends WithJsonObjectBuilderBase private Integer missingAllFieldsCount; - private Time timestamp; + private DateTime timestamp; /** * Required - The number of times the model was loaded for inference and was not @@ -231,20 +231,11 @@ public final Builder missingAllFieldsCount(int value) { *

* API name: {@code timestamp} */ - public final Builder timestamp(Time value) { + public final Builder timestamp(DateTime value) { this.timestamp = value; return this; } - /** - * Required - The time when the statistics were last updated. - *

- * API name: {@code timestamp} - */ - public final Builder timestamp(Function> fn) { - return this.timestamp(fn.apply(new Time.Builder()).build()); - } - @Override protected Builder self() { return this; @@ -278,7 +269,7 @@ protected static void setupTrainedModelInferenceStatsDeserializer( op.add(Builder::failureCount, JsonpDeserializer.integerDeserializer(), "failure_count"); op.add(Builder::inferenceCount, JsonpDeserializer.integerDeserializer(), "inference_count"); op.add(Builder::missingAllFieldsCount, JsonpDeserializer.integerDeserializer(), "missing_all_fields_count"); - op.add(Builder::timestamp, Time._DESERIALIZER, "timestamp"); + op.add(Builder::timestamp, DateTime._DESERIALIZER, "timestamp"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/UpdateJobResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/UpdateJobResponse.java index 776eddd3e..15052b024 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/UpdateJobResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/UpdateJobResponse.java @@ -32,7 +32,6 @@ 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; @@ -63,10 +62,10 @@ public class UpdateJobResponse implements JsonpSerializable { @Nullable private final Time backgroundPersistInterval; - private final DateTime createTime; + private final long createTime; @Nullable - private final DateTime finishedTime; + private final Long finishedTime; private final Map customSettings; @@ -170,7 +169,7 @@ public final Time backgroundPersistInterval() { /** * Required - API name: {@code create_time} */ - public final DateTime createTime() { + public final long createTime() { return this.createTime; } @@ -178,7 +177,7 @@ public final DateTime createTime() { * API name: {@code finished_time} */ @Nullable - public final DateTime finishedTime() { + public final Long finishedTime() { return this.finishedTime; } @@ -319,10 +318,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeKey("create_time"); - this.createTime.serialize(generator, mapper); + generator.write(this.createTime); + if (this.finishedTime != null) { generator.writeKey("finished_time"); - this.finishedTime.serialize(generator, mapper); + generator.write(this.finishedTime); + } if (ApiTypeHelper.isDefined(this.customSettings)) { generator.writeKey("custom_settings"); @@ -420,10 +421,10 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private Time backgroundPersistInterval; - private DateTime createTime; + private Long createTime; @Nullable - private DateTime finishedTime; + private Long finishedTime; @Nullable private Map customSettings; @@ -520,7 +521,7 @@ public final Builder backgroundPersistInterval(Function _serializables() { *

* API name: {@code interval} */ - public final String interval() { + public final Time interval() { return this.interval; } @@ -156,7 +157,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { */ public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String interval; + private Time interval; private String systemApiVersion; @@ -172,11 +173,20 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder * API name: {@code interval} */ - public final Builder interval(String value) { + public final Builder interval(Time value) { this.interval = value; return this; } + /** + * Required - Collection interval (e.g., '10s' or '10000ms') of the payload + *

+ * API name: {@code interval} + */ + public final Builder interval(Function> fn) { + return this.interval(fn.apply(new Time.Builder()).build()); + } + /** * Required - *

@@ -298,7 +308,7 @@ public BulkRequest build() { Map params = new HashMap<>(); params.put("system_id", request.systemId); params.put("system_api_version", request.systemApiVersion); - params.put("interval", request.interval); + params.put("interval", request.interval._toJsonString()); return params; }, SimpleEndpoint.emptyMap(), true, BulkResponse._DESERIALIZER); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/ClusterStateUpdate.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/ClusterStateUpdate.java index 60f29b2ad..163ae4674 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/ClusterStateUpdate.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/ClusterStateUpdate.java @@ -23,6 +23,7 @@ package co.elastic.clients.elasticsearch.nodes; +import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -30,11 +31,11 @@ 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.Long; -import java.lang.String; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -48,47 +49,46 @@ */ @JsonpDeserializable public class ClusterStateUpdate implements JsonpSerializable { - @Nullable - private final Long count; + private final long count; @Nullable - private final String computationTime; + private final Time computationTime; @Nullable private final Long computationTimeMillis; @Nullable - private final String publicationTime; + private final Time publicationTime; @Nullable private final Long publicationTimeMillis; @Nullable - private final String contextConstructionTime; + private final Time contextConstructionTime; @Nullable private final Long contextConstructionTimeMillis; @Nullable - private final String commitTime; + private final Time commitTime; @Nullable private final Long commitTimeMillis; @Nullable - private final String completionTime; + private final Time completionTime; @Nullable private final Long completionTimeMillis; @Nullable - private final String masterApplyTime; + private final Time masterApplyTime; @Nullable private final Long masterApplyTimeMillis; @Nullable - private final String notificationTime; + private final Time notificationTime; @Nullable private final Long notificationTimeMillis; @@ -97,7 +97,7 @@ public class ClusterStateUpdate implements JsonpSerializable { private ClusterStateUpdate(Builder builder) { - this.count = builder.count; + this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); this.computationTime = builder.computationTime; this.computationTimeMillis = builder.computationTimeMillis; this.publicationTime = builder.publicationTime; @@ -120,10 +120,9 @@ public static ClusterStateUpdate of(Function implements ObjectBuilder { - @Nullable private Long count; @Nullable - private String computationTime; + private Time computationTime; @Nullable private Long computationTimeMillis; @Nullable - private String publicationTime; + private Time publicationTime; @Nullable private Long publicationTimeMillis; @Nullable - private String contextConstructionTime; + private Time contextConstructionTime; @Nullable private Long contextConstructionTimeMillis; @Nullable - private String commitTime; + private Time commitTime; @Nullable private Long commitTimeMillis; @Nullable - private String completionTime; + private Time completionTime; @Nullable private Long completionTimeMillis; @Nullable - private String masterApplyTime; + private Time masterApplyTime; @Nullable private Long masterApplyTimeMillis; @Nullable - private String notificationTime; + private Time notificationTime; @Nullable private Long notificationTimeMillis; /** - * API name: {@code count} + * Required - API name: {@code count} */ - public final Builder count(@Nullable Long value) { + public final Builder count(long value) { this.count = value; return this; } @@ -398,11 +394,18 @@ public final Builder count(@Nullable Long value) { /** * API name: {@code computation_time} */ - public final Builder computationTime(@Nullable String value) { + public final Builder computationTime(@Nullable Time value) { this.computationTime = value; return this; } + /** + * API name: {@code computation_time} + */ + public final Builder computationTime(Function> fn) { + return this.computationTime(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code computation_time_millis} */ @@ -414,11 +417,18 @@ public final Builder computationTimeMillis(@Nullable Long value) { /** * API name: {@code publication_time} */ - public final Builder publicationTime(@Nullable String value) { + public final Builder publicationTime(@Nullable Time value) { this.publicationTime = value; return this; } + /** + * API name: {@code publication_time} + */ + public final Builder publicationTime(Function> fn) { + return this.publicationTime(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code publication_time_millis} */ @@ -430,11 +440,18 @@ public final Builder publicationTimeMillis(@Nullable Long value) { /** * API name: {@code context_construction_time} */ - public final Builder contextConstructionTime(@Nullable String value) { + public final Builder contextConstructionTime(@Nullable Time value) { this.contextConstructionTime = value; return this; } + /** + * API name: {@code context_construction_time} + */ + public final Builder contextConstructionTime(Function> fn) { + return this.contextConstructionTime(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code context_construction_time_millis} */ @@ -446,11 +463,18 @@ public final Builder contextConstructionTimeMillis(@Nullable Long value) { /** * API name: {@code commit_time} */ - public final Builder commitTime(@Nullable String value) { + public final Builder commitTime(@Nullable Time value) { this.commitTime = value; return this; } + /** + * API name: {@code commit_time} + */ + public final Builder commitTime(Function> fn) { + return this.commitTime(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code commit_time_millis} */ @@ -462,11 +486,18 @@ public final Builder commitTimeMillis(@Nullable Long value) { /** * API name: {@code completion_time} */ - public final Builder completionTime(@Nullable String value) { + public final Builder completionTime(@Nullable Time value) { this.completionTime = value; return this; } + /** + * API name: {@code completion_time} + */ + public final Builder completionTime(Function> fn) { + return this.completionTime(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code completion_time_millis} */ @@ -478,11 +509,18 @@ public final Builder completionTimeMillis(@Nullable Long value) { /** * API name: {@code master_apply_time} */ - public final Builder masterApplyTime(@Nullable String value) { + public final Builder masterApplyTime(@Nullable Time value) { this.masterApplyTime = value; return this; } + /** + * API name: {@code master_apply_time} + */ + public final Builder masterApplyTime(Function> fn) { + return this.masterApplyTime(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code master_apply_time_millis} */ @@ -494,11 +532,18 @@ public final Builder masterApplyTimeMillis(@Nullable Long value) { /** * API name: {@code notification_time} */ - public final Builder notificationTime(@Nullable String value) { + public final Builder notificationTime(@Nullable Time value) { this.notificationTime = value; return this; } + /** + * API name: {@code notification_time} + */ + public final Builder notificationTime(Function> fn) { + return this.notificationTime(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code notification_time_millis} */ @@ -536,20 +581,20 @@ public ClusterStateUpdate build() { protected static void setupClusterStateUpdateDeserializer(ObjectDeserializer op) { op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); - op.add(Builder::computationTime, JsonpDeserializer.stringDeserializer(), "computation_time"); + op.add(Builder::computationTime, Time._DESERIALIZER, "computation_time"); op.add(Builder::computationTimeMillis, JsonpDeserializer.longDeserializer(), "computation_time_millis"); - op.add(Builder::publicationTime, JsonpDeserializer.stringDeserializer(), "publication_time"); + op.add(Builder::publicationTime, Time._DESERIALIZER, "publication_time"); op.add(Builder::publicationTimeMillis, JsonpDeserializer.longDeserializer(), "publication_time_millis"); - op.add(Builder::contextConstructionTime, JsonpDeserializer.stringDeserializer(), "context_construction_time"); + op.add(Builder::contextConstructionTime, Time._DESERIALIZER, "context_construction_time"); op.add(Builder::contextConstructionTimeMillis, JsonpDeserializer.longDeserializer(), "context_construction_time_millis"); - op.add(Builder::commitTime, JsonpDeserializer.stringDeserializer(), "commit_time"); + op.add(Builder::commitTime, Time._DESERIALIZER, "commit_time"); op.add(Builder::commitTimeMillis, JsonpDeserializer.longDeserializer(), "commit_time_millis"); - op.add(Builder::completionTime, JsonpDeserializer.stringDeserializer(), "completion_time"); + op.add(Builder::completionTime, Time._DESERIALIZER, "completion_time"); op.add(Builder::completionTimeMillis, JsonpDeserializer.longDeserializer(), "completion_time_millis"); - op.add(Builder::masterApplyTime, JsonpDeserializer.stringDeserializer(), "master_apply_time"); + op.add(Builder::masterApplyTime, Time._DESERIALIZER, "master_apply_time"); op.add(Builder::masterApplyTimeMillis, JsonpDeserializer.longDeserializer(), "master_apply_time_millis"); - op.add(Builder::notificationTime, JsonpDeserializer.stringDeserializer(), "notification_time"); + op.add(Builder::notificationTime, Time._DESERIALIZER, "notification_time"); op.add(Builder::notificationTimeMillis, JsonpDeserializer.longDeserializer(), "notification_time_millis"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Cpu.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Cpu.java index dda946355..0c4d967d9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Cpu.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Cpu.java @@ -23,6 +23,7 @@ package co.elastic.clients.elasticsearch.nodes; +import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -56,19 +57,19 @@ public class Cpu implements JsonpSerializable { private final Integer percent; @Nullable - private final String sys; + private final Time sys; @Nullable private final Long sysInMillis; @Nullable - private final String total; + private final Time total; @Nullable private final Long totalInMillis; @Nullable - private final String user; + private final Time user; @Nullable private final Long userInMillis; @@ -106,7 +107,7 @@ public final Integer percent() { * API name: {@code sys} */ @Nullable - public final String sys() { + public final Time sys() { return this.sys; } @@ -122,7 +123,7 @@ public final Long sysInMillis() { * API name: {@code total} */ @Nullable - public final String total() { + public final Time total() { return this.total; } @@ -138,7 +139,7 @@ public final Long totalInMillis() { * API name: {@code user} */ @Nullable - public final String user() { + public final Time user() { return this.user; } @@ -175,7 +176,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.sys != null) { generator.writeKey("sys"); - generator.write(this.sys); + this.sys.serialize(generator, mapper); } if (this.sysInMillis != null) { @@ -185,7 +186,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.total != null) { generator.writeKey("total"); - generator.write(this.total); + this.total.serialize(generator, mapper); } if (this.totalInMillis != null) { @@ -195,7 +196,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.user != null) { generator.writeKey("user"); - generator.write(this.user); + this.user.serialize(generator, mapper); } if (this.userInMillis != null) { @@ -233,19 +234,19 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Integer percent; @Nullable - private String sys; + private Time sys; @Nullable private Long sysInMillis; @Nullable - private String total; + private Time total; @Nullable private Long totalInMillis; @Nullable - private String user; + private Time user; @Nullable private Long userInMillis; @@ -264,11 +265,18 @@ public final Builder percent(@Nullable Integer value) { /** * API name: {@code sys} */ - public final Builder sys(@Nullable String value) { + public final Builder sys(@Nullable Time value) { this.sys = value; return this; } + /** + * API name: {@code sys} + */ + public final Builder sys(Function> fn) { + return this.sys(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code sys_in_millis} */ @@ -280,11 +288,18 @@ public final Builder sysInMillis(@Nullable Long value) { /** * API name: {@code total} */ - public final Builder total(@Nullable String value) { + public final Builder total(@Nullable Time value) { this.total = value; return this; } + /** + * API name: {@code total} + */ + public final Builder total(Function> fn) { + return this.total(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code total_in_millis} */ @@ -296,11 +311,18 @@ public final Builder totalInMillis(@Nullable Long value) { /** * API name: {@code user} */ - public final Builder user(@Nullable String value) { + public final Builder user(@Nullable Time value) { this.user = value; return this; } + /** + * API name: {@code user} + */ + public final Builder user(Function> fn) { + return this.user(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code user_in_millis} */ @@ -358,11 +380,11 @@ public Cpu build() { protected static void setupCpuDeserializer(ObjectDeserializer op) { op.add(Builder::percent, JsonpDeserializer.integerDeserializer(), "percent"); - op.add(Builder::sys, JsonpDeserializer.stringDeserializer(), "sys"); + op.add(Builder::sys, Time._DESERIALIZER, "sys"); op.add(Builder::sysInMillis, JsonpDeserializer.longDeserializer(), "sys_in_millis"); - op.add(Builder::total, JsonpDeserializer.stringDeserializer(), "total"); + op.add(Builder::total, Time._DESERIALIZER, "total"); op.add(Builder::totalInMillis, JsonpDeserializer.longDeserializer(), "total_in_millis"); - op.add(Builder::user, JsonpDeserializer.stringDeserializer(), "user"); + op.add(Builder::user, Time._DESERIALIZER, "user"); op.add(Builder::userInMillis, JsonpDeserializer.longDeserializer(), "user_in_millis"); op.add(Builder::loadAverage, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.doubleDeserializer()), "load_average"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/ElasticsearchNodesAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/ElasticsearchNodesAsyncClient.java index 6dd182095..13b36453c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/ElasticsearchNodesAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/ElasticsearchNodesAsyncClient.java @@ -131,7 +131,7 @@ public final CompletableFuture getRepositor * Returns information about hot threads on each node in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-hot-threads.html">Documentation * on elastic.co */ @@ -149,7 +149,7 @@ public CompletableFuture hotThreads(HotThreadsRequest reques * a function that initializes a builder to create the * {@link HotThreadsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-hot-threads.html">Documentation * on elastic.co */ @@ -162,7 +162,7 @@ public final CompletableFuture hotThreads( * Returns information about hot threads on each node in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-hot-threads.html">Documentation * on elastic.co */ @@ -177,7 +177,7 @@ public CompletableFuture hotThreads() { * Returns information about nodes in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-info.html">Documentation * on elastic.co */ @@ -195,7 +195,7 @@ public CompletableFuture info(NodesInfoRequest request) { * a function that initializes a builder to create the * {@link NodesInfoRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-info.html">Documentation * on elastic.co */ @@ -208,7 +208,7 @@ public final CompletableFuture info( * Returns information about nodes in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-info.html">Documentation * on elastic.co */ @@ -269,7 +269,7 @@ public CompletableFuture reloadSecureSettings() { * Returns statistical information about nodes in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-stats.html">Documentation * on elastic.co */ @@ -287,7 +287,7 @@ public CompletableFuture stats(NodesStatsRequest request) { * a function that initializes a builder to create the * {@link NodesStatsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-stats.html">Documentation * on elastic.co */ @@ -300,7 +300,7 @@ public final CompletableFuture stats( * Returns statistical information about nodes in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-stats.html">Documentation * on elastic.co */ @@ -315,7 +315,7 @@ public CompletableFuture stats() { * Returns low-level information about REST actions usage on nodes. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-usage.html">Documentation * on elastic.co */ @@ -333,7 +333,7 @@ public CompletableFuture usage(NodesUsageRequest request) { * a function that initializes a builder to create the * {@link NodesUsageRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-usage.html">Documentation * on elastic.co */ @@ -346,7 +346,7 @@ public final CompletableFuture usage( * Returns low-level information about REST actions usage on nodes. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-usage.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/ElasticsearchNodesClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/ElasticsearchNodesClient.java index 6cba615e1..7d3565952 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/ElasticsearchNodesClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/ElasticsearchNodesClient.java @@ -133,7 +133,7 @@ public final GetRepositoriesMeteringInfoResponse getRepositoriesMeteringInfo( * Returns information about hot threads on each node in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-hot-threads.html">Documentation * on elastic.co */ @@ -151,7 +151,7 @@ public HotThreadsResponse hotThreads(HotThreadsRequest request) throws IOExcepti * a function that initializes a builder to create the * {@link HotThreadsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-hot-threads.html">Documentation * on elastic.co */ @@ -164,7 +164,7 @@ public final HotThreadsResponse hotThreads(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-hot-threads.html">Documentation * on elastic.co */ @@ -179,7 +179,7 @@ public HotThreadsResponse hotThreads() throws IOException, ElasticsearchExceptio * Returns information about nodes in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-info.html">Documentation * on elastic.co */ @@ -197,7 +197,7 @@ public NodesInfoResponse info(NodesInfoRequest request) throws IOException, Elas * a function that initializes a builder to create the * {@link NodesInfoRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-info.html">Documentation * on elastic.co */ @@ -210,7 +210,7 @@ public final NodesInfoResponse info(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-info.html">Documentation * on elastic.co */ @@ -273,7 +273,7 @@ public ReloadSecureSettingsResponse reloadSecureSettings() throws IOException, E * Returns statistical information about nodes in the cluster. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-stats.html">Documentation * on elastic.co */ @@ -291,7 +291,7 @@ public NodesStatsResponse stats(NodesStatsRequest request) throws IOException, E * a function that initializes a builder to create the * {@link NodesStatsRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-stats.html">Documentation * on elastic.co */ @@ -304,7 +304,7 @@ public final NodesStatsResponse stats(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-stats.html">Documentation * on elastic.co */ @@ -319,7 +319,7 @@ public NodesStatsResponse stats() throws IOException, ElasticsearchException { * Returns low-level information about REST actions usage on nodes. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-usage.html">Documentation * on elastic.co */ @@ -337,7 +337,7 @@ public NodesUsageResponse usage(NodesUsageRequest request) throws IOException, E * a function that initializes a builder to create the * {@link NodesUsageRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-usage.html">Documentation * on elastic.co */ @@ -350,7 +350,7 @@ public final NodesUsageResponse usage(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/cluster-nodes-usage.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Recording.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Recording.java index e7fe96e55..364457b53 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Recording.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Recording.java @@ -23,6 +23,7 @@ package co.elastic.clients.elasticsearch.nodes; +import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -55,7 +56,7 @@ public class Recording implements JsonpSerializable { private final Long cumulativeExecutionCount; @Nullable - private final String cumulativeExecutionTime; + private final Time cumulativeExecutionTime; @Nullable private final Long cumulativeExecutionTimeMillis; @@ -95,7 +96,7 @@ public final Long cumulativeExecutionCount() { * API name: {@code cumulative_execution_time} */ @Nullable - public final String cumulativeExecutionTime() { + public final Time cumulativeExecutionTime() { return this.cumulativeExecutionTime; } @@ -130,7 +131,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.cumulativeExecutionTime != null) { generator.writeKey("cumulative_execution_time"); - generator.write(this.cumulativeExecutionTime); + this.cumulativeExecutionTime.serialize(generator, mapper); } if (this.cumulativeExecutionTimeMillis != null) { @@ -160,7 +161,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Long cumulativeExecutionCount; @Nullable - private String cumulativeExecutionTime; + private Time cumulativeExecutionTime; @Nullable private Long cumulativeExecutionTimeMillis; @@ -184,11 +185,18 @@ public final Builder cumulativeExecutionCount(@Nullable Long value) { /** * API name: {@code cumulative_execution_time} */ - public final Builder cumulativeExecutionTime(@Nullable String value) { + public final Builder cumulativeExecutionTime(@Nullable Time value) { this.cumulativeExecutionTime = value; return this; } + /** + * API name: {@code cumulative_execution_time} + */ + public final Builder cumulativeExecutionTime(Function> fn) { + return this.cumulativeExecutionTime(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code cumulative_execution_time_millis} */ @@ -227,7 +235,7 @@ protected static void setupRecordingDeserializer(ObjectDeserializer * API name: {@code repository_started_at} */ - public final DateTime repositoryStartedAt() { + public final long repositoryStartedAt() { return this.repositoryStartedAt; } @@ -147,7 +146,7 @@ public final DateTime repositoryStartedAt() { * API name: {@code repository_stopped_at} */ @Nullable - public final DateTime repositoryStoppedAt() { + public final Long repositoryStoppedAt() { return this.repositoryStoppedAt; } @@ -212,10 +211,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.repositoryEphemeralId); generator.writeKey("repository_started_at"); - this.repositoryStartedAt.serialize(generator, mapper); + generator.write(this.repositoryStartedAt); + if (this.repositoryStoppedAt != null) { generator.writeKey("repository_stopped_at"); - this.repositoryStoppedAt.serialize(generator, mapper); + generator.write(this.repositoryStoppedAt); + } generator.writeKey("archived"); generator.write(this.archived); @@ -252,10 +253,10 @@ public static class Builder extends WithJsonObjectBuilderBase private String repositoryEphemeralId; - private DateTime repositoryStartedAt; + private Long repositoryStartedAt; @Nullable - private DateTime repositoryStoppedAt; + private Long repositoryStoppedAt; private Boolean archived; @@ -320,7 +321,7 @@ public final Builder repositoryEphemeralId(String value) { *

* API name: {@code repository_started_at} */ - public final Builder repositoryStartedAt(DateTime value) { + public final Builder repositoryStartedAt(long value) { this.repositoryStartedAt = value; return this; } @@ -331,7 +332,7 @@ public final Builder repositoryStartedAt(DateTime value) { *

* API name: {@code repository_stopped_at} */ - public final Builder repositoryStoppedAt(@Nullable DateTime value) { + public final Builder repositoryStoppedAt(@Nullable Long value) { this.repositoryStoppedAt = value; return this; } @@ -418,8 +419,8 @@ protected static void setupRepositoryMeteringInformationDeserializer( op.add(Builder::repositoryType, JsonpDeserializer.stringDeserializer(), "repository_type"); op.add(Builder::repositoryLocation, RepositoryLocation._DESERIALIZER, "repository_location"); op.add(Builder::repositoryEphemeralId, JsonpDeserializer.stringDeserializer(), "repository_ephemeral_id"); - op.add(Builder::repositoryStartedAt, DateTime._DESERIALIZER, "repository_started_at"); - op.add(Builder::repositoryStoppedAt, DateTime._DESERIALIZER, "repository_stopped_at"); + op.add(Builder::repositoryStartedAt, JsonpDeserializer.longDeserializer(), "repository_started_at"); + op.add(Builder::repositoryStoppedAt, JsonpDeserializer.longDeserializer(), "repository_stopped_at"); op.add(Builder::archived, JsonpDeserializer.booleanDeserializer(), "archived"); op.add(Builder::clusterVersion, JsonpDeserializer.longDeserializer(), "cluster_version"); op.add(Builder::requestCounts, RequestCounts._DESERIALIZER, "request_counts"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeOperatingSystemInfo.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeOperatingSystemInfo.java index 736584caf..40405a611 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeOperatingSystemInfo.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeOperatingSystemInfo.java @@ -35,6 +35,7 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.Integer; +import java.lang.Long; import java.lang.String; import java.util.Objects; import java.util.function.Function; @@ -61,7 +62,7 @@ public class NodeOperatingSystemInfo implements JsonpSerializable { private final String prettyName; - private final int refreshIntervalInMillis; + private final long refreshIntervalInMillis; private final String version; @@ -148,7 +149,7 @@ public final String prettyName() { *

* API name: {@code refresh_interval_in_millis} */ - public final int refreshIntervalInMillis() { + public final long refreshIntervalInMillis() { return this.refreshIntervalInMillis; } @@ -262,7 +263,7 @@ public static class Builder extends WithJsonObjectBuilderBase private String prettyName; - private Integer refreshIntervalInMillis; + private Long refreshIntervalInMillis; private String version; @@ -330,7 +331,7 @@ public final Builder prettyName(String value) { *

* API name: {@code refresh_interval_in_millis} */ - public final Builder refreshIntervalInMillis(int value) { + public final Builder refreshIntervalInMillis(long value) { this.refreshIntervalInMillis = value; return this; } @@ -424,7 +425,7 @@ protected static void setupNodeOperatingSystemInfoDeserializer( op.add(Builder::allocatedProcessors, JsonpDeserializer.integerDeserializer(), "allocated_processors"); op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(Builder::prettyName, JsonpDeserializer.stringDeserializer(), "pretty_name"); - op.add(Builder::refreshIntervalInMillis, JsonpDeserializer.integerDeserializer(), "refresh_interval_in_millis"); + op.add(Builder::refreshIntervalInMillis, JsonpDeserializer.longDeserializer(), "refresh_interval_in_millis"); op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); op.add(Builder::cpu, NodeInfoOSCPU._DESERIALIZER, "cpu"); op.add(Builder::mem, NodeInfoMemory._DESERIALIZER, "mem"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeThreadPoolInfo.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeThreadPoolInfo.java index 08f58f088..1b158a5a2 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeThreadPoolInfo.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeThreadPoolInfo.java @@ -23,6 +23,7 @@ package co.elastic.clients.elasticsearch.nodes.info; +import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -54,7 +55,7 @@ public class NodeThreadPoolInfo implements JsonpSerializable { private final Integer core; @Nullable - private final String keepAlive; + private final Time keepAlive; @Nullable private final Integer max; @@ -95,7 +96,7 @@ public final Integer core() { * API name: {@code keep_alive} */ @Nullable - public final String keepAlive() { + public final Time keepAlive() { return this.keepAlive; } @@ -147,7 +148,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.keepAlive != null) { generator.writeKey("keep_alive"); - generator.write(this.keepAlive); + this.keepAlive.serialize(generator, mapper); } if (this.max != null) { @@ -186,7 +187,7 @@ public static class Builder extends WithJsonObjectBuilderBase private Integer core; @Nullable - private String keepAlive; + private Time keepAlive; @Nullable private Integer max; @@ -209,11 +210,18 @@ public final Builder core(@Nullable Integer value) { /** * API name: {@code keep_alive} */ - public final Builder keepAlive(@Nullable String value) { + public final Builder keepAlive(@Nullable Time value) { this.keepAlive = value; return this; } + /** + * API name: {@code keep_alive} + */ + public final Builder keepAlive(Function> fn) { + return this.keepAlive(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code max} */ @@ -275,7 +283,7 @@ public NodeThreadPoolInfo build() { protected static void setupNodeThreadPoolInfoDeserializer(ObjectDeserializer op) { op.add(Builder::core, JsonpDeserializer.integerDeserializer(), "core"); - op.add(Builder::keepAlive, JsonpDeserializer.stringDeserializer(), "keep_alive"); + op.add(Builder::keepAlive, Time._DESERIALIZER, "keep_alive"); op.add(Builder::max, JsonpDeserializer.integerDeserializer(), "max"); op.add(Builder::queueSize, JsonpDeserializer.integerDeserializer(), "queue_size"); op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/usage/NodeUsage.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/usage/NodeUsage.java index 559064039..57bf78876 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/usage/NodeUsage.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/usage/NodeUsage.java @@ -32,11 +32,11 @@ 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.Integer; +import java.lang.Long; import java.lang.String; import java.util.Map; import java.util.Objects; @@ -54,9 +54,9 @@ public class NodeUsage implements JsonpSerializable { private final Map restActions; - private final DateTime since; + private final long since; - private final DateTime timestamp; + private final long timestamp; private final Map aggregations; @@ -85,14 +85,14 @@ public final Map restActions() { /** * Required - API name: {@code since} */ - public final DateTime since() { + public final long since() { return this.since; } /** * Required - API name: {@code timestamp} */ - public final DateTime timestamp() { + public final long timestamp() { return this.timestamp; } @@ -126,9 +126,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeKey("since"); - this.since.serialize(generator, mapper); + generator.write(this.since); + generator.writeKey("timestamp"); - this.timestamp.serialize(generator, mapper); + generator.write(this.timestamp); + if (ApiTypeHelper.isDefined(this.aggregations)) { generator.writeKey("aggregations"); generator.writeStartObject(); @@ -157,9 +159,9 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private Map restActions; - private DateTime since; + private Long since; - private DateTime timestamp; + private Long timestamp; private Map aggregations; @@ -186,7 +188,7 @@ public final Builder restActions(String key, Integer value) { /** * Required - API name: {@code since} */ - public final Builder since(DateTime value) { + public final Builder since(long value) { this.since = value; return this; } @@ -194,7 +196,7 @@ public final Builder since(DateTime value) { /** * Required - API name: {@code timestamp} */ - public final Builder timestamp(DateTime value) { + public final Builder timestamp(long value) { this.timestamp = value; return this; } @@ -249,8 +251,8 @@ protected static void setupNodeUsageDeserializer(ObjectDeserializer hasPrivileges() { HasPrivilegesRequest._ENDPOINT, this.transportOptions); } + // ----- Endpoint: security.has_privileges_user_profile + + /** + * Determines whether the users associated with the specified profile IDs have + * all the requested privileges. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture hasPrivilegesUserProfile( + HasPrivilegesUserProfileRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) HasPrivilegesUserProfileRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Determines whether the users associated with the specified profile IDs have + * all the requested privileges. + * + * @param fn + * a function that initializes a builder to create the + * {@link HasPrivilegesUserProfileRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture hasPrivilegesUserProfile( + Function> fn) { + return hasPrivilegesUserProfile(fn.apply(new HasPrivilegesUserProfileRequest.Builder()).build()); + } + // ----- Endpoint: security.invalidate_api_key /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityClient.java index 5df9a6768..5df077db6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ElasticsearchSecurityClient.java @@ -1294,6 +1294,43 @@ public HasPrivilegesResponse hasPrivileges() throws IOException, ElasticsearchEx this.transportOptions); } + // ----- Endpoint: security.has_privileges_user_profile + + /** + * Determines whether the users associated with the specified profile IDs have + * all the requested privileges. + * + * @see Documentation + * on elastic.co + */ + + public HasPrivilegesUserProfileResponse hasPrivilegesUserProfile(HasPrivilegesUserProfileRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) HasPrivilegesUserProfileRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Determines whether the users associated with the specified profile IDs have + * all the requested privileges. + * + * @param fn + * a function that initializes a builder to create the + * {@link HasPrivilegesUserProfileRequest} + * @see Documentation + * on elastic.co + */ + + public final HasPrivilegesUserProfileResponse hasPrivilegesUserProfile( + Function> fn) + throws IOException, ElasticsearchException { + return hasPrivilegesUserProfile(fn.apply(new HasPrivilegesUserProfileRequest.Builder()).build()); + } + // ----- Endpoint: security.invalidate_api_key /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GrantApiKeyResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GrantApiKeyResponse.java index 3b61010ca..8e4fda4a7 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GrantApiKeyResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GrantApiKeyResponse.java @@ -31,10 +31,10 @@ 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.Long; import java.lang.String; import java.util.Objects; import java.util.function.Function; @@ -56,7 +56,7 @@ public class GrantApiKeyResponse implements JsonpSerializable { private final String name; @Nullable - private final DateTime expiration; + private final Long expiration; // --------------------------------------------------------------------------------------------- @@ -98,7 +98,7 @@ public final String name() { * API name: {@code expiration} */ @Nullable - public final DateTime expiration() { + public final Long expiration() { return this.expiration; } @@ -124,7 +124,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.expiration != null) { generator.writeKey("expiration"); - this.expiration.serialize(generator, mapper); + generator.write(this.expiration); + } } @@ -150,7 +151,7 @@ public static class Builder extends WithJsonObjectBuilderBase private String name; @Nullable - private DateTime expiration; + private Long expiration; /** * Required - API name: {@code api_key} @@ -179,7 +180,7 @@ public final Builder name(String value) { /** * API name: {@code expiration} */ - public final Builder expiration(@Nullable DateTime value) { + public final Builder expiration(@Nullable Long value) { this.expiration = value; return this; } @@ -215,7 +216,7 @@ protected static void setupGrantApiKeyResponseDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class HasPrivilegesUserProfileRequest extends RequestBase implements JsonpSerializable { + private final PrivilegesCheck privileges; + + private final List uids; + + // --------------------------------------------------------------------------------------------- + + private HasPrivilegesUserProfileRequest(Builder builder) { + + this.privileges = ApiTypeHelper.requireNonNull(builder.privileges, this, "privileges"); + this.uids = ApiTypeHelper.unmodifiableRequired(builder.uids, this, "uids"); + + } + + public static HasPrivilegesUserProfileRequest of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code privileges} + */ + public final PrivilegesCheck privileges() { + return this.privileges; + } + + /** + * Required - A list of profile IDs. The privileges are checked for associated + * users of the profiles. + *

+ * API name: {@code uids} + */ + public final List uids() { + return this.uids; + } + + /** + * 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("privileges"); + this.privileges.serialize(generator, mapper); + + if (ApiTypeHelper.isDefined(this.uids)) { + generator.writeKey("uids"); + generator.writeStartArray(); + for (String item0 : this.uids) { + generator.write(item0); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link HasPrivilegesUserProfileRequest}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private PrivilegesCheck privileges; + + private List uids; + + /** + * Required - API name: {@code privileges} + */ + public final Builder privileges(PrivilegesCheck value) { + this.privileges = value; + return this; + } + + /** + * Required - API name: {@code privileges} + */ + public final Builder privileges(Function> fn) { + return this.privileges(fn.apply(new PrivilegesCheck.Builder()).build()); + } + + /** + * Required - A list of profile IDs. The privileges are checked for associated + * users of the profiles. + *

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

+ * Adds all elements of list to uids. + */ + public final Builder uids(List list) { + this.uids = _listAddAll(this.uids, list); + return this; + } + + /** + * Required - A list of profile IDs. The privileges are checked for associated + * users of the profiles. + *

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

+ * Adds one or more values to uids. + */ + public final Builder uids(String value, String... values) { + this.uids = _listAdd(this.uids, value, values); + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link HasPrivilegesUserProfileRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public HasPrivilegesUserProfileRequest build() { + _checkSingleUse(); + + return new HasPrivilegesUserProfileRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link HasPrivilegesUserProfileRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, HasPrivilegesUserProfileRequest::setupHasPrivilegesUserProfileRequestDeserializer); + + protected static void setupHasPrivilegesUserProfileRequestDeserializer( + ObjectDeserializer op) { + + op.add(Builder::privileges, PrivilegesCheck._DESERIALIZER, "privileges"); + op.add(Builder::uids, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "uids"); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code security.has_privileges_user_profile}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/security.has_privileges_user_profile", + + // Request method + request -> { + return "POST"; + + }, + + // Request path + request -> { + return "/_security/profile/_has_privileges"; + + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), true, HasPrivilegesUserProfileResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/HasPrivilegesUserProfileResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/HasPrivilegesUserProfileResponse.java new file mode 100644 index 000000000..e92f98b1f --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/HasPrivilegesUserProfileResponse.java @@ -0,0 +1,235 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.security; + +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.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: security.has_privileges_user_profile.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class HasPrivilegesUserProfileResponse implements JsonpSerializable { + private final List hasPrivilegeUids; + + private final List errorUids; + + // --------------------------------------------------------------------------------------------- + + private HasPrivilegesUserProfileResponse(Builder builder) { + + this.hasPrivilegeUids = ApiTypeHelper.unmodifiableRequired(builder.hasPrivilegeUids, this, "hasPrivilegeUids"); + this.errorUids = ApiTypeHelper.unmodifiable(builder.errorUids); + + } + + public static HasPrivilegesUserProfileResponse of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The subset of the requested profile IDs of the users that have all + * the requested privileges. + *

+ * API name: {@code has_privilege_uids} + */ + public final List hasPrivilegeUids() { + return this.hasPrivilegeUids; + } + + /** + * The subset of the requested profile IDs for which an error was encountered. + * It does not include the missing profile IDs or the profile IDs of the users + * that do not have all the requested privileges. This field is absent if empty. + *

+ * API name: {@code error_uids} + */ + public final List errorUids() { + return this.errorUids; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (ApiTypeHelper.isDefined(this.hasPrivilegeUids)) { + generator.writeKey("has_privilege_uids"); + generator.writeStartArray(); + for (String item0 : this.hasPrivilegeUids) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.errorUids)) { + generator.writeKey("error_uids"); + generator.writeStartArray(); + for (String item0 : this.errorUids) { + generator.write(item0); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link HasPrivilegesUserProfileResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private List hasPrivilegeUids; + + @Nullable + private List errorUids; + + /** + * Required - The subset of the requested profile IDs of the users that have all + * the requested privileges. + *

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

+ * Adds all elements of list to hasPrivilegeUids. + */ + public final Builder hasPrivilegeUids(List list) { + this.hasPrivilegeUids = _listAddAll(this.hasPrivilegeUids, list); + return this; + } + + /** + * Required - The subset of the requested profile IDs of the users that have all + * the requested privileges. + *

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

+ * Adds one or more values to hasPrivilegeUids. + */ + public final Builder hasPrivilegeUids(String value, String... values) { + this.hasPrivilegeUids = _listAdd(this.hasPrivilegeUids, value, values); + return this; + } + + /** + * The subset of the requested profile IDs for which an error was encountered. + * It does not include the missing profile IDs or the profile IDs of the users + * that do not have all the requested privileges. This field is absent if empty. + *

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

+ * Adds all elements of list to errorUids. + */ + public final Builder errorUids(List list) { + this.errorUids = _listAddAll(this.errorUids, list); + return this; + } + + /** + * The subset of the requested profile IDs for which an error was encountered. + * It does not include the missing profile IDs or the profile IDs of the users + * that do not have all the requested privileges. This field is absent if empty. + *

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

+ * Adds one or more values to errorUids. + */ + public final Builder errorUids(String value, String... values) { + this.errorUids = _listAdd(this.errorUids, value, values); + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link HasPrivilegesUserProfileResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public HasPrivilegesUserProfileResponse build() { + _checkSingleUse(); + + return new HasPrivilegesUserProfileResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link HasPrivilegesUserProfileResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, HasPrivilegesUserProfileResponse::setupHasPrivilegesUserProfileResponseDeserializer); + + protected static void setupHasPrivilegesUserProfileResponseDeserializer( + ObjectDeserializer op) { + + op.add(Builder::hasPrivilegeUids, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "has_privilege_uids"); + op.add(Builder::errorUids, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "error_uids"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SuggestUserProfilesRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SuggestUserProfilesRequest.java index 806578ff7..67737cbf6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SuggestUserProfilesRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/SuggestUserProfilesRequest.java @@ -25,6 +25,7 @@ import co.elastic.clients.elasticsearch._types.ErrorResponse; import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.elasticsearch.security.suggest_user_profiles.Hint; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -39,12 +40,10 @@ import jakarta.json.stream.JsonGenerator; import java.lang.Long; import java.lang.String; -import java.util.HashMap; +import java.util.Collections; 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; // typedef: security.suggest_user_profiles.Request @@ -60,6 +59,9 @@ public class SuggestUserProfilesRequest extends RequestBase implements JsonpSerializable { private final List data; + @Nullable + private final Hint hint; + @Nullable private final String name; @@ -71,6 +73,7 @@ public class SuggestUserProfilesRequest extends RequestBase implements JsonpSeri private SuggestUserProfilesRequest(Builder builder) { this.data = ApiTypeHelper.unmodifiable(builder.data); + this.hint = builder.hint; this.name = builder.name; this.size = builder.size; @@ -92,6 +95,19 @@ public final List data() { return this.data; } + /** + * Extra search criteria to improve relevance of the suggestion result. Profiles + * matching the spcified hint are ranked higher in the response. Profiles not + * matching the hint don't exclude the profile from the response as long as the + * profile matches the name field query. + *

+ * API name: {@code hint} + */ + @Nullable + public final Hint hint() { + return this.hint; + } + /** * Query string used to match name-related fields in user profile documents. * Name-related fields are the user's username, @@ -125,6 +141,21 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (ApiTypeHelper.isDefined(this.data)) { + generator.writeKey("data"); + generator.writeStartArray(); + for (String item0 : this.data) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (this.hint != null) { + generator.writeKey("hint"); + this.hint.serialize(generator, mapper); + + } if (this.name != null) { generator.writeKey("name"); generator.write(this.name); @@ -150,6 +181,9 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private List data; + @Nullable + private Hint hint; + @Nullable private String name; @@ -186,6 +220,31 @@ public final Builder data(String value, String... values) { return this; } + /** + * Extra search criteria to improve relevance of the suggestion result. Profiles + * matching the spcified hint are ranked higher in the response. Profiles not + * matching the hint don't exclude the profile from the response as long as the + * profile matches the name field query. + *

+ * API name: {@code hint} + */ + public final Builder hint(@Nullable Hint value) { + this.hint = value; + return this; + } + + /** + * Extra search criteria to improve relevance of the suggestion result. Profiles + * matching the spcified hint are ranked higher in the response. Profiles not + * matching the hint don't exclude the profile from the response as long as the + * profile matches the name field query. + *

+ * API name: {@code hint} + */ + public final Builder hint(Function> fn) { + return this.hint(fn.apply(new Hint.Builder()).build()); + } + /** * Query string used to match name-related fields in user profile documents. * Name-related fields are the user's username, @@ -237,6 +296,8 @@ public SuggestUserProfilesRequest build() { protected static void setupSuggestUserProfilesRequestDeserializer( ObjectDeserializer op) { + op.add(Builder::data, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "data"); + op.add(Builder::hint, Hint._DESERIALIZER, "hint"); op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(Builder::size, JsonpDeserializer.longDeserializer(), "size"); @@ -264,11 +325,7 @@ protected static void setupSuggestUserProfilesRequestDeserializer( // Request parameters request -> { - Map params = new HashMap<>(); - if (ApiTypeHelper.isDefined(request.data)) { - params.put("data", request.data.stream().map(v -> v).collect(Collectors.joining(","))); - } - return params; + return Collections.emptyMap(); }, SimpleEndpoint.emptyMap(), true, SuggestUserProfilesResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/has_privileges_user_profile/PrivilegesCheck.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/has_privileges_user_profile/PrivilegesCheck.java new file mode 100644 index 000000000..9accd6959 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/has_privileges_user_profile/PrivilegesCheck.java @@ -0,0 +1,280 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.security.has_privileges_user_profile; + +import co.elastic.clients.elasticsearch.security.ClusterPrivilege; +import co.elastic.clients.elasticsearch.security.has_privileges.ApplicationPrivilegesCheck; +import co.elastic.clients.elasticsearch.security.has_privileges.IndexPrivilegesCheck; +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.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: security.has_privileges_user_profile.PrivilegesCheck + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class PrivilegesCheck implements JsonpSerializable { + private final List application; + + private final List cluster; + + private final List index; + + // --------------------------------------------------------------------------------------------- + + private PrivilegesCheck(Builder builder) { + + this.application = ApiTypeHelper.unmodifiable(builder.application); + this.cluster = ApiTypeHelper.unmodifiable(builder.cluster); + this.index = ApiTypeHelper.unmodifiable(builder.index); + + } + + public static PrivilegesCheck of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code application} + */ + public final List application() { + return this.application; + } + + /** + * A list of the cluster privileges that you want to check. + *

+ * API name: {@code cluster} + */ + public final List cluster() { + return this.cluster; + } + + /** + * API name: {@code index} + */ + public final List index() { + return this.index; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (ApiTypeHelper.isDefined(this.application)) { + generator.writeKey("application"); + generator.writeStartArray(); + for (ApplicationPrivilegesCheck item0 : this.application) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.cluster)) { + generator.writeKey("cluster"); + generator.writeStartArray(); + for (ClusterPrivilege item0 : this.cluster) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.index)) { + generator.writeKey("index"); + generator.writeStartArray(); + for (IndexPrivilegesCheck item0 : this.index) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link PrivilegesCheck}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private List application; + + @Nullable + private List cluster; + + @Nullable + private List index; + + /** + * API name: {@code application} + *

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

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

+ * Adds a value to application using a builder lambda. + */ + public final Builder application( + Function> fn) { + return application(fn.apply(new ApplicationPrivilegesCheck.Builder()).build()); + } + + /** + * A list of the cluster privileges that you want to check. + *

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

+ * Adds all elements of list to cluster. + */ + public final Builder cluster(List list) { + this.cluster = _listAddAll(this.cluster, list); + return this; + } + + /** + * A list of the cluster privileges that you want to check. + *

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

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

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

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

+ * Adds a value to index using a builder lambda. + */ + public final Builder index(Function> fn) { + return index(fn.apply(new IndexPrivilegesCheck.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link PrivilegesCheck}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public PrivilegesCheck build() { + _checkSingleUse(); + + return new PrivilegesCheck(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PrivilegesCheck} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + PrivilegesCheck::setupPrivilegesCheckDeserializer); + + protected static void setupPrivilegesCheckDeserializer(ObjectDeserializer op) { + + op.add(Builder::application, JsonpDeserializer.arrayDeserializer(ApplicationPrivilegesCheck._DESERIALIZER), + "application"); + op.add(Builder::cluster, JsonpDeserializer.arrayDeserializer(ClusterPrivilege._DESERIALIZER), "cluster"); + op.add(Builder::index, JsonpDeserializer.arrayDeserializer(IndexPrivilegesCheck._DESERIALIZER), "index"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/suggest_user_profiles/Hint.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/suggest_user_profiles/Hint.java new file mode 100644 index 000000000..84dfed2e9 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/suggest_user_profiles/Hint.java @@ -0,0 +1,234 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.security.suggest_user_profiles; + +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.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: security.suggest_user_profiles.Hint + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class Hint implements JsonpSerializable { + private final List uids; + + private final Map> labels; + + // --------------------------------------------------------------------------------------------- + + private Hint(Builder builder) { + + this.uids = ApiTypeHelper.unmodifiable(builder.uids); + this.labels = ApiTypeHelper.unmodifiable(builder.labels); + + } + + public static Hint of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * A list of Profile UIDs to match against. + *

+ * API name: {@code uids} + */ + public final List uids() { + return this.uids; + } + + /** + * A single key-value pair to match against the labels section of a profile. A + * profile is considered matching if it matches at least one of the strings. + *

+ * API name: {@code labels} + */ + public final Map> labels() { + return this.labels; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (ApiTypeHelper.isDefined(this.uids)) { + generator.writeKey("uids"); + generator.writeStartArray(); + for (String item0 : this.uids) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.labels)) { + generator.writeKey("labels"); + generator.writeStartObject(); + for (Map.Entry> item0 : this.labels.entrySet()) { + generator.writeKey(item0.getKey()); + generator.writeStartArray(); + if (item0.getValue() != null) { + for (String item1 : item0.getValue()) { + generator.write(item1); + + } + } + generator.writeEnd(); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Hint}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private List uids; + + @Nullable + private Map> labels; + + /** + * A list of Profile UIDs to match against. + *

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

+ * Adds all elements of list to uids. + */ + public final Builder uids(List list) { + this.uids = _listAddAll(this.uids, list); + return this; + } + + /** + * A list of Profile UIDs to match against. + *

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

+ * Adds one or more values to uids. + */ + public final Builder uids(String value, String... values) { + this.uids = _listAdd(this.uids, value, values); + return this; + } + + /** + * A single key-value pair to match against the labels section of a profile. A + * profile is considered matching if it matches at least one of the strings. + *

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

+ * Adds all entries of map to labels. + */ + public final Builder labels(Map> map) { + this.labels = _mapPutAll(this.labels, map); + return this; + } + + /** + * A single key-value pair to match against the labels section of a profile. A + * profile is considered matching if it matches at least one of the strings. + *

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

+ * Adds an entry to labels. + */ + public final Builder labels(String key, List value) { + this.labels = _mapPut(this.labels, key, value); + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link Hint}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public Hint build() { + _checkSingleUse(); + + return new Hint(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Hint} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Hint::setupHintDeserializer); + + protected static void setupHintDeserializer(ObjectDeserializer op) { + + op.add(Builder::uids, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "uids"); + op.add(Builder::labels, JsonpDeserializer.stringMapDeserializer( + JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer())), "labels"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/get_node/NodeShutdownStatus.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/get_node/NodeShutdownStatus.java index f6fd0eceb..3fbd4358e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/get_node/NodeShutdownStatus.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/shutdown/get_node/NodeShutdownStatus.java @@ -31,10 +31,10 @@ 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.Long; import java.lang.String; import java.util.Objects; import java.util.function.Function; @@ -56,7 +56,7 @@ public class NodeShutdownStatus implements JsonpSerializable { private final String reason; - private final DateTime shutdownStartedmillis; + private final long shutdownStartedmillis; private final ShutdownStatus status; @@ -110,7 +110,7 @@ public final String reason() { /** * Required - API name: {@code shutdown_startedmillis} */ - public final DateTime shutdownStartedmillis() { + public final long shutdownStartedmillis() { return this.shutdownStartedmillis; } @@ -162,7 +162,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.reason); generator.writeKey("shutdown_startedmillis"); - this.shutdownStartedmillis.serialize(generator, mapper); + generator.write(this.shutdownStartedmillis); + generator.writeKey("status"); this.status.serialize(generator, mapper); generator.writeKey("shard_migration"); @@ -196,7 +197,7 @@ public static class Builder extends WithJsonObjectBuilderBase private String reason; - private DateTime shutdownStartedmillis; + private Long shutdownStartedmillis; private ShutdownStatus status; @@ -233,7 +234,7 @@ public final Builder reason(String value) { /** * Required - API name: {@code shutdown_startedmillis} */ - public final Builder shutdownStartedmillis(DateTime value) { + public final Builder shutdownStartedmillis(long value) { this.shutdownStartedmillis = value; return this; } @@ -324,7 +325,7 @@ protected static void setupNodeShutdownStatusDeserializer(ObjectDeserializer implements ObjectBuilder { - private String retentionDeletionTime; + private Time retentionDeletionTime; - private DateTime retentionDeletionTimeMillis; + private Long retentionDeletionTimeMillis; private Long retentionFailed; @@ -253,15 +254,22 @@ public static class Builder extends WithJsonObjectBuilderBase implement /** * Required - API name: {@code retention_deletion_time} */ - public final Builder retentionDeletionTime(String value) { + public final Builder retentionDeletionTime(Time value) { this.retentionDeletionTime = value; return this; } + /** + * Required - API name: {@code retention_deletion_time} + */ + public final Builder retentionDeletionTime(Function> fn) { + return this.retentionDeletionTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code retention_deletion_time_millis} */ - public final Builder retentionDeletionTimeMillis(DateTime value) { + public final Builder retentionDeletionTimeMillis(long value) { this.retentionDeletionTimeMillis = value; return this; } @@ -370,8 +378,9 @@ public GetStatsResponse build() { protected static void setupGetStatsResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::retentionDeletionTime, JsonpDeserializer.stringDeserializer(), "retention_deletion_time"); - op.add(Builder::retentionDeletionTimeMillis, DateTime._DESERIALIZER, "retention_deletion_time_millis"); + op.add(Builder::retentionDeletionTime, Time._DESERIALIZER, "retention_deletion_time"); + op.add(Builder::retentionDeletionTimeMillis, JsonpDeserializer.longDeserializer(), + "retention_deletion_time_millis"); op.add(Builder::retentionFailed, JsonpDeserializer.longDeserializer(), "retention_failed"); op.add(Builder::retentionRuns, JsonpDeserializer.longDeserializer(), "retention_runs"); op.add(Builder::retentionTimedOut, JsonpDeserializer.longDeserializer(), "retention_timed_out"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/slm/InProgress.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/slm/InProgress.java index 8b0b6daea..42731539a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/slm/InProgress.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/slm/InProgress.java @@ -31,10 +31,10 @@ 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.Long; import java.lang.String; import java.util.Objects; import java.util.function.Function; @@ -51,7 +51,7 @@ public class InProgress implements JsonpSerializable { private final String name; - private final DateTime startTimeMillis; + private final long startTimeMillis; private final String state; @@ -82,7 +82,7 @@ public final String name() { /** * Required - API name: {@code start_time_millis} */ - public final DateTime startTimeMillis() { + public final long startTimeMillis() { return this.startTimeMillis; } @@ -115,7 +115,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.name); generator.writeKey("start_time_millis"); - this.startTimeMillis.serialize(generator, mapper); + generator.write(this.startTimeMillis); + generator.writeKey("state"); generator.write(this.state); @@ -138,7 +139,7 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private String name; - private DateTime startTimeMillis; + private Long startTimeMillis; private String state; @@ -155,7 +156,7 @@ public final Builder name(String value) { /** * Required - API name: {@code start_time_millis} */ - public final Builder startTimeMillis(DateTime value) { + public final Builder startTimeMillis(long value) { this.startTimeMillis = value; return this; } @@ -205,7 +206,7 @@ public InProgress build() { protected static void setupInProgressDeserializer(ObjectDeserializer op) { op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::startTimeMillis, DateTime._DESERIALIZER, "start_time_millis"); + op.add(Builder::startTimeMillis, JsonpDeserializer.longDeserializer(), "start_time_millis"); op.add(Builder::state, JsonpDeserializer.stringDeserializer(), "state"); op.add(Builder::uuid, JsonpDeserializer.stringDeserializer(), "uuid"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/slm/SnapshotLifecycle.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/slm/SnapshotLifecycle.java index 7bc36abce..e66842216 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/slm/SnapshotLifecycle.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/slm/SnapshotLifecycle.java @@ -61,12 +61,12 @@ public class SnapshotLifecycle implements JsonpSerializable { @Nullable private final DateTime modifiedDate; - private final DateTime modifiedDateMillis; + private final long modifiedDateMillis; @Nullable private final DateTime nextExecution; - private final DateTime nextExecutionMillis; + private final long nextExecutionMillis; private final SlmPolicy policy; @@ -131,7 +131,7 @@ public final DateTime modifiedDate() { /** * Required - API name: {@code modified_date_millis} */ - public final DateTime modifiedDateMillis() { + public final long modifiedDateMillis() { return this.modifiedDateMillis; } @@ -146,7 +146,7 @@ public final DateTime nextExecution() { /** * Required - API name: {@code next_execution_millis} */ - public final DateTime nextExecutionMillis() { + public final long nextExecutionMillis() { return this.nextExecutionMillis; } @@ -202,13 +202,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.modifiedDate.serialize(generator, mapper); } generator.writeKey("modified_date_millis"); - this.modifiedDateMillis.serialize(generator, mapper); + generator.write(this.modifiedDateMillis); + if (this.nextExecution != null) { generator.writeKey("next_execution"); this.nextExecution.serialize(generator, mapper); } generator.writeKey("next_execution_millis"); - this.nextExecutionMillis.serialize(generator, mapper); + generator.write(this.nextExecutionMillis); + generator.writeKey("policy"); this.policy.serialize(generator, mapper); @@ -244,12 +246,12 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private DateTime modifiedDate; - private DateTime modifiedDateMillis; + private Long modifiedDateMillis; @Nullable private DateTime nextExecution; - private DateTime nextExecutionMillis; + private Long nextExecutionMillis; private SlmPolicy policy; @@ -313,7 +315,7 @@ public final Builder modifiedDate(@Nullable DateTime value) { /** * Required - API name: {@code modified_date_millis} */ - public final Builder modifiedDateMillis(DateTime value) { + public final Builder modifiedDateMillis(long value) { this.modifiedDateMillis = value; return this; } @@ -329,7 +331,7 @@ public final Builder nextExecution(@Nullable DateTime value) { /** * Required - API name: {@code next_execution_millis} */ - public final Builder nextExecutionMillis(DateTime value) { + public final Builder nextExecutionMillis(long value) { this.nextExecutionMillis = value; return this; } @@ -404,9 +406,9 @@ protected static void setupSnapshotLifecycleDeserializer(ObjectDeserializer> fn) { * API name: {@code retention_deletion_time} */ @Nullable - public final DateTime retentionDeletionTime() { + public final Time retentionDeletionTime() { return this.retentionDeletionTime; } @@ -112,7 +112,7 @@ public final DateTime retentionDeletionTime() { * API name: {@code retention_deletion_time_millis} */ @Nullable - public final DateTime retentionDeletionTimeMillis() { + public final Long retentionDeletionTimeMillis() { return this.retentionDeletionTimeMillis; } @@ -194,10 +194,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.retentionDeletionTime != null) { generator.writeKey("retention_deletion_time"); this.retentionDeletionTime.serialize(generator, mapper); + } if (this.retentionDeletionTimeMillis != null) { generator.writeKey("retention_deletion_time_millis"); - this.retentionDeletionTimeMillis.serialize(generator, mapper); + generator.write(this.retentionDeletionTimeMillis); + } if (this.retentionFailed != null) { generator.writeKey("retention_failed"); @@ -255,10 +257,10 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { @Nullable - private DateTime retentionDeletionTime; + private Time retentionDeletionTime; @Nullable - private DateTime retentionDeletionTimeMillis; + private Long retentionDeletionTimeMillis; @Nullable private Long retentionFailed; @@ -287,15 +289,22 @@ public static class Builder extends WithJsonObjectBuilderBase implement /** * API name: {@code retention_deletion_time} */ - public final Builder retentionDeletionTime(@Nullable DateTime value) { + public final Builder retentionDeletionTime(@Nullable Time value) { this.retentionDeletionTime = value; return this; } + /** + * API name: {@code retention_deletion_time} + */ + public final Builder retentionDeletionTime(Function> fn) { + return this.retentionDeletionTime(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code retention_deletion_time_millis} */ - public final Builder retentionDeletionTimeMillis(@Nullable DateTime value) { + public final Builder retentionDeletionTimeMillis(@Nullable Long value) { this.retentionDeletionTimeMillis = value; return this; } @@ -392,8 +401,9 @@ public Statistics build() { protected static void setupStatisticsDeserializer(ObjectDeserializer op) { - op.add(Builder::retentionDeletionTime, DateTime._DESERIALIZER, "retention_deletion_time"); - op.add(Builder::retentionDeletionTimeMillis, DateTime._DESERIALIZER, "retention_deletion_time_millis"); + op.add(Builder::retentionDeletionTime, Time._DESERIALIZER, "retention_deletion_time"); + op.add(Builder::retentionDeletionTimeMillis, JsonpDeserializer.longDeserializer(), + "retention_deletion_time_millis"); op.add(Builder::retentionFailed, JsonpDeserializer.longDeserializer(), "retention_failed"); op.add(Builder::retentionRuns, JsonpDeserializer.longDeserializer(), "retention_runs"); op.add(Builder::retentionTimedOut, JsonpDeserializer.longDeserializer(), "retention_timed_out"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/ShardsStatsSummary.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/ShardsStatsSummary.java index 7a0fef95b..540dbae64 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/ShardsStatsSummary.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/ShardsStatsSummary.java @@ -23,6 +23,7 @@ package co.elastic.clients.elasticsearch.snapshot; +import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -55,6 +56,9 @@ public class ShardsStatsSummary implements JsonpSerializable { private final long startTimeInMillis; + @Nullable + private final Time time; + private final long timeInMillis; // --------------------------------------------------------------------------------------------- @@ -64,6 +68,7 @@ private ShardsStatsSummary(Builder builder) { this.incremental = ApiTypeHelper.requireNonNull(builder.incremental, this, "incremental"); this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); this.startTimeInMillis = ApiTypeHelper.requireNonNull(builder.startTimeInMillis, this, "startTimeInMillis"); + this.time = builder.time; this.timeInMillis = ApiTypeHelper.requireNonNull(builder.timeInMillis, this, "timeInMillis"); } @@ -93,6 +98,14 @@ public final long startTimeInMillis() { return this.startTimeInMillis; } + /** + * API name: {@code time} + */ + @Nullable + public final Time time() { + return this.time; + } + /** * Required - API name: {@code time_in_millis} */ @@ -120,6 +133,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("start_time_in_millis"); generator.write(this.startTimeInMillis); + if (this.time != null) { + generator.writeKey("time"); + this.time.serialize(generator, mapper); + + } generator.writeKey("time_in_millis"); generator.write(this.timeInMillis); @@ -145,6 +163,9 @@ public static class Builder extends WithJsonObjectBuilderBase private Long startTimeInMillis; + @Nullable + private Time time; + private Long timeInMillis; /** @@ -186,6 +207,21 @@ public final Builder startTimeInMillis(long value) { return this; } + /** + * API name: {@code time} + */ + public final Builder time(@Nullable Time value) { + this.time = value; + return this; + } + + /** + * API name: {@code time} + */ + public final Builder time(Function> fn) { + return this.time(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code time_in_millis} */ @@ -225,6 +261,7 @@ protected static void setupShardsStatsSummaryDeserializer(ObjectDeserializer failures; @@ -93,10 +93,10 @@ public class SnapshotInfo implements JsonpSerializable { private final ShardStatistics shards; @Nullable - private final Time startTime; + private final DateTime startTime; @Nullable - private final DateTime startTimeInMillis; + private final Long startTimeInMillis; @Nullable private final String state; @@ -162,7 +162,7 @@ public final Time duration() { * API name: {@code duration_in_millis} */ @Nullable - public final DateTime durationInMillis() { + public final Long durationInMillis() { return this.durationInMillis; } @@ -170,7 +170,7 @@ public final DateTime durationInMillis() { * API name: {@code end_time} */ @Nullable - public final Time endTime() { + public final DateTime endTime() { return this.endTime; } @@ -178,7 +178,7 @@ public final Time endTime() { * API name: {@code end_time_in_millis} */ @Nullable - public final DateTime endTimeInMillis() { + public final Long endTimeInMillis() { return this.endTimeInMillis; } @@ -253,7 +253,7 @@ public final ShardStatistics shards() { * API name: {@code start_time} */ @Nullable - public final Time startTime() { + public final DateTime startTime() { return this.startTime; } @@ -261,7 +261,7 @@ public final Time startTime() { * API name: {@code start_time_in_millis} */ @Nullable - public final DateTime startTimeInMillis() { + public final Long startTimeInMillis() { return this.startTimeInMillis; } @@ -331,16 +331,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.durationInMillis != null) { generator.writeKey("duration_in_millis"); - this.durationInMillis.serialize(generator, mapper); + generator.write(this.durationInMillis); + } if (this.endTime != null) { generator.writeKey("end_time"); this.endTime.serialize(generator, mapper); - } if (this.endTimeInMillis != null) { generator.writeKey("end_time_in_millis"); - this.endTimeInMillis.serialize(generator, mapper); + generator.write(this.endTimeInMillis); + } if (ApiTypeHelper.isDefined(this.failures)) { generator.writeKey("failures"); @@ -410,11 +411,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.startTime != null) { generator.writeKey("start_time"); this.startTime.serialize(generator, mapper); - } if (this.startTimeInMillis != null) { generator.writeKey("start_time_in_millis"); - this.startTimeInMillis.serialize(generator, mapper); + generator.write(this.startTimeInMillis); + } if (this.state != null) { generator.writeKey("state"); @@ -465,13 +466,13 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Time duration; @Nullable - private DateTime durationInMillis; + private Long durationInMillis; @Nullable - private Time endTime; + private DateTime endTime; @Nullable - private DateTime endTimeInMillis; + private Long endTimeInMillis; @Nullable private List failures; @@ -499,10 +500,10 @@ public static class Builder extends WithJsonObjectBuilderBase implement private ShardStatistics shards; @Nullable - private Time startTime; + private DateTime startTime; @Nullable - private DateTime startTimeInMillis; + private Long startTimeInMillis; @Nullable private String state; @@ -556,7 +557,7 @@ public final Builder duration(Function> fn) { /** * API name: {@code duration_in_millis} */ - public final Builder durationInMillis(@Nullable DateTime value) { + public final Builder durationInMillis(@Nullable Long value) { this.durationInMillis = value; return this; } @@ -564,22 +565,15 @@ public final Builder durationInMillis(@Nullable DateTime value) { /** * API name: {@code end_time} */ - public final Builder endTime(@Nullable Time value) { + public final Builder endTime(@Nullable DateTime value) { this.endTime = value; return this; } - /** - * API name: {@code end_time} - */ - public final Builder endTime(Function> fn) { - return this.endTime(fn.apply(new Time.Builder()).build()); - } - /** * API name: {@code end_time_in_millis} */ - public final Builder endTimeInMillis(@Nullable DateTime value) { + public final Builder endTimeInMillis(@Nullable Long value) { this.endTimeInMillis = value; return this; } @@ -732,22 +726,15 @@ public final Builder shards(Function> fn) { - return this.startTime(fn.apply(new Time.Builder()).build()); - } - /** * API name: {@code start_time_in_millis} */ - public final Builder startTimeInMillis(@Nullable DateTime value) { + public final Builder startTimeInMillis(@Nullable Long value) { this.startTimeInMillis = value; return this; } @@ -844,9 +831,9 @@ protected static void setupSnapshotInfoDeserializer(ObjectDeserializer implement private Long startTimeInMillis; + @Nullable + private Time time; + private Long timeInMillis; private FileCountSnapshotStats total; @@ -168,6 +189,21 @@ public final Builder startTimeInMillis(long value) { return this; } + /** + * API name: {@code time} + */ + public final Builder time(@Nullable Time value) { + this.time = value; + return this; + } + + /** + * API name: {@code time} + */ + public final Builder time(Function> fn) { + return this.time(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code time_in_millis} */ @@ -221,6 +257,7 @@ protected static void setupSnapshotStatsDeserializer(ObjectDeserializer * API name: {@code start_time_in_millis} */ - public final Number startTimeInMillis() { + public final long startTimeInMillis() { return this.startTimeInMillis; } @@ -130,7 +131,7 @@ public final Number startTimeInMillis() { *

* API name: {@code expiration_time_in_millis} */ - public final Number expirationTimeInMillis() { + public final long expirationTimeInMillis() { return this.expirationTimeInMillis; } @@ -166,10 +167,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.isPartial); generator.writeKey("start_time_in_millis"); - generator.write(this.startTimeInMillis.doubleValue()); + generator.write(this.startTimeInMillis); generator.writeKey("expiration_time_in_millis"); - generator.write(this.expirationTimeInMillis.doubleValue()); + generator.write(this.expirationTimeInMillis); if (this.completionStatus != null) { generator.writeKey("completion_status"); @@ -199,9 +200,9 @@ public static class Builder extends WithJsonObjectBuilderBase private Boolean isPartial; - private Number startTimeInMillis; + private Long startTimeInMillis; - private Number expirationTimeInMillis; + private Long expirationTimeInMillis; @Nullable private Number completionStatus; @@ -247,7 +248,7 @@ public final Builder isPartial(boolean value) { *

* API name: {@code start_time_in_millis} */ - public final Builder startTimeInMillis(Number value) { + public final Builder startTimeInMillis(long value) { this.startTimeInMillis = value; return this; } @@ -259,7 +260,7 @@ public final Builder startTimeInMillis(Number value) { *

* API name: {@code expiration_time_in_millis} */ - public final Builder expirationTimeInMillis(Number value) { + public final Builder expirationTimeInMillis(long value) { this.expirationTimeInMillis = value; return this; } @@ -307,8 +308,8 @@ protected static void setupGetAsyncStatusResponseDeserializer( op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); op.add(Builder::isRunning, JsonpDeserializer.booleanDeserializer(), "is_running"); op.add(Builder::isPartial, JsonpDeserializer.booleanDeserializer(), "is_partial"); - op.add(Builder::startTimeInMillis, JsonpDeserializer.numberDeserializer(), "start_time_in_millis"); - op.add(Builder::expirationTimeInMillis, JsonpDeserializer.numberDeserializer(), "expiration_time_in_millis"); + op.add(Builder::startTimeInMillis, JsonpDeserializer.longDeserializer(), "start_time_in_millis"); + op.add(Builder::expirationTimeInMillis, JsonpDeserializer.longDeserializer(), "expiration_time_in_millis"); op.add(Builder::completionStatus, JsonpDeserializer.numberDeserializer(), "completion_status"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/TranslateResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/TranslateResponse.java index 703d48943..c88c8bbf2 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/TranslateResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/sql/TranslateResponse.java @@ -24,6 +24,9 @@ package co.elastic.clients.elasticsearch.sql; import co.elastic.clients.elasticsearch._types.SortOptions; +import co.elastic.clients.elasticsearch._types.aggregations.Aggregation; +import co.elastic.clients.elasticsearch._types.query_dsl.FieldAndFormat; +import co.elastic.clients.elasticsearch._types.query_dsl.Query; import co.elastic.clients.elasticsearch.core.search.SourceConfig; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; @@ -53,11 +56,18 @@ */ @JsonpDeserializable public class TranslateResponse implements JsonpSerializable { - private final long size; + private final Map aggregations; + @Nullable + private final Long size; + + @Nullable private final SourceConfig source; - private final List> fields; + private final List fields; + + @Nullable + private final Query query; private final List sort; @@ -65,10 +75,12 @@ public class TranslateResponse implements JsonpSerializable { private TranslateResponse(Builder builder) { - this.size = ApiTypeHelper.requireNonNull(builder.size, this, "size"); - this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); - this.fields = ApiTypeHelper.unmodifiableRequired(builder.fields, this, "fields"); - this.sort = ApiTypeHelper.unmodifiableRequired(builder.sort, this, "sort"); + this.aggregations = ApiTypeHelper.unmodifiable(builder.aggregations); + this.size = builder.size; + this.source = builder.source; + this.fields = ApiTypeHelper.unmodifiable(builder.fields); + this.query = builder.query; + this.sort = ApiTypeHelper.unmodifiable(builder.sort); } @@ -77,28 +89,45 @@ public static TranslateResponse of(Function aggregations() { + return this.aggregations; + } + + /** + * API name: {@code size} + */ + @Nullable + public final Long size() { return this.size; } /** - * Required - API name: {@code _source} + * API name: {@code _source} */ + @Nullable public final SourceConfig source() { return this.source; } /** - * Required - API name: {@code fields} + * API name: {@code fields} */ - public final List> fields() { + public final List fields() { return this.fields; } /** - * Required - API name: {@code sort} + * API name: {@code query} + */ + @Nullable + public final Query query() { + return this.query; + } + + /** + * API name: {@code sort} */ public final List sort() { return this.sort; @@ -115,29 +144,41 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("size"); - generator.write(this.size); + if (ApiTypeHelper.isDefined(this.aggregations)) { + generator.writeKey("aggregations"); + generator.writeStartObject(); + for (Map.Entry item0 : this.aggregations.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); - generator.writeKey("_source"); - this.source.serialize(generator, mapper); + } + generator.writeEnd(); + + } + if (this.size != null) { + generator.writeKey("size"); + generator.write(this.size); + } + if (this.source != null) { + generator.writeKey("_source"); + this.source.serialize(generator, mapper); + + } if (ApiTypeHelper.isDefined(this.fields)) { generator.writeKey("fields"); generator.writeStartArray(); - for (Map item0 : this.fields) { - generator.writeStartObject(); - if (item0 != null) { - for (Map.Entry item1 : item0.entrySet()) { - generator.writeKey(item1.getKey()); - generator.write(item1.getValue()); - - } - } - generator.writeEnd(); + for (FieldAndFormat item0 : this.fields) { + item0.serialize(generator, mapper); } generator.writeEnd(); + } + if (this.query != null) { + generator.writeKey("query"); + this.query.serialize(generator, mapper); + } if (ApiTypeHelper.isDefined(this.sort)) { generator.writeKey("sort"); @@ -164,59 +205,122 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private Map aggregations; + + @Nullable private Long size; + @Nullable private SourceConfig source; - private List> fields; + @Nullable + private List fields; + + @Nullable + private Query query; + @Nullable private List sort; /** - * Required - API name: {@code size} + * API name: {@code aggregations} + *

+ * Adds all entries of map to aggregations. + */ + public final Builder aggregations(Map map) { + this.aggregations = _mapPutAll(this.aggregations, map); + return this; + } + + /** + * API name: {@code aggregations} + *

+ * Adds an entry to aggregations. + */ + public final Builder aggregations(String key, Aggregation value) { + this.aggregations = _mapPut(this.aggregations, key, value); + return this; + } + + /** + * API name: {@code aggregations} + *

+ * Adds an entry to aggregations using a builder lambda. */ - public final Builder size(long value) { + public final Builder aggregations(String key, Function> fn) { + return aggregations(key, fn.apply(new Aggregation.Builder()).build()); + } + + /** + * API name: {@code size} + */ + public final Builder size(@Nullable Long value) { this.size = value; return this; } /** - * Required - API name: {@code _source} + * API name: {@code _source} */ - public final Builder source(SourceConfig value) { + public final Builder source(@Nullable SourceConfig value) { this.source = value; return this; } /** - * Required - API name: {@code _source} + * API name: {@code _source} */ public final Builder source(Function> fn) { return this.source(fn.apply(new SourceConfig.Builder()).build()); } /** - * Required - API name: {@code fields} + * API name: {@code fields} *

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

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

+ * Adds a value to fields using a builder lambda. + */ + public final Builder fields(Function> fn) { + return fields(fn.apply(new FieldAndFormat.Builder()).build()); + } + + /** + * API name: {@code query} + */ + public final Builder query(@Nullable Query value) { + this.query = value; + return this; + } + + /** + * API name: {@code query} + */ + public final Builder query(Function> fn) { + return this.query(fn.apply(new Query.Builder()).build()); + } + + /** + * API name: {@code sort} *

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

* Adds one or more values to sort. */ @@ -236,7 +340,7 @@ public final Builder sort(SortOptions value, SortOptions... values) { } /** - * Required - API name: {@code sort} + * API name: {@code sort} *

* Adds a value to sort using a builder lambda. */ @@ -272,10 +376,12 @@ public TranslateResponse build() { protected static void setupTranslateResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::aggregations, JsonpDeserializer.stringMapDeserializer(Aggregation._DESERIALIZER), + "aggregations"); op.add(Builder::size, JsonpDeserializer.longDeserializer(), "size"); op.add(Builder::source, SourceConfig._DESERIALIZER, "_source"); - op.add(Builder::fields, JsonpDeserializer.arrayDeserializer( - JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer())), "fields"); + op.add(Builder::fields, JsonpDeserializer.arrayDeserializer(FieldAndFormat._DESERIALIZER), "fields"); + op.add(Builder::query, Query._DESERIALIZER, "query"); op.add(Builder::sort, JsonpDeserializer.arrayDeserializer(SortOptions._DESERIALIZER), "sort"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/ElasticsearchTasksAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/ElasticsearchTasksAsyncClient.java index 8f16b9444..b2f100aa4 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/ElasticsearchTasksAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/ElasticsearchTasksAsyncClient.java @@ -60,7 +60,7 @@ public ElasticsearchTasksAsyncClient withTransportOptions(@Nullable TransportOpt * Cancels a task, if it can be cancelled through an API. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -78,7 +78,7 @@ public CompletableFuture cancel(CancelRequest request) { * a function that initializes a builder to create the * {@link CancelRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -91,7 +91,7 @@ public final CompletableFuture cancel( * Cancels a task, if it can be cancelled through an API. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -106,7 +106,7 @@ public CompletableFuture cancel() { * Returns information about a task. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -124,7 +124,7 @@ public CompletableFuture get(GetTasksRequest request) { * a function that initializes a builder to create the * {@link GetTasksRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -139,7 +139,7 @@ public final CompletableFuture get( * Returns a list of tasks. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -157,7 +157,7 @@ public CompletableFuture list(ListRequest request) { * a function that initializes a builder to create the * {@link ListRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -169,7 +169,7 @@ public final CompletableFuture list(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/ElasticsearchTasksClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/ElasticsearchTasksClient.java index 3f5e8be98..6fba3f559 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/ElasticsearchTasksClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/ElasticsearchTasksClient.java @@ -60,7 +60,7 @@ public ElasticsearchTasksClient withTransportOptions(@Nullable TransportOptions * Cancels a task, if it can be cancelled through an API. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -78,7 +78,7 @@ public CancelResponse cancel(CancelRequest request) throws IOException, Elastics * a function that initializes a builder to create the * {@link CancelRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -91,7 +91,7 @@ public final CancelResponse cancel(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -106,7 +106,7 @@ public CancelResponse cancel() throws IOException, ElasticsearchException { * Returns information about a task. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -124,7 +124,7 @@ public GetTasksResponse get(GetTasksRequest request) throws IOException, Elastic * a function that initializes a builder to create the * {@link GetTasksRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -139,7 +139,7 @@ public final GetTasksResponse get(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -157,7 +157,7 @@ public ListResponse list(ListRequest request) throws IOException, ElasticsearchE * a function that initializes a builder to create the * {@link ListRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ @@ -170,7 +170,7 @@ public final ListResponse list(FunctionDocumentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/8.4/tasks.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/TaskInfo.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/TaskInfo.java index f69186c72..ac22f504e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/TaskInfo.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/tasks/TaskInfo.java @@ -23,6 +23,7 @@ package co.elastic.clients.elasticsearch.tasks; +import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -65,7 +66,7 @@ public class TaskInfo implements JsonpSerializable { private final String node; @Nullable - private final String runningTime; + private final Time runningTime; private final long runningTimeInNanos; @@ -149,7 +150,7 @@ public final String node() { * API name: {@code running_time} */ @Nullable - public final String runningTime() { + public final Time runningTime() { return this.runningTime; } @@ -231,7 +232,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.runningTime != null) { generator.writeKey("running_time"); - generator.write(this.runningTime); + this.runningTime.serialize(generator, mapper); } generator.writeKey("running_time_in_nanos"); @@ -303,7 +304,7 @@ protected abstract static class AbstractBuilder> fn) { + return this.runningTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code running_time_in_nanos} */ @@ -454,7 +462,7 @@ protected static > void setupTaskInfo JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "headers"); op.add(AbstractBuilder::id, JsonpDeserializer.longDeserializer(), "id"); op.add(AbstractBuilder::node, JsonpDeserializer.stringDeserializer(), "node"); - op.add(AbstractBuilder::runningTime, JsonpDeserializer.stringDeserializer(), "running_time"); + op.add(AbstractBuilder::runningTime, Time._DESERIALIZER, "running_time"); op.add(AbstractBuilder::runningTimeInNanos, JsonpDeserializer.longDeserializer(), "running_time_in_nanos"); op.add(AbstractBuilder::startTimeInMillis, JsonpDeserializer.longDeserializer(), "start_time_in_millis"); op.add(AbstractBuilder::status, TaskStatus._DESERIALIZER, "status"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/get_transform/TransformSummary.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/get_transform/TransformSummary.java index cd01bb797..caaa6f4c0 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/get_transform/TransformSummary.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/get_transform/TransformSummary.java @@ -39,10 +39,10 @@ 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.Long; import java.lang.String; import java.util.Map; import java.util.Objects; @@ -81,7 +81,7 @@ public class TransformSummary implements JsonpSerializable { private final Sync sync; @Nullable - private final DateTime createTime; + private final Long createTime; @Nullable private final String version; @@ -191,7 +191,7 @@ public final Sync sync() { * API name: {@code create_time} */ @Nullable - public final DateTime createTime() { + public final Long createTime() { return this.createTime; } @@ -265,7 +265,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.createTime != null) { generator.writeKey("create_time"); - this.createTime.serialize(generator, mapper); + generator.write(this.createTime); + } if (this.version != null) { generator.writeKey("version"); @@ -325,7 +326,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Sync sync; @Nullable - private DateTime createTime; + private Long createTime; @Nullable private String version; @@ -467,7 +468,7 @@ public final Builder sync(Function> fn) { /** * API name: {@code create_time} */ - public final Builder createTime(@Nullable DateTime value) { + public final Builder createTime(@Nullable Long value) { this.createTime = value; return this; } @@ -551,7 +552,7 @@ protected static void setupTransformSummaryDeserializer(ObjectDeserializer implement private DateTime timestamp; @Nullable - private DateTime timestampMillis; + private Long timestampMillis; @Nullable private DateTime timeUpperBound; @Nullable - private DateTime timeUpperBoundMillis; + private Long timeUpperBoundMillis; /** * Required - API name: {@code checkpoint} @@ -233,7 +235,7 @@ public final Builder timestamp(@Nullable DateTime value) { /** * API name: {@code timestamp_millis} */ - public final Builder timestampMillis(@Nullable DateTime value) { + public final Builder timestampMillis(@Nullable Long value) { this.timestampMillis = value; return this; } @@ -249,7 +251,7 @@ public final Builder timeUpperBound(@Nullable DateTime value) { /** * API name: {@code time_upper_bound_millis} */ - public final Builder timeUpperBoundMillis(@Nullable DateTime value) { + public final Builder timeUpperBoundMillis(@Nullable Long value) { this.timeUpperBoundMillis = value; return this; } @@ -285,9 +287,9 @@ protected static void setupCheckpointStatsDeserializer(ObjectDeserializer implements ObjectBuilder { @Nullable - private DateTime deleteTimeInMs; + private Long deleteTimeInMs; private Long documentsIndexed; @@ -359,7 +359,7 @@ public static class Builder extends WithJsonObjectBuilderBase /** * API name: {@code delete_time_in_ms} */ - public final Builder deleteTimeInMs(@Nullable DateTime value) { + public final Builder deleteTimeInMs(@Nullable Long value) { this.deleteTimeInMs = value; return this; } @@ -520,7 +520,7 @@ public TransformIndexerStats build() { protected static void setupTransformIndexerStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::deleteTimeInMs, DateTime._DESERIALIZER, "delete_time_in_ms"); + op.add(Builder::deleteTimeInMs, JsonpDeserializer.longDeserializer(), "delete_time_in_ms"); op.add(Builder::documentsIndexed, JsonpDeserializer.longDeserializer(), "documents_indexed"); op.add(Builder::documentsDeleted, JsonpDeserializer.longDeserializer(), "documents_deleted"); op.add(Builder::documentsProcessed, JsonpDeserializer.longDeserializer(), "documents_processed"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Action.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Action.java index ea77da98d..f66d3bf1b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Action.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Action.java @@ -32,11 +32,11 @@ import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; -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.Integer; +import java.lang.Long; import java.lang.String; import java.util.Objects; import java.util.function.Function; @@ -70,7 +70,7 @@ public class Action implements JsonpSerializable { private final Time throttlePeriod; @Nullable - private final DateTime throttlePeriodInMillis; + private final Long throttlePeriodInMillis; @Nullable private final Transform transform; @@ -170,7 +170,7 @@ public final Time throttlePeriod() { * API name: {@code throttle_period_in_millis} */ @Nullable - public final DateTime throttlePeriodInMillis() { + public final Long throttlePeriodInMillis() { return this.throttlePeriodInMillis; } @@ -272,7 +272,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.throttlePeriodInMillis != null) { generator.writeKey("throttle_period_in_millis"); - this.throttlePeriodInMillis.serialize(generator, mapper); + generator.write(this.throttlePeriodInMillis); + } if (this.transform != null) { generator.writeKey("transform"); @@ -343,7 +344,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Time throttlePeriod; @Nullable - private DateTime throttlePeriodInMillis; + private Long throttlePeriodInMillis; @Nullable private Transform transform; @@ -431,7 +432,7 @@ public final Builder throttlePeriod(Function> /** * API name: {@code throttle_period_in_millis} */ - public final Builder throttlePeriodInMillis(@Nullable DateTime value) { + public final Builder throttlePeriodInMillis(@Nullable Long value) { this.throttlePeriodInMillis = value; return this; } @@ -575,7 +576,7 @@ protected static void setupActionDeserializer(ObjectDeserializer op.add(Builder::maxIterations, JsonpDeserializer.integerDeserializer(), "max_iterations"); op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(Builder::throttlePeriod, Time._DESERIALIZER, "throttle_period"); - op.add(Builder::throttlePeriodInMillis, DateTime._DESERIALIZER, "throttle_period_in_millis"); + op.add(Builder::throttlePeriodInMillis, JsonpDeserializer.longDeserializer(), "throttle_period_in_millis"); op.add(Builder::transform, Transform._DESERIALIZER, "transform"); op.add(Builder::index, IndexAction._DESERIALIZER, "index"); op.add(Builder::logging, LoggingAction._DESERIALIZER, "logging"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/DailySchedule.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/DailySchedule.java index 941af8e1d..9af05773a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/DailySchedule.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/DailySchedule.java @@ -48,7 +48,7 @@ */ @JsonpDeserializable public class DailySchedule implements ScheduleVariant, JsonpSerializable { - private final List at; + private final List at; // --------------------------------------------------------------------------------------------- @@ -73,7 +73,7 @@ public Schedule.Kind _scheduleKind() { /** * Required - API name: {@code at} */ - public final List at() { + public final List at() { return this.at; } @@ -91,7 +91,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (ApiTypeHelper.isDefined(this.at)) { generator.writeKey("at"); generator.writeStartArray(); - for (TimeOfDay item0 : this.at) { + for (ScheduleTimeOfDay item0 : this.at) { item0.serialize(generator, mapper); } @@ -113,14 +113,14 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private List at; + private List at; /** * Required - API name: {@code at} *

* Adds all elements of list to at. */ - public final Builder at(List list) { + public final Builder at(List list) { this.at = _listAddAll(this.at, list); return this; } @@ -130,7 +130,7 @@ public final Builder at(List list) { *

* Adds one or more values to at. */ - public final Builder at(TimeOfDay value, TimeOfDay... values) { + public final Builder at(ScheduleTimeOfDay value, ScheduleTimeOfDay... values) { this.at = _listAdd(this.at, value, values); return this; } @@ -140,8 +140,8 @@ public final Builder at(TimeOfDay value, TimeOfDay... values) { *

* Adds a value to at using a builder lambda. */ - public final Builder at(Function> fn) { - return at(fn.apply(new TimeOfDay.Builder()).build()); + public final Builder at(Function> fn) { + return at(fn.apply(new ScheduleTimeOfDay.Builder()).build()); } @Override @@ -172,7 +172,7 @@ public DailySchedule build() { protected static void setupDailyScheduleDeserializer(ObjectDeserializer op) { - op.add(Builder::at, JsonpDeserializer.arrayDeserializer(TimeOfDay._DESERIALIZER), "at"); + op.add(Builder::at, JsonpDeserializer.arrayDeserializer(ScheduleTimeOfDay._DESERIALIZER), "at"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResult.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResult.java index 47ba79d7a..c4bf2b5cd 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResult.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResult.java @@ -35,7 +35,7 @@ import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; -import java.lang.Integer; +import java.lang.Long; import java.util.List; import java.util.Objects; import java.util.function.Function; @@ -54,7 +54,7 @@ public class ExecutionResult implements JsonpSerializable { private final ExecutionResultCondition condition; - private final int executionDuration; + private final long executionDuration; private final DateTime executionTime; @@ -93,7 +93,7 @@ public final ExecutionResultCondition condition() { /** * Required - API name: {@code execution_duration} */ - public final int executionDuration() { + public final long executionDuration() { return this.executionDuration; } @@ -161,7 +161,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private ExecutionResultCondition condition; - private Integer executionDuration; + private Long executionDuration; private DateTime executionTime; @@ -215,7 +215,7 @@ public final Builder condition( /** * Required - API name: {@code execution_duration} */ - public final Builder executionDuration(int value) { + public final Builder executionDuration(long value) { this.executionDuration = value; return this; } @@ -273,7 +273,7 @@ protected static void setupExecutionResultDeserializer(ObjectDeserializerhh:mm, noon, + * midnight, or an hour/minutes structure. + * + * @see API + * specification + */ +@JsonpDeserializable +public class ScheduleTimeOfDay implements TaggedUnion, JsonpSerializable { + + public enum Kind { + Text, HourMinute + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + private ScheduleTimeOfDay(Kind kind, Object value) { + this._kind = kind; + this._value = value; + } + + private ScheduleTimeOfDay(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static ScheduleTimeOfDay of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code text}? + */ + public boolean isText() { + return _kind == Kind.Text; + } + + /** + * Get the {@code text} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code text} kind. + */ + public String text() { + return TaggedUnionUtils.get(this, Kind.Text); + } + + /** + * Is this variant instance of kind {@code hour_minute}? + */ + public boolean isHourMinute() { + return _kind == Kind.HourMinute; + } + + /** + * Get the {@code hour_minute} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code hour_minute} kind. + */ + public HourAndMinute hourMinute() { + return TaggedUnionUtils.get(this, Kind.HourMinute); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } else { + switch (_kind) { + case Text : + generator.write(((String) this._value)); + + break; + } + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + public ObjectBuilder text(String v) { + this._kind = Kind.Text; + this._value = v; + return this; + } + + public ObjectBuilder hourMinute(HourAndMinute v) { + this._kind = Kind.HourMinute; + this._value = v; + return this; + } + + public ObjectBuilder hourMinute( + Function> fn) { + return this.hourMinute(fn.apply(new HourAndMinute.Builder()).build()); + } + + public ScheduleTimeOfDay build() { + _checkSingleUse(); + return new ScheduleTimeOfDay(this); + } + + } + + private static JsonpDeserializer buildScheduleTimeOfDayDeserializer() { + return new UnionDeserializer.Builder(ScheduleTimeOfDay::new, false) + .addMember(Kind.Text, JsonpDeserializer.stringDeserializer()) + .addMember(Kind.HourMinute, HourAndMinute._DESERIALIZER).build(); + } + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer + .lazy(ScheduleTimeOfDay::buildScheduleTimeOfDayDeserializer); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ScheduleTimeOfDayBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ScheduleTimeOfDayBuilders.java new file mode 100644 index 000000000..ca2b7a0c9 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ScheduleTimeOfDayBuilders.java @@ -0,0 +1,48 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.watcher; + +import co.elastic.clients.util.ObjectBuilder; +import java.util.function.Function; + +/** + * Builders for {@link ScheduleTimeOfDay} variants. + *

+ * Variants text are not available here as they don't have a + * dedicated class. Use {@link ScheduleTimeOfDay}'s builder for these. + * + */ +public class ScheduleTimeOfDayBuilders { + private ScheduleTimeOfDayBuilders() { + } + + /** + * Creates a builder for the {@link HourAndMinute hour_minute} + * {@code ScheduleTimeOfDay} variant. + */ + public static HourAndMinute.Builder hourMinute() { + return new HourAndMinute.Builder(); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/SlackAttachment.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/SlackAttachment.java index bfabfa5bf..9e8a7ac8e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/SlackAttachment.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/SlackAttachment.java @@ -31,10 +31,10 @@ 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.Long; import java.lang.String; import java.util.List; import java.util.Objects; @@ -90,7 +90,7 @@ public class SlackAttachment implements JsonpSerializable { private final String titleLink; @Nullable - private final DateTime ts; + private final Long ts; // --------------------------------------------------------------------------------------------- @@ -231,7 +231,7 @@ public final String titleLink() { * API name: {@code ts} */ @Nullable - public final DateTime ts() { + public final Long ts() { return this.ts; } @@ -319,7 +319,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } if (this.ts != null) { generator.writeKey("ts"); - this.ts.serialize(generator, mapper); + generator.write(this.ts); + } } @@ -377,7 +378,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private String titleLink; @Nullable - private DateTime ts; + private Long ts; /** * API name: {@code author_icon} @@ -515,7 +516,7 @@ public final Builder titleLink(@Nullable String value) { /** * API name: {@code ts} */ - public final Builder ts(@Nullable DateTime value) { + public final Builder ts(@Nullable Long value) { this.ts = value; return this; } @@ -562,7 +563,7 @@ protected static void setupSlackAttachmentDeserializer(ObjectDeserializer implement private WatchStatus status; @Nullable - private String throttlePeriod; + private Time throttlePeriod; + + @Nullable + private Long throttlePeriodInMillis; @Nullable private Transform transform; private Trigger trigger; - @Nullable - private Long throttlePeriodInMillis; - /** * Required - API name: {@code actions} *

@@ -358,11 +358,26 @@ public final Builder status(Function> fn) { + return this.throttlePeriod(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code throttle_period_in_millis} + */ + public final Builder throttlePeriodInMillis(@Nullable Long value) { + this.throttlePeriodInMillis = value; + return this; + } + /** * API name: {@code transform} */ @@ -393,14 +408,6 @@ public final Builder trigger(Function> f return this.trigger(fn.apply(new Trigger.Builder()).build()); } - /** - * API name: {@code throttle_period_in_millis} - */ - public final Builder throttlePeriodInMillis(@Nullable Long value) { - this.throttlePeriodInMillis = value; - return this; - } - @Override protected Builder self() { return this; @@ -434,10 +441,10 @@ protected static void setupWatchDeserializer(ObjectDeserializer o op.add(Builder::input, Input._DESERIALIZER, "input"); op.add(Builder::metadata, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "metadata"); op.add(Builder::status, WatchStatus._DESERIALIZER, "status"); - op.add(Builder::throttlePeriod, JsonpDeserializer.stringDeserializer(), "throttle_period"); + op.add(Builder::throttlePeriod, Time._DESERIALIZER, "throttle_period"); + op.add(Builder::throttlePeriodInMillis, JsonpDeserializer.longDeserializer(), "throttle_period_in_millis"); op.add(Builder::transform, Transform._DESERIALIZER, "transform"); op.add(Builder::trigger, Trigger._DESERIALIZER, "trigger"); - op.add(Builder::throttlePeriodInMillis, JsonpDeserializer.longDeserializer(), "throttle_period_in_millis"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/info/MinimalLicenseInformation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/info/MinimalLicenseInformation.java index 0d34df8b1..0be1e815c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/info/MinimalLicenseInformation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/info/MinimalLicenseInformation.java @@ -33,10 +33,10 @@ 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.Long; import java.lang.String; import java.util.Objects; import java.util.function.Function; @@ -52,7 +52,7 @@ */ @JsonpDeserializable public class MinimalLicenseInformation implements JsonpSerializable { - private final DateTime expiryDateInMillis; + private final long expiryDateInMillis; private final LicenseType mode; @@ -81,7 +81,7 @@ public static MinimalLicenseInformation of(Function implements ObjectBuilder { - private DateTime expiryDateInMillis; + private Long expiryDateInMillis; private LicenseType mode; @@ -164,7 +165,7 @@ public static class Builder extends WithJsonObjectBuilderBase /** * Required - API name: {@code expiry_date_in_millis} */ - public final Builder expiryDateInMillis(DateTime value) { + public final Builder expiryDateInMillis(long value) { this.expiryDateInMillis = value; return this; } @@ -230,7 +231,7 @@ public MinimalLicenseInformation build() { protected static void setupMinimalLicenseInformationDeserializer( ObjectDeserializer op) { - op.add(Builder::expiryDateInMillis, DateTime._DESERIALIZER, "expiry_date_in_millis"); + op.add(Builder::expiryDateInMillis, JsonpDeserializer.longDeserializer(), "expiry_date_in_millis"); op.add(Builder::mode, LicenseType._DESERIALIZER, "mode"); op.add(Builder::status, LicenseStatus._DESERIALIZER, "status"); op.add(Builder::type, LicenseType._DESERIALIZER, "type"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/WatcherActionTotals.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/WatcherActionTotals.java index 5ad6c1b5d..a6b83d1d0 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/WatcherActionTotals.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/WatcherActionTotals.java @@ -23,6 +23,7 @@ package co.elastic.clients.elasticsearch.xpack.usage; +import co.elastic.clients.elasticsearch._types.Time; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -37,6 +38,7 @@ import java.lang.Long; import java.util.Objects; import java.util.function.Function; +import javax.annotation.Nullable; // typedef: xpack.usage.WatcherActionTotals @@ -48,7 +50,7 @@ */ @JsonpDeserializable public class WatcherActionTotals implements JsonpSerializable { - private final long total; + private final Time total; private final long totalTimeInMs; @@ -68,7 +70,7 @@ public static WatcherActionTotals of(Function implements ObjectBuilder { - private Long total; + private Time total; private Long totalTimeInMs; /** * Required - API name: {@code total} */ - public final Builder total(long value) { + public final Builder total(Time value) { this.total = value; return this; } + /** + * Required - API name: {@code total} + */ + public final Builder total(Function> fn) { + return this.total(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code total_time_in_ms} */ @@ -160,7 +169,7 @@ public WatcherActionTotals build() { protected static void setupWatcherActionTotalsDeserializer(ObjectDeserializer op) { - op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); + op.add(Builder::total, Time._DESERIALIZER, "total"); op.add(Builder::totalTimeInMs, JsonpDeserializer.longDeserializer(), "total_time_in_ms"); } diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/ClassStructureTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/ClassStructureTest.java index 861af5bd4..ad69f8756 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/model/ClassStructureTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/model/ClassStructureTest.java @@ -26,7 +26,6 @@ import co.elastic.clients.elasticsearch._types.aggregations.Buckets; import co.elastic.clients.elasticsearch._types.aggregations.CardinalityAggregate; import co.elastic.clients.elasticsearch._types.aggregations.DateRangeAggregate; -import co.elastic.clients.elasticsearch._types.aggregations.HistogramAggregation; import co.elastic.clients.elasticsearch._types.aggregations.RangeBucket; import co.elastic.clients.elasticsearch._types.aggregations.TermsAggregation; import co.elastic.clients.elasticsearch._types.aggregations.ValueCountAggregation; diff --git a/java-client/src/test/java/co/elastic/clients/elasticsearch/spec_issues/SpecIssuesTest.java b/java-client/src/test/java/co/elastic/clients/elasticsearch/spec_issues/SpecIssuesTest.java index 6e7973fd0..ab9b94c35 100644 --- a/java-client/src/test/java/co/elastic/clients/elasticsearch/spec_issues/SpecIssuesTest.java +++ b/java-client/src/test/java/co/elastic/clients/elasticsearch/spec_issues/SpecIssuesTest.java @@ -34,6 +34,7 @@ import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializer; import jakarta.json.stream.JsonParser; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import java.io.InputStream; @@ -46,6 +47,7 @@ */ public class SpecIssuesTest extends ModelTestCase { + @Disabled("Not fixed yet") @Test public void i0201_restoreResponse() throws Exception { RestoreResponse restoreResponse = fromJson("{\"acknowledged\":true}", RestoreResponse.class);