diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/WriteResponseBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/WriteResponseBase.java index c179f9dc1..428d5c38a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/WriteResponseBase.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/WriteResponseBase.java @@ -65,7 +65,8 @@ public abstract class WriteResponseBase implements JsonpSerializable { private final String index; - private final long primaryTerm; + @Nullable + private final Long primaryTerm; private final Result result; @@ -84,7 +85,7 @@ protected WriteResponseBase(AbstractBuilder builder) { this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - this.primaryTerm = ApiTypeHelper.requireNonNull(builder.primaryTerm, this, "primaryTerm"); + this.primaryTerm = builder.primaryTerm; this.result = ApiTypeHelper.requireNonNull(builder.result, this, "result"); this.seqNo = ApiTypeHelper.requireNonNull(builder.seqNo, this, "seqNo"); this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); @@ -108,9 +109,10 @@ public final String index() { } /** - * Required - API name: {@code _primary_term} + * API name: {@code _primary_term} */ - public final long primaryTerm() { + @Nullable + public final Long primaryTerm() { return this.primaryTerm; } @@ -167,9 +169,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("_index"); generator.write(this.index); - generator.writeKey("_primary_term"); - generator.write(this.primaryTerm); + if (this.primaryTerm != null) { + generator.writeKey("_primary_term"); + generator.write(this.primaryTerm); + } generator.writeKey("result"); this.result.serialize(generator, mapper); generator.writeKey("_seq_no"); @@ -201,6 +205,7 @@ public abstract static class AbstractBuilder */ @JsonpDeserializable -public class AdjacencyMatrixAggregation extends BucketAggregationBase implements AggregationVariant { +public class AdjacencyMatrixAggregation extends BucketAggregationBase implements AggregationVariant, JsonpSerializable { private final Map filters; // --------------------------------------------------------------------------------------------- private AdjacencyMatrixAggregation(Builder builder) { - super(builder); this.filters = ApiTypeHelper.unmodifiable(builder.filters); @@ -91,9 +92,17 @@ public final Map filters() { return this.filters; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (ApiTypeHelper.isDefined(this.filters)) { generator.writeKey("filters"); generator.writeStartObject(); @@ -108,6 +117,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -183,7 +197,7 @@ public AdjacencyMatrixAggregation build() { protected static void setupAdjacencyMatrixAggregationDeserializer( ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::filters, JsonpDeserializer.stringMapDeserializer(Query._DESERIALIZER), "filters"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationBase.java index 5320a33e0..ec723205c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationBase.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AggregationBase.java @@ -19,22 +19,14 @@ package co.elastic.clients.elasticsearch._types.aggregations; -import co.elastic.clients.json.JsonData; 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.Map; import java.util.Objects; -import javax.annotation.Nullable; //---------------------------------------------------------------- // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. @@ -60,119 +52,15 @@ * specification */ -public abstract class AggregationBase implements JsonpSerializable { - private final Map meta; - - @Nullable - private final String name; - - // --------------------------------------------------------------------------------------------- - - protected AggregationBase(AbstractBuilder builder) { - - this.meta = ApiTypeHelper.unmodifiable(builder.meta); - this.name = builder.name; - - } - - /** - * API name: {@code meta} - */ - public final Map meta() { - return this.meta; - } - - /** - * API name: {@code name} - */ - @Nullable - public final String name() { - return this.name; - } - - /** - * 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.meta)) { - generator.writeKey("meta"); - generator.writeStartObject(); - for (Map.Entry item0 : this.meta.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.name != null) { - generator.writeKey("name"); - generator.write(this.name); - - } - - } - - @Override - public String toString() { - return JsonpUtils.toString(this); +public abstract class AggregationBase { + public AggregationBase() { } public abstract static class AbstractBuilder> extends WithJsonObjectBuilderBase { - @Nullable - private Map meta; - - @Nullable - private String name; - - /** - * API name: {@code meta} - *

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

- * Adds an entry to meta. - */ - public final BuilderT meta(String key, JsonData value) { - this.meta = _mapPut(this.meta, key, value); - return self(); - } - - /** - * API name: {@code name} - */ - public final BuilderT name(@Nullable String value) { - this.name = value; - return self(); - } - protected abstract BuilderT self(); } - // --------------------------------------------------------------------------------------------- - protected static > void setupAggregationBaseDeserializer( - ObjectDeserializer op) { - - op.add(AbstractBuilder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "meta"); - op.add(AbstractBuilder::name, JsonpDeserializer.stringDeserializer(), "name"); - - } - } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AutoDateHistogramAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AutoDateHistogramAggregation.java index 0c35472c1..dee2d20f1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AutoDateHistogramAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/AutoDateHistogramAggregation.java @@ -24,6 +24,8 @@ 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; @@ -61,7 +63,10 @@ * specification */ @JsonpDeserializable -public class AutoDateHistogramAggregation extends BucketAggregationBase implements AggregationVariant { +public class AutoDateHistogramAggregation extends BucketAggregationBase + implements + AggregationVariant, + JsonpSerializable { @Nullable private final Integer buckets; @@ -91,7 +96,6 @@ public class AutoDateHistogramAggregation extends BucketAggregationBase implemen // --------------------------------------------------------------------------------------------- private AutoDateHistogramAggregation(Builder builder) { - super(builder); this.buckets = builder.buckets; this.field = builder.field; @@ -207,9 +211,17 @@ public final String timeZone() { return this.timeZone; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.buckets != null) { generator.writeKey("buckets"); generator.write(this.buckets); @@ -262,6 +274,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -436,7 +453,7 @@ public AutoDateHistogramAggregation build() { protected static void setupAutoDateHistogramAggregationDeserializer( ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::buckets, JsonpDeserializer.integerDeserializer(), "buckets"); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/BucketAggregationBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/BucketAggregationBase.java index 46043eda6..e53d8089c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/BucketAggregationBase.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/BucketAggregationBase.java @@ -55,22 +55,13 @@ */ public abstract class BucketAggregationBase extends AggregationBase { - // --------------------------------------------------------------------------------------------- - - protected BucketAggregationBase(AbstractBuilder builder) { - super(builder); - + public BucketAggregationBase() { } public abstract static class AbstractBuilder> extends AggregationBase.AbstractBuilder { - } - - // --------------------------------------------------------------------------------------------- - protected static > void setupBucketAggregationBaseDeserializer( - ObjectDeserializer op) { - AggregationBase.setupAggregationBaseDeserializer(op); + protected abstract BuilderT self(); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/BucketPathAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/BucketPathAggregation.java index db624a98d..2b9ef26c9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/BucketPathAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/BucketPathAggregation.java @@ -22,6 +22,8 @@ import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ObjectBuilder; @@ -55,14 +57,13 @@ * specification */ -public abstract class BucketPathAggregation extends AggregationBase { +public abstract class BucketPathAggregation extends AggregationBase implements JsonpSerializable { @Nullable private final BucketsPath bucketsPath; // --------------------------------------------------------------------------------------------- protected BucketPathAggregation(AbstractBuilder builder) { - super(builder); this.bucketsPath = builder.bucketsPath; @@ -78,9 +79,17 @@ public final BucketsPath bucketsPath() { return this.bucketsPath; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.bucketsPath != null) { generator.writeKey("buckets_path"); this.bucketsPath.serialize(generator, mapper); @@ -89,6 +98,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + public abstract static class AbstractBuilder> extends AggregationBase.AbstractBuilder { @@ -114,12 +128,14 @@ public final BuilderT bucketsPath(Function> void setupBucketPathAggregationDeserializer( ObjectDeserializer op) { - AggregationBase.setupAggregationBaseDeserializer(op); + op.add(AbstractBuilder::bucketsPath, BucketsPath._DESERIALIZER, "buckets_path"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/BucketSortAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/BucketSortAggregation.java index 7e39b692a..b8d1d7bff 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/BucketSortAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/BucketSortAggregation.java @@ -23,6 +23,8 @@ 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; @@ -58,7 +60,7 @@ * specification */ @JsonpDeserializable -public class BucketSortAggregation extends AggregationBase implements AggregationVariant { +public class BucketSortAggregation extends AggregationBase implements AggregationVariant, JsonpSerializable { @Nullable private final Integer from; @@ -73,7 +75,6 @@ public class BucketSortAggregation extends AggregationBase implements Aggregatio // --------------------------------------------------------------------------------------------- private BucketSortAggregation(Builder builder) { - super(builder); this.from = builder.from; this.gapPolicy = builder.gapPolicy; @@ -134,9 +135,17 @@ public final List sort() { return this.sort; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.from != null) { generator.writeKey("from"); generator.write(this.from); @@ -164,6 +173,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -278,7 +292,7 @@ public BucketSortAggregation build() { .lazy(Builder::new, BucketSortAggregation::setupBucketSortAggregationDeserializer); protected static void setupBucketSortAggregationDeserializer(ObjectDeserializer op) { - AggregationBase.setupAggregationBaseDeserializer(op); + op.add(Builder::from, JsonpDeserializer.integerDeserializer(), "from"); op.add(Builder::gapPolicy, GapPolicy._DESERIALIZER, "gap_policy"); op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/CategorizeTextAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/CategorizeTextAggregation.java index 4ed93073b..00dc3ffb4 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/CategorizeTextAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/CategorizeTextAggregation.java @@ -22,6 +22,8 @@ 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; @@ -63,7 +65,7 @@ * specification */ @JsonpDeserializable -public class CategorizeTextAggregation extends AggregationBase implements AggregationVariant { +public class CategorizeTextAggregation extends AggregationBase implements AggregationVariant, JsonpSerializable { private final String field; @Nullable @@ -95,7 +97,6 @@ public class CategorizeTextAggregation extends AggregationBase implements Aggreg // --------------------------------------------------------------------------------------------- private CategorizeTextAggregation(Builder builder) { - super(builder); this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.maxUniqueTokens = builder.maxUniqueTokens; @@ -245,9 +246,17 @@ public final Integer shardMinDocCount() { return this.shardMinDocCount; } + /** + * 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) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); @@ -304,6 +313,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -534,7 +548,7 @@ public CategorizeTextAggregation build() { protected static void setupCategorizeTextAggregationDeserializer( ObjectDeserializer op) { - AggregationBase.setupAggregationBaseDeserializer(op); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::maxUniqueTokens, JsonpDeserializer.integerDeserializer(), "max_unique_tokens"); op.add(Builder::maxMatchedTokens, JsonpDeserializer.integerDeserializer(), "max_matched_tokens"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/ChildrenAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/ChildrenAggregation.java index 9c7fd0152..c15142d05 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/ChildrenAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/ChildrenAggregation.java @@ -22,6 +22,8 @@ import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ObjectBuilder; @@ -55,14 +57,13 @@ * specification */ @JsonpDeserializable -public class ChildrenAggregation extends BucketAggregationBase implements AggregationVariant { +public class ChildrenAggregation extends BucketAggregationBase implements AggregationVariant, JsonpSerializable { @Nullable private final String type; // --------------------------------------------------------------------------------------------- private ChildrenAggregation(Builder builder) { - super(builder); this.type = builder.type; @@ -90,9 +91,17 @@ public final String type() { return this.type; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.type != null) { generator.writeKey("type"); generator.write(this.type); @@ -101,6 +110,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -150,7 +164,7 @@ public ChildrenAggregation build() { .lazy(Builder::new, ChildrenAggregation::setupChildrenAggregationDeserializer); protected static void setupChildrenAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/CompositeAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/CompositeAggregation.java index bef6c6964..e634962b0 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/CompositeAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/CompositeAggregation.java @@ -25,6 +25,8 @@ 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; @@ -65,7 +67,8 @@ public class CompositeAggregation extends BucketAggregationBase implements AggregationVariant, - ApiKeyAggregationVariant { + ApiKeyAggregationVariant, + JsonpSerializable { private final Map after; @Nullable @@ -76,7 +79,6 @@ public class CompositeAggregation extends BucketAggregationBase // --------------------------------------------------------------------------------------------- private CompositeAggregation(Builder builder) { - super(builder); this.after = ApiTypeHelper.unmodifiable(builder.after); this.size = builder.size; @@ -134,9 +136,17 @@ public final List> sources() { return this.sources; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (ApiTypeHelper.isDefined(this.after)) { generator.writeKey("after"); generator.writeStartObject(); @@ -174,6 +184,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -294,7 +309,7 @@ public CompositeAggregation build() { .lazy(Builder::new, CompositeAggregation::setupCompositeAggregationDeserializer); protected static void setupCompositeAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::after, JsonpDeserializer.stringMapDeserializer(FieldValue._DESERIALIZER), "after"); op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); op.add(Builder::sources, JsonpDeserializer.arrayDeserializer( 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 dcc79c260..5a3ad063b 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 @@ -28,6 +28,8 @@ 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; @@ -68,7 +70,11 @@ * specification */ @JsonpDeserializable -public class DateHistogramAggregation extends BucketAggregationBase implements AggregationVariant, PivotGroupByVariant { +public class DateHistogramAggregation extends BucketAggregationBase + implements + AggregationVariant, + PivotGroupByVariant, + JsonpSerializable { @Nullable private final CalendarInterval calendarInterval; @@ -115,7 +121,6 @@ public class DateHistogramAggregation extends BucketAggregationBase implements A // --------------------------------------------------------------------------------------------- private DateHistogramAggregation(Builder builder) { - super(builder); this.calendarInterval = builder.calendarInterval; this.extendedBounds = builder.extendedBounds; @@ -311,9 +316,17 @@ public final Boolean keyed() { return this.keyed; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.calendarInterval != null) { generator.writeKey("calendar_interval"); this.calendarInterval.serialize(generator, mapper); @@ -404,6 +417,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -728,7 +746,7 @@ public DateHistogramAggregation build() { protected static void setupDateHistogramAggregationDeserializer( ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::calendarInterval, CalendarInterval._DESERIALIZER, "calendar_interval"); op.add(Builder::extendedBounds, ExtendedBounds.createExtendedBoundsDeserializer(FieldDateMath._DESERIALIZER), "extended_bounds"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DateRangeAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DateRangeAggregation.java index b0373ce0f..479b649ff 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DateRangeAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DateRangeAggregation.java @@ -25,6 +25,8 @@ 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; @@ -64,7 +66,8 @@ public class DateRangeAggregation extends BucketAggregationBase implements AggregationVariant, - ApiKeyAggregationVariant { + ApiKeyAggregationVariant, + JsonpSerializable { @Nullable private final String field; @@ -85,7 +88,6 @@ public class DateRangeAggregation extends BucketAggregationBase // --------------------------------------------------------------------------------------------- private DateRangeAggregation(Builder builder) { - super(builder); this.field = builder.field; this.format = builder.format; @@ -178,9 +180,17 @@ public final Boolean keyed() { return this.keyed; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.field != null) { generator.writeKey("field"); generator.write(this.field); @@ -219,6 +229,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -415,7 +430,7 @@ public DateRangeAggregation build() { .lazy(Builder::new, DateRangeAggregation::setupDateRangeAggregationDeserializer); protected static void setupDateRangeAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); op.add(Builder::missing, FieldValue._DESERIALIZER, "missing"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DiversifiedSamplerAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DiversifiedSamplerAggregation.java index 21d3957e5..bb25276cd 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DiversifiedSamplerAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/DiversifiedSamplerAggregation.java @@ -23,6 +23,8 @@ import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ObjectBuilder; @@ -57,7 +59,10 @@ * specification */ @JsonpDeserializable -public class DiversifiedSamplerAggregation extends BucketAggregationBase implements AggregationVariant { +public class DiversifiedSamplerAggregation extends BucketAggregationBase + implements + AggregationVariant, + JsonpSerializable { @Nullable private final SamplerAggregationExecutionHint executionHint; @@ -76,7 +81,6 @@ public class DiversifiedSamplerAggregation extends BucketAggregationBase impleme // --------------------------------------------------------------------------------------------- private DiversifiedSamplerAggregation(Builder builder) { - super(builder); this.executionHint = builder.executionHint; this.maxDocsPerValue = builder.maxDocsPerValue; @@ -147,9 +151,17 @@ public final String field() { return this.field; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.executionHint != null) { generator.writeKey("execution_hint"); this.executionHint.serialize(generator, mapper); @@ -177,6 +189,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -285,7 +302,7 @@ public DiversifiedSamplerAggregation build() { protected static void setupDiversifiedSamplerAggregationDeserializer( ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::executionHint, SamplerAggregationExecutionHint._DESERIALIZER, "execution_hint"); op.add(Builder::maxDocsPerValue, JsonpDeserializer.integerDeserializer(), "max_docs_per_value"); op.add(Builder::script, Script._DESERIALIZER, "script"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/ExtendedBounds.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/ExtendedBounds.java index d008aacd8..8f29a64d9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/ExtendedBounds.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/ExtendedBounds.java @@ -28,7 +28,6 @@ import co.elastic.clients.json.NamedDeserializer; 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; @@ -62,8 +61,10 @@ */ @JsonpDeserializable public class ExtendedBounds implements JsonpSerializable { + @Nullable private final T max; + @Nullable private final T min; @Nullable @@ -73,8 +74,8 @@ public class ExtendedBounds implements JsonpSerializable { private ExtendedBounds(Builder 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; this.tSerializer = builder.tSerializer; } @@ -84,19 +85,21 @@ public static ExtendedBounds of(Function, ObjectBuilder * API name: {@code max} */ + @Nullable public final T max() { return this.max; } /** - * Required - Minimum value for the bound. + * Minimum value for the bound. *

* API name: {@code min} */ + @Nullable public final T min() { return this.min; } @@ -112,11 +115,16 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("max"); - JsonpUtils.serialize(this.max, generator, tSerializer, mapper); + if (this.max != null) { + generator.writeKey("max"); + JsonpUtils.serialize(this.max, generator, tSerializer, mapper); - generator.writeKey("min"); - JsonpUtils.serialize(this.min, generator, tSerializer, mapper); + } + if (this.min != null) { + generator.writeKey("min"); + JsonpUtils.serialize(this.min, generator, tSerializer, mapper); + + } } @@ -134,29 +142,31 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase> implements ObjectBuilder> { + @Nullable private T max; + @Nullable private T min; @Nullable private JsonpSerializer tSerializer; /** - * Required - Maximum value for the bound. + * Maximum value for the bound. *

* API name: {@code max} */ - public final Builder max(T value) { + public final Builder max(@Nullable T value) { this.max = value; return this; } /** - * Required - Minimum value for the bound. + * Minimum value for the bound. *

* API name: {@code min} */ - public final Builder min(T value) { + public final Builder min(@Nullable T value) { this.min = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/FiltersAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/FiltersAggregation.java index 72b0cd4a3..4dca403e0 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/FiltersAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/FiltersAggregation.java @@ -23,6 +23,8 @@ import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ObjectBuilder; @@ -57,7 +59,7 @@ * specification */ @JsonpDeserializable -public class FiltersAggregation extends BucketAggregationBase implements AggregationVariant { +public class FiltersAggregation extends BucketAggregationBase implements AggregationVariant, JsonpSerializable { @Nullable private final Buckets filters; @@ -73,7 +75,6 @@ public class FiltersAggregation extends BucketAggregationBase implements Aggrega // --------------------------------------------------------------------------------------------- private FiltersAggregation(Builder builder) { - super(builder); this.filters = builder.filters; this.otherBucket = builder.otherBucket; @@ -136,9 +137,17 @@ public final Boolean keyed() { return this.keyed; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.filters != null) { generator.writeKey("filters"); this.filters.serialize(generator, mapper); @@ -162,6 +171,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -261,7 +275,7 @@ public FiltersAggregation build() { .lazy(Builder::new, FiltersAggregation::setupFiltersAggregationDeserializer); protected static void setupFiltersAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::filters, Buckets.createBucketsDeserializer(Query._DESERIALIZER), "filters"); op.add(Builder::otherBucket, JsonpDeserializer.booleanDeserializer(), "other_bucket"); op.add(Builder::otherBucketKey, JsonpDeserializer.stringDeserializer(), "other_bucket_key"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GeoDistanceAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GeoDistanceAggregation.java index 40c397b5d..e736db73a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GeoDistanceAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GeoDistanceAggregation.java @@ -25,6 +25,8 @@ 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; @@ -60,7 +62,7 @@ * specification */ @JsonpDeserializable -public class GeoDistanceAggregation extends BucketAggregationBase implements AggregationVariant { +public class GeoDistanceAggregation extends BucketAggregationBase implements AggregationVariant, JsonpSerializable { @Nullable private final GeoDistanceType distanceType; @@ -78,7 +80,6 @@ public class GeoDistanceAggregation extends BucketAggregationBase implements Agg // --------------------------------------------------------------------------------------------- private GeoDistanceAggregation(Builder builder) { - super(builder); this.distanceType = builder.distanceType; this.field = builder.field; @@ -149,9 +150,17 @@ public final DistanceUnit unit() { return this.unit; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.distanceType != null) { generator.writeKey("distance_type"); this.distanceType.serialize(generator, mapper); @@ -183,6 +192,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -319,7 +333,7 @@ public GeoDistanceAggregation build() { protected static void setupGeoDistanceAggregationDeserializer( ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::distanceType, GeoDistanceType._DESERIALIZER, "distance_type"); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::origin, GeoLocation._DESERIALIZER, "origin"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GeoHashGridAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GeoHashGridAggregation.java index 6dddd8612..41a1b6d32 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GeoHashGridAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GeoHashGridAggregation.java @@ -24,6 +24,8 @@ import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ObjectBuilder; @@ -58,7 +60,7 @@ * specification */ @JsonpDeserializable -public class GeoHashGridAggregation extends BucketAggregationBase implements AggregationVariant { +public class GeoHashGridAggregation extends BucketAggregationBase implements AggregationVariant, JsonpSerializable { @Nullable private final GeoBounds bounds; @@ -77,7 +79,6 @@ public class GeoHashGridAggregation extends BucketAggregationBase implements Agg // --------------------------------------------------------------------------------------------- private GeoHashGridAggregation(Builder builder) { - super(builder); this.bounds = builder.bounds; this.field = builder.field; @@ -154,9 +155,17 @@ public final Integer size() { return this.size; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.bounds != null) { generator.writeKey("bounds"); this.bounds.serialize(generator, mapper); @@ -185,6 +194,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -311,7 +325,7 @@ public GeoHashGridAggregation build() { protected static void setupGeoHashGridAggregationDeserializer( ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::bounds, GeoBounds._DESERIALIZER, "bounds"); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::precision, GeoHashPrecision._DESERIALIZER, "precision"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GeoTileGridAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GeoTileGridAggregation.java index 946e79d2c..7928c6445 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GeoTileGridAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GeoTileGridAggregation.java @@ -25,6 +25,8 @@ import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ObjectBuilder; @@ -60,7 +62,11 @@ * specification */ @JsonpDeserializable -public class GeoTileGridAggregation extends BucketAggregationBase implements AggregationVariant, PivotGroupByVariant { +public class GeoTileGridAggregation extends BucketAggregationBase + implements + AggregationVariant, + PivotGroupByVariant, + JsonpSerializable { @Nullable private final String field; @@ -79,7 +85,6 @@ public class GeoTileGridAggregation extends BucketAggregationBase implements Agg // --------------------------------------------------------------------------------------------- private GeoTileGridAggregation(Builder builder) { - super(builder); this.field = builder.field; this.precision = builder.precision; @@ -164,9 +169,17 @@ public final GeoBounds bounds() { return this.bounds; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.field != null) { generator.writeKey("field"); generator.write(this.field); @@ -195,6 +208,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -311,7 +329,7 @@ public GeoTileGridAggregation build() { protected static void setupGeoTileGridAggregationDeserializer( ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::precision, JsonpDeserializer.numberDeserializer(), "precision"); op.add(Builder::shardSize, JsonpDeserializer.integerDeserializer(), "shard_size"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GeohexGridAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GeohexGridAggregation.java index d974afaee..6b03f013a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GeohexGridAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GeohexGridAggregation.java @@ -23,6 +23,8 @@ 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; @@ -58,7 +60,7 @@ * specification */ @JsonpDeserializable -public class GeohexGridAggregation extends BucketAggregationBase implements AggregationVariant { +public class GeohexGridAggregation extends BucketAggregationBase implements AggregationVariant, JsonpSerializable { private final String field; @Nullable @@ -76,7 +78,6 @@ public class GeohexGridAggregation extends BucketAggregationBase implements Aggr // --------------------------------------------------------------------------------------------- private GeohexGridAggregation(Builder builder) { - super(builder); this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.precision = builder.precision; @@ -150,9 +151,17 @@ public final Integer shardSize() { return this.shardSize; } + /** + * 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) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); @@ -179,6 +188,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -291,7 +305,7 @@ public GeohexGridAggregation build() { .lazy(Builder::new, GeohexGridAggregation::setupGeohexGridAggregationDeserializer); protected static void setupGeohexGridAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::precision, JsonpDeserializer.integerDeserializer(), "precision"); op.add(Builder::bounds, GeoBounds._DESERIALIZER, "bounds"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GlobalAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GlobalAggregation.java index 3a86a8879..386e392d9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GlobalAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GlobalAggregation.java @@ -21,12 +21,10 @@ 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.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; -import java.util.Objects; -import java.util.function.Function; //---------------------------------------------------------------- // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. @@ -43,8 +41,6 @@ // //---------------------------------------------------------------- -// typedef: _types.aggregations.GlobalAggregation - /** * * @see */ @JsonpDeserializable -public class GlobalAggregation extends BucketAggregationBase implements AggregationVariant { - // --------------------------------------------------------------------------------------------- - - private GlobalAggregation(Builder builder) { - super(builder); - - } - - public static GlobalAggregation of(Function> fn) { - return fn.apply(new Builder()).build(); - } +public class GlobalAggregation extends BucketAggregationBase implements AggregationVariant, JsonpSerializable { /** * Aggregation variant kind. @@ -72,44 +58,27 @@ public Aggregation.Kind _aggregationKind() { return Aggregation.Kind.Global; } - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GlobalAggregation}. - */ - - public static class Builder extends BucketAggregationBase.AbstractBuilder - implements - ObjectBuilder { + public static final class Builder implements ObjectBuilder { @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link GlobalAggregation}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ public GlobalAggregation build() { - _checkSingleUse(); - - return new GlobalAggregation(this); + return GlobalAggregation._INSTANCE; } } - // --------------------------------------------------------------------------------------------- - /** - * Json deserializer for {@link GlobalAggregation} + * Serialize this object to JSON. */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, GlobalAggregation::setupGlobalAggregationDeserializer); + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + generator.writeEnd(); + } - protected static void setupGlobalAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + /** + * Singleton instance for empty class {@link GlobalAggregation}. + */ + public static final GlobalAggregation _INSTANCE = new GlobalAggregation(); - } + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer + .emptyObject(GlobalAggregation._INSTANCE); } 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 90c8cec85..9fefe77b0 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 @@ -26,6 +26,8 @@ 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; @@ -65,7 +67,11 @@ * specification */ @JsonpDeserializable -public class HistogramAggregation extends BucketAggregationBase implements AggregationVariant, PivotGroupByVariant { +public class HistogramAggregation extends BucketAggregationBase + implements + AggregationVariant, + PivotGroupByVariant, + JsonpSerializable { @Nullable private final ExtendedBounds extendedBounds; @@ -101,7 +107,6 @@ public class HistogramAggregation extends BucketAggregationBase implements Aggre // --------------------------------------------------------------------------------------------- private HistogramAggregation(Builder builder) { - super(builder); this.extendedBounds = builder.extendedBounds; this.hardBounds = builder.hardBounds; @@ -251,9 +256,17 @@ public final Boolean keyed() { return this.keyed; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.extendedBounds != null) { generator.writeKey("extended_bounds"); this.extendedBounds.serialize(generator, mapper); @@ -320,6 +333,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -548,7 +566,7 @@ public HistogramAggregation build() { .lazy(Builder::new, HistogramAggregation::setupHistogramAggregationDeserializer); protected static void setupHistogramAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::extendedBounds, ExtendedBounds.createExtendedBoundsDeserializer(JsonpDeserializer.doubleDeserializer()), "extended_bounds"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/IpPrefixAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/IpPrefixAggregation.java index bed745b2c..ebc5ca6e2 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/IpPrefixAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/IpPrefixAggregation.java @@ -22,6 +22,8 @@ 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; @@ -59,7 +61,7 @@ * specification */ @JsonpDeserializable -public class IpPrefixAggregation extends BucketAggregationBase implements AggregationVariant { +public class IpPrefixAggregation extends BucketAggregationBase implements AggregationVariant, JsonpSerializable { private final String field; private final int prefixLength; @@ -79,7 +81,6 @@ public class IpPrefixAggregation extends BucketAggregationBase implements Aggreg // --------------------------------------------------------------------------------------------- private IpPrefixAggregation(Builder builder) { - super(builder); this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); this.prefixLength = ApiTypeHelper.requireNonNull(builder.prefixLength, this, "prefixLength"); @@ -165,9 +166,17 @@ public final Long minDocCount() { return this.minDocCount; } + /** + * 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) { - super.serializeInternal(generator, mapper); generator.writeKey("field"); generator.write(this.field); @@ -197,6 +206,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -314,7 +328,7 @@ public IpPrefixAggregation build() { .lazy(Builder::new, IpPrefixAggregation::setupIpPrefixAggregationDeserializer); protected static void setupIpPrefixAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::prefixLength, JsonpDeserializer.integerDeserializer(), "prefix_length"); op.add(Builder::isIpv6, JsonpDeserializer.booleanDeserializer(), "is_ipv6"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/IpRangeAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/IpRangeAggregation.java index 20748091d..71fbcf0d5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/IpRangeAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/IpRangeAggregation.java @@ -22,6 +22,8 @@ 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; @@ -57,7 +59,7 @@ * specification */ @JsonpDeserializable -public class IpRangeAggregation extends BucketAggregationBase implements AggregationVariant { +public class IpRangeAggregation extends BucketAggregationBase implements AggregationVariant, JsonpSerializable { @Nullable private final String field; @@ -66,7 +68,6 @@ public class IpRangeAggregation extends BucketAggregationBase implements Aggrega // --------------------------------------------------------------------------------------------- private IpRangeAggregation(Builder builder) { - super(builder); this.field = builder.field; this.ranges = ApiTypeHelper.unmodifiable(builder.ranges); @@ -104,9 +105,17 @@ public final List ranges() { return this.ranges; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.field != null) { generator.writeKey("field"); generator.write(this.field); @@ -125,6 +134,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -213,7 +227,7 @@ public IpRangeAggregation build() { .lazy(Builder::new, IpRangeAggregation::setupIpRangeAggregationDeserializer); protected static void setupIpRangeAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::ranges, JsonpDeserializer.arrayDeserializer(IpRangeAggregationRange._DESERIALIZER), "ranges"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MatrixAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MatrixAggregation.java index 518893ed2..e04941c24 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MatrixAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MatrixAggregation.java @@ -22,6 +22,8 @@ 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; @@ -59,7 +61,7 @@ * specification */ -public abstract class MatrixAggregation extends AggregationBase { +public abstract class MatrixAggregation extends AggregationBase implements JsonpSerializable { private final List fields; private final Map missing; @@ -67,7 +69,6 @@ public abstract class MatrixAggregation extends AggregationBase { // --------------------------------------------------------------------------------------------- protected MatrixAggregation(AbstractBuilder builder) { - super(builder); this.fields = ApiTypeHelper.unmodifiable(builder.fields); this.missing = ApiTypeHelper.unmodifiable(builder.missing); @@ -93,9 +94,17 @@ public final Map missing() { return this.missing; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (ApiTypeHelper.isDefined(this.fields)) { generator.writeKey("fields"); generator.writeStartArray(); @@ -120,6 +129,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + public abstract static class AbstractBuilder> extends AggregationBase.AbstractBuilder { @@ -179,12 +193,14 @@ public final BuilderT missing(String key, Double value) { return self(); } + protected abstract BuilderT self(); + } // --------------------------------------------------------------------------------------------- protected static > void setupMatrixAggregationDeserializer( ObjectDeserializer op) { - AggregationBase.setupAggregationBaseDeserializer(op); + op.add(AbstractBuilder::fields, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "fields"); op.add(AbstractBuilder::missing, diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MissingAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MissingAggregation.java index fab470c25..ded342969 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MissingAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MissingAggregation.java @@ -25,6 +25,8 @@ import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ObjectBuilder; @@ -58,7 +60,11 @@ * specification */ @JsonpDeserializable -public class MissingAggregation extends BucketAggregationBase implements AggregationVariant, ApiKeyAggregationVariant { +public class MissingAggregation extends BucketAggregationBase + implements + AggregationVariant, + ApiKeyAggregationVariant, + JsonpSerializable { @Nullable private final String field; @@ -68,7 +74,6 @@ public class MissingAggregation extends BucketAggregationBase implements Aggrega // --------------------------------------------------------------------------------------------- private MissingAggregation(Builder builder) { - super(builder); this.field = builder.field; this.missing = builder.missing; @@ -113,9 +118,17 @@ public final FieldValue missing() { return this.missing; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.field != null) { generator.writeKey("field"); generator.write(this.field); @@ -129,6 +142,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -228,7 +246,7 @@ public MissingAggregation build() { .lazy(Builder::new, MissingAggregation::setupMissingAggregationDeserializer); protected static void setupMissingAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::missing, FieldValue._DESERIALIZER, "missing"); 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 77651d9c6..78409eeb5 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,6 +23,8 @@ 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; @@ -61,7 +63,7 @@ * specification */ @JsonpDeserializable -public class MultiTermsAggregation extends BucketAggregationBase implements AggregationVariant { +public class MultiTermsAggregation extends BucketAggregationBase implements AggregationVariant, JsonpSerializable { @Nullable private final TermsAggregationCollectMode collectMode; @@ -87,7 +89,6 @@ public class MultiTermsAggregation extends BucketAggregationBase implements Aggr // --------------------------------------------------------------------------------------------- private MultiTermsAggregation(Builder builder) { - super(builder); this.collectMode = builder.collectMode; this.order = ApiTypeHelper.unmodifiable(builder.order); @@ -194,9 +195,17 @@ public final List terms() { return this.terms; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.collectMode != null) { generator.writeKey("collect_mode"); this.collectMode.serialize(generator, mapper); @@ -252,6 +261,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -435,7 +449,7 @@ public MultiTermsAggregation build() { .lazy(Builder::new, MultiTermsAggregation::setupMultiTermsAggregationDeserializer); 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"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/NestedAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/NestedAggregation.java index a42eef7d7..1a9044d68 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/NestedAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/NestedAggregation.java @@ -22,6 +22,8 @@ import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ObjectBuilder; @@ -55,14 +57,13 @@ * specification */ @JsonpDeserializable -public class NestedAggregation extends BucketAggregationBase implements AggregationVariant { +public class NestedAggregation extends BucketAggregationBase implements AggregationVariant, JsonpSerializable { @Nullable private final String path; // --------------------------------------------------------------------------------------------- private NestedAggregation(Builder builder) { - super(builder); this.path = builder.path; @@ -90,9 +91,17 @@ public final String path() { return this.path; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.path != null) { generator.writeKey("path"); generator.write(this.path); @@ -101,6 +110,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -150,7 +164,7 @@ public NestedAggregation build() { .lazy(Builder::new, NestedAggregation::setupNestedAggregationDeserializer); protected static void setupNestedAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::path, JsonpDeserializer.stringDeserializer(), "path"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/ParentAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/ParentAggregation.java index 55171ca96..7ab7d4e8d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/ParentAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/ParentAggregation.java @@ -22,6 +22,8 @@ import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ObjectBuilder; @@ -55,14 +57,13 @@ * specification */ @JsonpDeserializable -public class ParentAggregation extends BucketAggregationBase implements AggregationVariant { +public class ParentAggregation extends BucketAggregationBase implements AggregationVariant, JsonpSerializable { @Nullable private final String type; // --------------------------------------------------------------------------------------------- private ParentAggregation(Builder builder) { - super(builder); this.type = builder.type; @@ -90,9 +91,17 @@ public final String type() { return this.type; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.type != null) { generator.writeKey("type"); generator.write(this.type); @@ -101,6 +110,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -150,7 +164,7 @@ public ParentAggregation build() { .lazy(Builder::new, ParentAggregation::setupParentAggregationDeserializer); protected static void setupParentAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/RangeAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/RangeAggregation.java index 92c37eec6..1e566f409 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/RangeAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/RangeAggregation.java @@ -25,6 +25,8 @@ 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; @@ -62,7 +64,11 @@ * specification */ @JsonpDeserializable -public class RangeAggregation extends BucketAggregationBase implements AggregationVariant, ApiKeyAggregationVariant { +public class RangeAggregation extends BucketAggregationBase + implements + AggregationVariant, + ApiKeyAggregationVariant, + JsonpSerializable { @Nullable private final String field; @@ -83,7 +89,6 @@ public class RangeAggregation extends BucketAggregationBase implements Aggregati // --------------------------------------------------------------------------------------------- private RangeAggregation(Builder builder) { - super(builder); this.field = builder.field; this.missing = builder.missing; @@ -171,9 +176,17 @@ public final String format() { return this.format; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.field != null) { generator.writeKey("field"); generator.write(this.field); @@ -212,6 +225,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -356,7 +374,7 @@ public RangeAggregation build() { RangeAggregation::setupRangeAggregationDeserializer); protected static void setupRangeAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::missing, JsonpDeserializer.integerDeserializer(), "missing"); op.add(Builder::ranges, JsonpDeserializer.arrayDeserializer(AggregationRange._DESERIALIZER), "ranges"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/RareTermsAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/RareTermsAggregation.java index 6aa5dea0b..02fd0d770 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/RareTermsAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/RareTermsAggregation.java @@ -23,6 +23,8 @@ import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ObjectBuilder; @@ -58,7 +60,7 @@ * specification */ @JsonpDeserializable -public class RareTermsAggregation extends BucketAggregationBase implements AggregationVariant { +public class RareTermsAggregation extends BucketAggregationBase implements AggregationVariant, JsonpSerializable { @Nullable private final TermsExclude exclude; @@ -83,7 +85,6 @@ public class RareTermsAggregation extends BucketAggregationBase implements Aggre // --------------------------------------------------------------------------------------------- private RareTermsAggregation(Builder builder) { - super(builder); this.exclude = builder.exclude; this.field = builder.field; @@ -177,9 +178,17 @@ public final String valueType() { return this.valueType; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.exclude != null) { generator.writeKey("exclude"); this.exclude.serialize(generator, mapper); @@ -218,6 +227,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -417,7 +431,7 @@ public RareTermsAggregation build() { .lazy(Builder::new, RareTermsAggregation::setupRareTermsAggregationDeserializer); protected static void setupRareTermsAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::exclude, TermsExclude._DESERIALIZER, "exclude"); op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); op.add(Builder::include, TermsInclude._DESERIALIZER, "include"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/ReverseNestedAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/ReverseNestedAggregation.java index 30399376d..c4de764ce 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/ReverseNestedAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/ReverseNestedAggregation.java @@ -22,6 +22,8 @@ import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ObjectBuilder; @@ -55,14 +57,13 @@ * specification */ @JsonpDeserializable -public class ReverseNestedAggregation extends BucketAggregationBase implements AggregationVariant { +public class ReverseNestedAggregation extends BucketAggregationBase implements AggregationVariant, JsonpSerializable { @Nullable private final String path; // --------------------------------------------------------------------------------------------- private ReverseNestedAggregation(Builder builder) { - super(builder); this.path = builder.path; @@ -91,9 +92,17 @@ public final String path() { return this.path; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.path != null) { generator.writeKey("path"); generator.write(this.path); @@ -102,6 +111,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -153,7 +167,7 @@ public ReverseNestedAggregation build() { protected static void setupReverseNestedAggregationDeserializer( ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::path, JsonpDeserializer.stringDeserializer(), "path"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/SamplerAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/SamplerAggregation.java index f93a9b838..4c730a6c2 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/SamplerAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/SamplerAggregation.java @@ -22,6 +22,8 @@ import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ObjectBuilder; @@ -55,14 +57,13 @@ * specification */ @JsonpDeserializable -public class SamplerAggregation extends BucketAggregationBase implements AggregationVariant { +public class SamplerAggregation extends BucketAggregationBase implements AggregationVariant, JsonpSerializable { @Nullable private final Integer shardSize; // --------------------------------------------------------------------------------------------- private SamplerAggregation(Builder builder) { - super(builder); this.shardSize = builder.shardSize; @@ -91,9 +92,17 @@ public final Integer shardSize() { return this.shardSize; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.shardSize != null) { generator.writeKey("shard_size"); generator.write(this.shardSize); @@ -102,6 +111,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -152,7 +166,7 @@ public SamplerAggregation build() { .lazy(Builder::new, SamplerAggregation::setupSamplerAggregationDeserializer); protected static void setupSamplerAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::shardSize, JsonpDeserializer.integerDeserializer(), "shard_size"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/SignificantTermsAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/SignificantTermsAggregation.java index e4dc96ea5..712b8f059 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/SignificantTermsAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/SignificantTermsAggregation.java @@ -24,6 +24,8 @@ import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ObjectBuilder; @@ -59,7 +61,10 @@ * specification */ @JsonpDeserializable -public class SignificantTermsAggregation extends BucketAggregationBase implements AggregationVariant { +public class SignificantTermsAggregation extends BucketAggregationBase + implements + AggregationVariant, + JsonpSerializable { @Nullable private final Query backgroundFilter; @@ -108,7 +113,6 @@ public class SignificantTermsAggregation extends BucketAggregationBase implement // --------------------------------------------------------------------------------------------- private SignificantTermsAggregation(Builder builder) { - super(builder); this.backgroundFilter = builder.backgroundFilter; this.chiSquare = builder.chiSquare; @@ -302,9 +306,17 @@ public final Integer size() { return this.size; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.backgroundFilter != null) { generator.writeKey("background_filter"); this.backgroundFilter.serialize(generator, mapper); @@ -382,6 +394,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -715,7 +732,7 @@ public SignificantTermsAggregation build() { protected static void setupSignificantTermsAggregationDeserializer( ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::backgroundFilter, Query._DESERIALIZER, "background_filter"); op.add(Builder::chiSquare, ChiSquareHeuristic._DESERIALIZER, "chi_square"); op.add(Builder::exclude, TermsExclude._DESERIALIZER, "exclude"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/SignificantTextAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/SignificantTextAggregation.java index aee184b30..2c6cc95c6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/SignificantTextAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/SignificantTextAggregation.java @@ -24,6 +24,8 @@ 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; @@ -62,7 +64,7 @@ * specification */ @JsonpDeserializable -public class SignificantTextAggregation extends BucketAggregationBase implements AggregationVariant { +public class SignificantTextAggregation extends BucketAggregationBase implements AggregationVariant, JsonpSerializable { @Nullable private final Query backgroundFilter; @@ -116,7 +118,6 @@ public class SignificantTextAggregation extends BucketAggregationBase implements // --------------------------------------------------------------------------------------------- private SignificantTextAggregation(Builder builder) { - super(builder); this.backgroundFilter = builder.backgroundFilter; this.chiSquare = builder.chiSquare; @@ -332,9 +333,17 @@ public final List sourceFields() { return this.sourceFields; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.backgroundFilter != null) { generator.writeKey("background_filter"); this.backgroundFilter.serialize(generator, mapper); @@ -427,6 +436,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -802,7 +816,7 @@ public SignificantTextAggregation build() { protected static void setupSignificantTextAggregationDeserializer( ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::backgroundFilter, Query._DESERIALIZER, "background_filter"); op.add(Builder::chiSquare, ChiSquareHeuristic._DESERIALIZER, "chi_square"); op.add(Builder::exclude, TermsExclude._DESERIALIZER, "exclude"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TTestAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TTestAggregation.java index 57ffa3df2..3a2e2dbad 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TTestAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TTestAggregation.java @@ -22,6 +22,8 @@ import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ObjectBuilder; @@ -54,7 +56,7 @@ * specification */ @JsonpDeserializable -public class TTestAggregation extends AggregationBase implements AggregationVariant { +public class TTestAggregation extends AggregationBase implements AggregationVariant, JsonpSerializable { @Nullable private final TestPopulation a; @@ -67,7 +69,6 @@ public class TTestAggregation extends AggregationBase implements AggregationVari // --------------------------------------------------------------------------------------------- private TTestAggregation(Builder builder) { - super(builder); this.a = builder.a; this.b = builder.b; @@ -117,9 +118,17 @@ public final TTestType type() { return this.type; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.a != null) { generator.writeKey("a"); this.a.serialize(generator, mapper); @@ -137,6 +146,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -230,7 +244,7 @@ public TTestAggregation build() { TTestAggregation::setupTTestAggregationDeserializer); protected static void setupTTestAggregationDeserializer(ObjectDeserializer op) { - AggregationBase.setupAggregationBaseDeserializer(op); + op.add(Builder::a, TestPopulation._DESERIALIZER, "a"); op.add(Builder::b, TestPopulation._DESERIALIZER, "b"); op.add(Builder::type, TTestType._DESERIALIZER, "type"); 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 97b4bc9e1..a5a5e420f 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 @@ -29,6 +29,8 @@ 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; @@ -71,7 +73,8 @@ public class TermsAggregation extends BucketAggregationBase implements AggregationVariant, PivotGroupByVariant, - ApiKeyAggregationVariant { + ApiKeyAggregationVariant, + JsonpSerializable { @Nullable private final TermsAggregationCollectMode collectMode; @@ -122,7 +125,6 @@ public class TermsAggregation extends BucketAggregationBase // --------------------------------------------------------------------------------------------- private TermsAggregation(Builder builder) { - super(builder); this.collectMode = builder.collectMode; this.exclude = builder.exclude; @@ -331,9 +333,17 @@ public final String format() { return this.format; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.collectMode != null) { generator.writeKey("collect_mode"); this.collectMode.serialize(generator, mapper); @@ -422,6 +432,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -761,7 +776,7 @@ public TermsAggregation build() { TermsAggregation::setupTermsAggregationDeserializer); protected static void setupTermsAggregationDeserializer(ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::collectMode, TermsAggregationCollectMode._DESERIALIZER, "collect_mode"); op.add(Builder::exclude, TermsExclude._DESERIALIZER, "exclude"); op.add(Builder::executionHint, TermsAggregationExecutionHint._DESERIALIZER, "execution_hint"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/VariableWidthHistogramAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/VariableWidthHistogramAggregation.java index c3629ad4f..09341d539 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/VariableWidthHistogramAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/VariableWidthHistogramAggregation.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch._types.aggregations; +import co.elastic.clients.elasticsearch._types.Script; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -72,6 +73,9 @@ public class VariableWidthHistogramAggregation implements AggregationVariant, Js @Nullable private final Integer initialBuffer; + @Nullable + private final Script script; + // --------------------------------------------------------------------------------------------- private VariableWidthHistogramAggregation(Builder builder) { @@ -80,6 +84,7 @@ private VariableWidthHistogramAggregation(Builder builder) { this.buckets = builder.buckets; this.shardSize = builder.shardSize; this.initialBuffer = builder.initialBuffer; + this.script = builder.script; } @@ -139,6 +144,14 @@ public final Integer initialBuffer() { return this.initialBuffer; } + /** + * API name: {@code script} + */ + @Nullable + public final Script script() { + return this.script; + } + /** * Serialize this object to JSON. */ @@ -170,6 +183,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.initialBuffer); } + if (this.script != null) { + generator.writeKey("script"); + this.script.serialize(generator, mapper); + + } } @@ -199,6 +217,9 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private Integer initialBuffer; + @Nullable + private Script script; + /** * The name of the field. *

@@ -242,6 +263,21 @@ public final Builder initialBuffer(@Nullable Integer value) { return this; } + /** + * API name: {@code script} + */ + public final Builder script(@Nullable Script value) { + this.script = value; + return this; + } + + /** + * API name: {@code script} + */ + public final Builder script(Function> fn) { + return this.script(fn.apply(new Script.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -275,6 +311,7 @@ protected static void setupVariableWidthHistogramAggregationDeserializer( op.add(Builder::buckets, JsonpDeserializer.integerDeserializer(), "buckets"); op.add(Builder::shardSize, JsonpDeserializer.integerDeserializer(), "shard_size"); op.add(Builder::initialBuffer, JsonpDeserializer.integerDeserializer(), "initial_buffer"); + op.add(Builder::script, Script._DESERIALIZER, "script"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/WeightedAverageAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/WeightedAverageAggregation.java index 5153590a5..e61ef1625 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/WeightedAverageAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/WeightedAverageAggregation.java @@ -22,6 +22,8 @@ import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ObjectBuilder; @@ -55,7 +57,7 @@ * specification */ @JsonpDeserializable -public class WeightedAverageAggregation extends AggregationBase implements AggregationVariant { +public class WeightedAverageAggregation extends AggregationBase implements AggregationVariant, JsonpSerializable { @Nullable private final String format; @@ -71,7 +73,6 @@ public class WeightedAverageAggregation extends AggregationBase implements Aggre // --------------------------------------------------------------------------------------------- private WeightedAverageAggregation(Builder builder) { - super(builder); this.format = builder.format; this.value = builder.value; @@ -130,9 +131,17 @@ public final WeightedAverageValue weight() { return this.weight; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.format != null) { generator.writeKey("format"); generator.write(this.format); @@ -155,6 +164,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -260,7 +274,7 @@ public WeightedAverageAggregation build() { protected static void setupWeightedAverageAggregationDeserializer( ObjectDeserializer op) { - AggregationBase.setupAggregationBaseDeserializer(op); + op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); op.add(Builder::value, WeightedAverageValue._DESERIALIZER, "value"); op.add(Builder::valueType, ValueType._DESERIALIZER, "value_type"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/HtmlStripCharFilter.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/HtmlStripCharFilter.java index 3f0bbbd31..d8a97a5a3 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/HtmlStripCharFilter.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/analysis/HtmlStripCharFilter.java @@ -24,10 +24,14 @@ 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; +import java.util.List; import java.util.Objects; import java.util.function.Function; +import javax.annotation.Nullable; //---------------------------------------------------------------- // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. @@ -54,11 +58,15 @@ */ @JsonpDeserializable public class HtmlStripCharFilter extends CharFilterBase implements CharFilterDefinitionVariant { + private final List escapedTags; + // --------------------------------------------------------------------------------------------- private HtmlStripCharFilter(Builder builder) { super(builder); + this.escapedTags = ApiTypeHelper.unmodifiable(builder.escapedTags); + } public static HtmlStripCharFilter of(Function> fn) { @@ -73,10 +81,27 @@ public CharFilterDefinition.Kind _charFilterDefinitionKind() { return CharFilterDefinition.Kind.HtmlStrip; } + /** + * API name: {@code escaped_tags} + */ + public final List escapedTags() { + return this.escapedTags; + } + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write("type", "html_strip"); super.serializeInternal(generator, mapper); + if (ApiTypeHelper.isDefined(this.escapedTags)) { + generator.writeKey("escaped_tags"); + generator.writeStartArray(); + for (String item0 : this.escapedTags) { + generator.write(item0); + + } + generator.writeEnd(); + + } } @@ -89,6 +114,29 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends CharFilterBase.AbstractBuilder implements ObjectBuilder { + @Nullable + private List escapedTags; + + /** + * API name: {@code escaped_tags} + *

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

+ * Adds one or more values to escapedTags. + */ + public final Builder escapedTags(String value, String... values) { + this.escapedTags = _listAdd(this.escapedTags, value, values); + return this; + } + @Override protected Builder self() { return this; @@ -117,6 +165,8 @@ public HtmlStripCharFilter build() { protected static void setupHtmlStripCharFilterDeserializer(ObjectDeserializer op) { CharFilterBase.setupCharFilterBaseDeserializer(op); + op.add(Builder::escapedTags, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "escaped_tags"); op.ignore("type"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DynamicProperty.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DynamicProperty.java index e13a89e69..e2a0b406e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DynamicProperty.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/DynamicProperty.java @@ -347,7 +347,7 @@ public final String locale() { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("type", "{dynamic_property}"); + generator.write("type", "{dynamic_type}"); super.serializeInternal(generator, mapper); if (this.enabled != null) { generator.writeKey("enabled"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/Property.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/Property.java index f0a96566f..f0f9da125 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/Property.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/Property.java @@ -96,7 +96,7 @@ public enum Kind implements JsonEnum { DoubleRange("double_range"), - DynamicType("{dynamic_property}"), + DynamicType("{dynamic_type}"), Alias("alias"), @@ -433,18 +433,17 @@ public DoubleRangeProperty doubleRange() { } /** - * Is this variant instance of kind {@code {dynamic_property}}? + * Is this variant instance of kind {@code {dynamic_type}}? */ public boolean isDynamicType() { return _kind == Kind.DynamicType; } /** - * Get the {@code {dynamic_property}} variant value. + * Get the {@code {dynamic_type}} variant value. * * @throws IllegalStateException - * if the current variant is not of the {@code {dynamic_property}} - * kind. + * if the current variant is not of the {@code {dynamic_type}} kind. */ public DynamicProperty dynamicType() { return TaggedUnionUtils.get(this, Kind.DynamicType); @@ -1621,7 +1620,7 @@ protected static void setupPropertyDeserializer(ObjectDeserializer op) op.add(Builder::denseVector, DenseVectorProperty._DESERIALIZER, "dense_vector"); op.add(Builder::double_, DoubleNumberProperty._DESERIALIZER, "double"); op.add(Builder::doubleRange, DoubleRangeProperty._DESERIALIZER, "double_range"); - op.add(Builder::dynamicType, DynamicProperty._DESERIALIZER, "{dynamic_property}"); + op.add(Builder::dynamicType, DynamicProperty._DESERIALIZER, "{dynamic_type}"); op.add(Builder::alias, FieldAliasProperty._DESERIALIZER, "alias"); op.add(Builder::flattened, FlattenedProperty._DESERIALIZER, "flattened"); op.add(Builder::float_, FloatNumberProperty._DESERIALIZER, "float"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBuilders.java index c4ead33dd..7b07b0d0c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBuilders.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/PropertyBuilders.java @@ -261,7 +261,7 @@ public static Property doubleRange(Function> fn) { diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/RuntimeFieldType.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/RuntimeFieldType.java index d483387ae..f845209a2 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/RuntimeFieldType.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/RuntimeFieldType.java @@ -48,6 +48,8 @@ public enum RuntimeFieldType implements JsonEnum { Boolean("boolean"), + Composite("composite"), + Date("date"), Double("double"), diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/LikeDocument.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/LikeDocument.java index a2869693b..1e3bc3ed5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/LikeDocument.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/LikeDocument.java @@ -144,6 +144,8 @@ public final String index() { } /** + * Overrides the default analyzer. + *

* API name: {@code per_field_analyzer} */ public final Map perFieldAnalyzer() { @@ -325,6 +327,8 @@ public final Builder index(@Nullable String value) { } /** + * Overrides the default analyzer. + *

* API name: {@code per_field_analyzer} *

* Adds all entries of map to perFieldAnalyzer. @@ -335,6 +339,8 @@ public final Builder perFieldAnalyzer(Map map) { } /** + * Overrides the default analyzer. + *

* API name: {@code per_field_analyzer} *

* Adds an entry to perFieldAnalyzer. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/MoreLikeThisQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/MoreLikeThisQuery.java index d7a107e34..a8baebadc 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/MoreLikeThisQuery.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/MoreLikeThisQuery.java @@ -34,7 +34,6 @@ import java.lang.Long; 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; @@ -101,8 +100,6 @@ public class MoreLikeThisQuery extends QueryBase implements QueryVariant { @Nullable private final Integer minWordLength; - private final Map perFieldAnalyzer; - @Nullable private final String routing; @@ -134,7 +131,6 @@ private MoreLikeThisQuery(Builder builder) { this.minimumShouldMatch = builder.minimumShouldMatch; this.minTermFreq = builder.minTermFreq; this.minWordLength = builder.minWordLength; - this.perFieldAnalyzer = ApiTypeHelper.unmodifiable(builder.perFieldAnalyzer); this.routing = builder.routing; this.stopWords = ApiTypeHelper.unmodifiable(builder.stopWords); this.unlike = ApiTypeHelper.unmodifiable(builder.unlike); @@ -297,15 +293,6 @@ public final Integer minWordLength() { return this.minWordLength; } - /** - * Overrides the default analyzer. - *

- * API name: {@code per_field_analyzer} - */ - public final Map perFieldAnalyzer() { - return this.perFieldAnalyzer; - } - /** * API name: {@code routing} */ @@ -426,17 +413,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("min_word_length"); generator.write(this.minWordLength); - } - if (ApiTypeHelper.isDefined(this.perFieldAnalyzer)) { - generator.writeKey("per_field_analyzer"); - generator.writeStartObject(); - for (Map.Entry item0 : this.perFieldAnalyzer.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - } if (this.routing != null) { generator.writeKey("routing"); @@ -520,9 +496,6 @@ public static class Builder extends QueryBase.AbstractBuilder implement @Nullable private Integer minWordLength; - @Nullable - private Map perFieldAnalyzer; - @Nullable private String routing; @@ -725,30 +698,6 @@ public final Builder minWordLength(@Nullable Integer value) { return this; } - /** - * Overrides the default analyzer. - *

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

- * Adds all entries of map to perFieldAnalyzer. - */ - public final Builder perFieldAnalyzer(Map map) { - this.perFieldAnalyzer = _mapPutAll(this.perFieldAnalyzer, map); - return this; - } - - /** - * Overrides the default analyzer. - *

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

- * Adds an entry to perFieldAnalyzer. - */ - public final Builder perFieldAnalyzer(String key, String value) { - this.perFieldAnalyzer = _mapPut(this.perFieldAnalyzer, key, value); - return this; - } - /** * API name: {@code routing} */ @@ -876,8 +825,6 @@ protected static void setupMoreLikeThisQueryDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class LearningToRank implements RescoreVariant, JsonpSerializable { + private final String modelId; + + private final Map params; + + // --------------------------------------------------------------------------------------------- + + private LearningToRank(Builder builder) { + + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + this.params = ApiTypeHelper.unmodifiable(builder.params); + + } + + public static LearningToRank of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Rescore variant kind. + */ + @Override + public Rescore.Kind _rescoreKind() { + return Rescore.Kind.LearningToRank; + } + + /** + * Required - The unique identifier of the trained model uploaded to + * Elasticsearch + *

+ * API name: {@code model_id} + */ + public final String modelId() { + return this.modelId; + } + + /** + * Named parameters to be passed to the query templates used for feature + *

+ * API name: {@code params} + */ + public final Map params() { + return this.params; + } + + /** + * 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("model_id"); + generator.write(this.modelId); + + if (ApiTypeHelper.isDefined(this.params)) { + generator.writeKey("params"); + generator.writeStartObject(); + for (Map.Entry item0 : this.params.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link LearningToRank}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private String modelId; + + @Nullable + private Map params; + + /** + * Required - The unique identifier of the trained model uploaded to + * Elasticsearch + *

+ * API name: {@code model_id} + */ + public final Builder modelId(String value) { + this.modelId = value; + return this; + } + + /** + * Named parameters to be passed to the query templates used for feature + *

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

+ * Adds all entries of map to params. + */ + public final Builder params(Map map) { + this.params = _mapPutAll(this.params, map); + return this; + } + + /** + * Named parameters to be passed to the query templates used for feature + *

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

+ * Adds an entry to params. + */ + public final Builder params(String key, JsonData value) { + this.params = _mapPut(this.params, key, value); + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link LearningToRank}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public LearningToRank build() { + _checkSingleUse(); + + return new LearningToRank(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link LearningToRank} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + LearningToRank::setupLearningToRankDeserializer); + + protected static void setupLearningToRankDeserializer(ObjectDeserializer op) { + + op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); + op.add(Builder::params, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "params"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/Rescore.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/Rescore.java index d6e523391..6ebb23e05 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/Rescore.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/Rescore.java @@ -19,6 +19,8 @@ package co.elastic.clients.elasticsearch.core.search; +import co.elastic.clients.json.JsonData; +import co.elastic.clients.json.JsonEnum; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -28,9 +30,12 @@ import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.OpenTaggedUnion; +import co.elastic.clients.util.TaggedUnionUtils; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.Integer; +import java.lang.Object; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -59,17 +64,70 @@ * specification */ @JsonpDeserializable -public class Rescore implements JsonpSerializable { - private final RescoreQuery query; +public class Rescore implements OpenTaggedUnion, JsonpSerializable { + + /** + * {@link Rescore} variant kinds. + * + * @see API + * specification + */ + + public enum Kind implements JsonEnum { + Query("query"), + + LearningToRank("learning_to_rank"), + + /** A custom {@code Rescore} defined by a plugin */ + _Custom(null) + + ; + + private final String jsonValue; + + Kind(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } @Nullable private final Integer windowSize; - // --------------------------------------------------------------------------------------------- + public Rescore(RescoreVariant value) { + + this._kind = ApiTypeHelper.requireNonNull(value._rescoreKind(), this, ""); + this._value = ApiTypeHelper.requireNonNull(value, this, ""); + this._customKind = null; + + this.windowSize = null; + + } private Rescore(Builder builder) { - this.query = ApiTypeHelper.requireNonNull(builder.query, this, "query"); + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + this._customKind = builder._customKind; + this.windowSize = builder.windowSize; } @@ -79,33 +137,82 @@ public static Rescore of(Function> fn) { } /** - * Required - API name: {@code query} + * API name: {@code window_size} */ - public final RescoreQuery query() { - return this.query; + @Nullable + public final Integer windowSize() { + return this.windowSize; } /** - * API name: {@code window_size} + * Is this variant instance of kind {@code query}? + */ + public boolean isQuery() { + return _kind == Kind.Query; + } + + /** + * Get the {@code query} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code query} kind. + */ + public RescoreQuery query() { + return TaggedUnionUtils.get(this, Kind.Query); + } + + /** + * Is this variant instance of kind {@code learning_to_rank}? */ + public boolean isLearningToRank() { + return _kind == Kind.LearningToRank; + } + + /** + * Get the {@code learning_to_rank} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code learning_to_rank} + * kind. + */ + public LearningToRank learningToRank() { + return TaggedUnionUtils.get(this, Kind.LearningToRank); + } + @Nullable - public final Integer windowSize() { - return this.windowSize; + private final String _customKind; + + /** + * Is this a custom {@code Rescore} defined by a plugin? + */ + public boolean _isCustom() { + return _kind == Kind._Custom; } /** - * Serialize this object to JSON. + * Get the actual kind when {@code _kind()} equals {@link Kind#_Custom} + * (plugin-defined variant). */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); + @Nullable + public final String _customKind() { + return _customKind; } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + /** + * Get the custom plugin-defined variant value. + * + * @throws IllegalStateException + * if the current variant is not {@link Kind#_Custom}. + */ + public JsonData _custom() { + return TaggedUnionUtils.get(this, Kind._Custom); + } - generator.writeKey("query"); - this.query.serialize(generator, mapper); + @Override + @SuppressWarnings("unchecked") + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeStartObject(); if (this.windowSize != null) { generator.writeKey("window_size"); @@ -113,6 +220,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + generator.writeKey(_kind == Kind._Custom ? _customKind : _kind.jsonValue()); + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } + + generator.writeEnd(); + } @Override @@ -120,33 +234,14 @@ public String toString() { return JsonpUtils.toString(this); } - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link Rescore}. - */ - - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private RescoreQuery query; + public static class Builder extends WithJsonObjectBuilderBase { + private Kind _kind; + private Object _value; + private String _customKind; @Nullable private Integer windowSize; - /** - * Required - API name: {@code query} - */ - public final Builder query(RescoreQuery value) { - this.query = value; - return this; - } - - /** - * Required - API name: {@code query} - */ - public final Builder query(Function> fn) { - return this.query(fn.apply(new RescoreQuery.Builder()).build()); - } - /** * API name: {@code window_size} */ @@ -159,33 +254,76 @@ public final Builder windowSize(@Nullable Integer value) { protected Builder self() { return this; } + public ContainerBuilder query(RescoreQuery v) { + this._kind = Kind.Query; + this._value = v; + return new ContainerBuilder(); + } + + public ContainerBuilder query(Function> fn) { + return this.query(fn.apply(new RescoreQuery.Builder()).build()); + } + + public ContainerBuilder learningToRank(LearningToRank v) { + this._kind = Kind.LearningToRank; + this._value = v; + return new ContainerBuilder(); + } + + public ContainerBuilder learningToRank(Function> fn) { + return this.learningToRank(fn.apply(new LearningToRank.Builder()).build()); + } /** - * Builds a {@link Rescore}. + * Define this {@code Rescore} as a plugin-defined variant. * - * @throws NullPointerException - * if some of the required fields are null. + * @param name + * the plugin-defined identifier + * @param data + * the data for this custom {@code Rescore}. It is converted + * internally to {@link JsonData}. */ - public Rescore build() { - _checkSingleUse(); + public ContainerBuilder _custom(String name, Object data) { + this._kind = Kind._Custom; + this._customKind = name; + this._value = JsonData.of(data); + return new ContainerBuilder(); + } + protected Rescore build() { + _checkSingleUse(); return new Rescore(this); } - } - // --------------------------------------------------------------------------------------------- + public class ContainerBuilder implements ObjectBuilder { - /** - * Json deserializer for {@link Rescore} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Rescore::setupRescoreDeserializer); + /** + * API name: {@code window_size} + */ + public final ContainerBuilder windowSize(@Nullable Integer value) { + Builder.this.windowSize = value; + return this; + } + + public Rescore build() { + return Builder.this.build(); + } + } + } - protected static void setupRescoreDeserializer(ObjectDeserializer op) { + protected static void setupRescoreDeserializer(ObjectDeserializer op) { - op.add(Builder::query, RescoreQuery._DESERIALIZER, "query"); op.add(Builder::windowSize, JsonpDeserializer.integerDeserializer(), "window_size"); + op.add(Builder::query, RescoreQuery._DESERIALIZER, "query"); + op.add(Builder::learningToRank, LearningToRank._DESERIALIZER, "learning_to_rank"); + + op.setUnknownFieldHandler((builder, name, parser, mapper) -> { + JsonpUtils.ensureCustomVariantsAllowed(parser, mapper); + builder._custom(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); + }); } + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Rescore::setupRescoreDeserializer, Builder::build); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/RescoreBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/RescoreBuilders.java new file mode 100644 index 000000000..12408742f --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/RescoreBuilders.java @@ -0,0 +1,81 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.core.search; + +import co.elastic.clients.util.ObjectBuilder; +import java.util.function.Function; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +/** + * Builders for {@link Rescore} variants. + */ +public class RescoreBuilders { + private RescoreBuilders() { + } + + /** + * Creates a builder for the {@link RescoreQuery query} {@code Rescore} variant. + */ + public static RescoreQuery.Builder query() { + return new RescoreQuery.Builder(); + } + + /** + * Creates a Rescore of the {@link RescoreQuery query} {@code Rescore} variant. + */ + public static Rescore query(Function> fn) { + Rescore.Builder builder = new Rescore.Builder(); + builder.query(fn.apply(new RescoreQuery.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link LearningToRank learning_to_rank} + * {@code Rescore} variant. + */ + public static LearningToRank.Builder learningToRank() { + return new LearningToRank.Builder(); + } + + /** + * Creates a Rescore of the {@link LearningToRank learning_to_rank} + * {@code Rescore} variant. + */ + public static Rescore learningToRank(Function> fn) { + Rescore.Builder builder = new Rescore.Builder(); + builder.learningToRank(fn.apply(new LearningToRank.Builder()).build()); + return builder.build(); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/RescoreQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/RescoreQuery.java index fd29b30ee..0aa3cb24d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/RescoreQuery.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/RescoreQuery.java @@ -60,7 +60,7 @@ * specification */ @JsonpDeserializable -public class RescoreQuery implements JsonpSerializable { +public class RescoreQuery implements RescoreVariant, JsonpSerializable { private final Query query; @Nullable @@ -87,6 +87,14 @@ public static RescoreQuery of(Function> fn) return fn.apply(new Builder()).build(); } + /** + * Rescore variant kind. + */ + @Override + public Rescore.Kind _rescoreKind() { + return Rescore.Kind.Query; + } + /** * Required - The query to use for rescoring. This query is only run on the * Top-K results returned by the query and post_filter diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/RescoreVariant.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/RescoreVariant.java new file mode 100644 index 000000000..6492d3a01 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/RescoreVariant.java @@ -0,0 +1,48 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.core.search; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +/** + * Base interface for {@link Rescore} variants. + */ +public interface RescoreVariant { + + Rescore.Kind _rescoreKind(); + + default Rescore _toRescore() { + return new Rescore(this); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html index 9cc254029..285a3fcc9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html @@ -96,13 +96,13 @@ '_global.mget.Request': '_global/mget/MultiGetRequest.ts#L25-L98', '_global.mget.Response': '_global/mget/MultiGetResponse.ts#L22-L26', '_global.mget.ResponseItem': '_global/mget/types.ts#L57-L60', -'_global.msearch.MultiSearchItem': '_global/msearch/types.ts#L214-L217', -'_global.msearch.MultiSearchResult': '_global/msearch/types.ts#L204-L207', -'_global.msearch.MultisearchBody': '_global/msearch/types.ts#L71-L202', -'_global.msearch.MultisearchHeader': '_global/msearch/types.ts#L53-L68', +'_global.msearch.MultiSearchItem': '_global/msearch/types.ts#L213-L216', +'_global.msearch.MultiSearchResult': '_global/msearch/types.ts#L203-L206', +'_global.msearch.MultisearchBody': '_global/msearch/types.ts#L70-L201', +'_global.msearch.MultisearchHeader': '_global/msearch/types.ts#L52-L67', '_global.msearch.Request': '_global/msearch/MultiSearchRequest.ts#L25-L96', '_global.msearch.Response': '_global/msearch/MultiSearchResponse.ts#L25-L27', -'_global.msearch.ResponseItem': '_global/msearch/types.ts#L209-L212', +'_global.msearch.ResponseItem': '_global/msearch/types.ts#L208-L211', '_global.msearch_template.Request': '_global/msearch_template/MultiSearchTemplateRequest.ts#L25-L70', '_global.msearch_template.Response': '_global/msearch_template/MultiSearchTemplateResponse.ts#L22-L24', '_global.msearch_template.TemplateConfig': '_global/msearch_template/types.ts#L28-L54', @@ -182,6 +182,7 @@ '_global.search._types.InnerHits': '_global/search/_types/hits.ts#L106-L140', '_global.search._types.InnerHitsResult': '_global/search/_types/hits.ts#L84-L86', '_global.search._types.LaplaceSmoothingModel': '_global/search/_types/suggester.ts#L427-L432', +'_global.search._types.LearningToRank': '_global/search/_types/rescoring.ts#L88-L97', '_global.search._types.LinearInterpolationSmoothingModel': '_global/search/_types/suggester.ts#L434-L438', '_global.search._types.NestedIdentity': '_global/search/_types/hits.ts#L88-L92', '_global.search._types.PhraseSuggest': '_global/search/_types/suggester.ts#L57-L62', @@ -195,9 +196,9 @@ '_global.search._types.QueryBreakdown': '_global/search/_types/profile.ts#L97-L116', '_global.search._types.QueryProfile': '_global/search/_types/profile.ts#L118-L124', '_global.search._types.RegexOptions': '_global/search/_types/suggester.ts#L180-L191', -'_global.search._types.Rescore': '_global/search/_types/rescoring.ts#L23-L26', -'_global.search._types.RescoreQuery': '_global/search/_types/rescoring.ts#L28-L50', -'_global.search._types.ScoreMode': '_global/search/_types/rescoring.ts#L52-L74', +'_global.search._types.Rescore': '_global/search/_types/rescoring.ts#L25-L38', +'_global.search._types.RescoreQuery': '_global/search/_types/rescoring.ts#L40-L62', +'_global.search._types.ScoreMode': '_global/search/_types/rescoring.ts#L64-L86', '_global.search._types.SearchProfile': '_global/search/_types/profile.ts#L126-L130', '_global.search._types.ShardProfile': '_global/search/_types/profile.ts#L132-L137', '_global.search._types.SmoothingModelContainer': '_global/search/_types/suggester.ts#L442-L458', @@ -357,22 +358,22 @@ '_types.WktGeoBounds': '_types/Geo.ts#L150-L152', '_types.WriteResponseBase': '_types/Base.ts#L36-L45', '_types.aggregations.AdjacencyMatrixAggregate': '_types/aggregations/Aggregate.ts#L573-L575', -'_types.aggregations.AdjacencyMatrixAggregation': '_types/aggregations/bucket.ts#L57-L63', +'_types.aggregations.AdjacencyMatrixAggregation': '_types/aggregations/bucket.ts#L55-L61', '_types.aggregations.AdjacencyMatrixBucket': '_types/aggregations/Aggregate.ts#L577-L579', '_types.aggregations.Aggregate': '_types/aggregations/Aggregate.ts#L38-L123', '_types.aggregations.AggregateBase': '_types/aggregations/Aggregate.ts#L134-L136', -'_types.aggregations.Aggregation': '_types/aggregations/Aggregation.ts#L22-L25', -'_types.aggregations.AggregationContainer': '_types/aggregations/AggregationContainer.ts#L106-L515', -'_types.aggregations.AggregationRange': '_types/aggregations/bucket.ts#L672-L685', +'_types.aggregations.Aggregation': '_types/aggregations/Aggregation.ts#L20-L20', +'_types.aggregations.AggregationContainer': '_types/aggregations/AggregationContainer.ts#L105-L514', +'_types.aggregations.AggregationRange': '_types/aggregations/bucket.ts#L670-L683', '_types.aggregations.ArrayPercentilesItem': '_types/aggregations/Aggregate.ts#L160-L164', '_types.aggregations.AutoDateHistogramAggregate': '_types/aggregations/Aggregate.ts#L356-L360', -'_types.aggregations.AutoDateHistogramAggregation': '_types/aggregations/bucket.ts#L65-L100', +'_types.aggregations.AutoDateHistogramAggregation': '_types/aggregations/bucket.ts#L63-L98', '_types.aggregations.AverageAggregation': '_types/aggregations/metric.ts#L55-L55', '_types.aggregations.AverageBucketAggregation': '_types/aggregations/pipeline.ts#L78-L78', '_types.aggregations.AvgAggregate': '_types/aggregations/Aggregate.ts#L209-L210', '_types.aggregations.BoxPlotAggregate': '_types/aggregations/Aggregate.ts#L706-L722', '_types.aggregations.BoxplotAggregation': '_types/aggregations/metric.ts#L57-L62', -'_types.aggregations.BucketAggregationBase': '_types/aggregations/bucket.ts#L50-L55', +'_types.aggregations.BucketAggregationBase': '_types/aggregations/bucket.ts#L48-L53', '_types.aggregations.BucketCorrelationAggregation': '_types/aggregations/pipeline.ts#L129-L135', '_types.aggregations.BucketCorrelationFunction': '_types/aggregations/pipeline.ts#L137-L142', '_types.aggregations.BucketCorrelationFunctionCountCorrelation': '_types/aggregations/pipeline.ts#L144-L147', @@ -385,66 +386,66 @@ '_types.aggregations.BucketSortAggregation': '_types/aggregations/pipeline.ts#L169-L190', '_types.aggregations.Buckets': '_types/aggregations/Aggregate.ts#L316-L325', '_types.aggregations.BucketsPath': '_types/aggregations/pipeline.ts#L53-L59', -'_types.aggregations.CalendarInterval': '_types/aggregations/bucket.ts#L249-L266', +'_types.aggregations.CalendarInterval': '_types/aggregations/bucket.ts#L247-L264', '_types.aggregations.CardinalityAggregate': '_types/aggregations/Aggregate.ts#L138-L141', '_types.aggregations.CardinalityAggregation': '_types/aggregations/metric.ts#L87-L99', '_types.aggregations.CardinalityExecutionMode': '_types/aggregations/metric.ts#L64-L85', -'_types.aggregations.CategorizeTextAggregation': '_types/aggregations/bucket.ts#L1037-L1101', -'_types.aggregations.CategorizeTextAnalyzer': '_types/aggregations/bucket.ts#L1103-L1106', -'_types.aggregations.ChiSquareHeuristic': '_types/aggregations/bucket.ts#L735-L744', +'_types.aggregations.CategorizeTextAggregation': '_types/aggregations/bucket.ts#L1036-L1100', +'_types.aggregations.CategorizeTextAnalyzer': '_types/aggregations/bucket.ts#L1102-L1105', +'_types.aggregations.ChiSquareHeuristic': '_types/aggregations/bucket.ts#L733-L742', '_types.aggregations.ChildrenAggregate': '_types/aggregations/Aggregate.ts#L776-L777', -'_types.aggregations.ChildrenAggregation': '_types/aggregations/bucket.ts#L111-L116', +'_types.aggregations.ChildrenAggregation': '_types/aggregations/bucket.ts#L109-L114', '_types.aggregations.CompositeAggregate': '_types/aggregations/Aggregate.ts#L618-L623', -'_types.aggregations.CompositeAggregation': '_types/aggregations/bucket.ts#L120-L136', -'_types.aggregations.CompositeAggregationBase': '_types/aggregations/bucket.ts#L157-L166', -'_types.aggregations.CompositeAggregationSource': '_types/aggregations/bucket.ts#L138-L155', +'_types.aggregations.CompositeAggregation': '_types/aggregations/bucket.ts#L118-L134', +'_types.aggregations.CompositeAggregationBase': '_types/aggregations/bucket.ts#L155-L164', +'_types.aggregations.CompositeAggregationSource': '_types/aggregations/bucket.ts#L136-L153', '_types.aggregations.CompositeBucket': '_types/aggregations/Aggregate.ts#L625-L627', -'_types.aggregations.CompositeDateHistogramAggregation': '_types/aggregations/bucket.ts#L174-L182', -'_types.aggregations.CompositeGeoTileGridAggregation': '_types/aggregations/bucket.ts#L184-L187', -'_types.aggregations.CompositeHistogramAggregation': '_types/aggregations/bucket.ts#L170-L172', -'_types.aggregations.CompositeTermsAggregation': '_types/aggregations/bucket.ts#L168-L168', +'_types.aggregations.CompositeDateHistogramAggregation': '_types/aggregations/bucket.ts#L172-L180', +'_types.aggregations.CompositeGeoTileGridAggregation': '_types/aggregations/bucket.ts#L182-L185', +'_types.aggregations.CompositeHistogramAggregation': '_types/aggregations/bucket.ts#L168-L170', +'_types.aggregations.CompositeTermsAggregation': '_types/aggregations/bucket.ts#L166-L166', '_types.aggregations.CumulativeCardinalityAggregate': '_types/aggregations/Aggregate.ts#L747-L755', '_types.aggregations.CumulativeCardinalityAggregation': '_types/aggregations/pipeline.ts#L192-L192', '_types.aggregations.CumulativeSumAggregation': '_types/aggregations/pipeline.ts#L194-L194', -'_types.aggregations.CustomCategorizeTextAnalyzer': '_types/aggregations/bucket.ts#L1108-L1112', +'_types.aggregations.CustomCategorizeTextAnalyzer': '_types/aggregations/bucket.ts#L1107-L1111', '_types.aggregations.DateHistogramAggregate': '_types/aggregations/Aggregate.ts#L348-L349', -'_types.aggregations.DateHistogramAggregation': '_types/aggregations/bucket.ts#L189-L247', +'_types.aggregations.DateHistogramAggregation': '_types/aggregations/bucket.ts#L187-L245', '_types.aggregations.DateHistogramBucket': '_types/aggregations/Aggregate.ts#L351-L354', '_types.aggregations.DateRangeAggregate': '_types/aggregations/Aggregate.ts#L543-L548', -'_types.aggregations.DateRangeAggregation': '_types/aggregations/bucket.ts#L268-L294', -'_types.aggregations.DateRangeExpression': '_types/aggregations/bucket.ts#L305-L318', +'_types.aggregations.DateRangeAggregation': '_types/aggregations/bucket.ts#L266-L292', +'_types.aggregations.DateRangeExpression': '_types/aggregations/bucket.ts#L303-L316', '_types.aggregations.DerivativeAggregate': '_types/aggregations/Aggregate.ts#L227-L231', '_types.aggregations.DerivativeAggregation': '_types/aggregations/pipeline.ts#L196-L196', -'_types.aggregations.DiversifiedSamplerAggregation': '_types/aggregations/bucket.ts#L320-L341', +'_types.aggregations.DiversifiedSamplerAggregation': '_types/aggregations/bucket.ts#L318-L339', '_types.aggregations.DoubleTermsAggregate': '_types/aggregations/Aggregate.ts#L411-L416', '_types.aggregations.DoubleTermsBucket': '_types/aggregations/Aggregate.ts#L418-L421', '_types.aggregations.EwmaModelSettings': '_types/aggregations/pipeline.ts#L267-L269', '_types.aggregations.EwmaMovingAverageAggregation': '_types/aggregations/pipeline.ts#L252-L255', -'_types.aggregations.ExtendedBounds': '_types/aggregations/bucket.ts#L489-L498', +'_types.aggregations.ExtendedBounds': '_types/aggregations/bucket.ts#L487-L496', '_types.aggregations.ExtendedStatsAggregate': '_types/aggregations/Aggregate.ts#L278-L296', '_types.aggregations.ExtendedStatsAggregation': '_types/aggregations/metric.ts#L101-L106', '_types.aggregations.ExtendedStatsBucketAggregate': '_types/aggregations/Aggregate.ts#L298-L299', '_types.aggregations.ExtendedStatsBucketAggregation': '_types/aggregations/pipeline.ts#L198-L203', -'_types.aggregations.FieldDateMath': '_types/aggregations/bucket.ts#L296-L303', +'_types.aggregations.FieldDateMath': '_types/aggregations/bucket.ts#L294-L301', '_types.aggregations.FilterAggregate': '_types/aggregations/Aggregate.ts#L495-L496', '_types.aggregations.FiltersAggregate': '_types/aggregations/Aggregate.ts#L568-L569', -'_types.aggregations.FiltersAggregation': '_types/aggregations/bucket.ts#L358-L378', +'_types.aggregations.FiltersAggregation': '_types/aggregations/bucket.ts#L356-L376', '_types.aggregations.FiltersBucket': '_types/aggregations/Aggregate.ts#L571-L571', '_types.aggregations.FormatMetricAggregationBase': '_types/aggregations/metric.ts#L47-L49', '_types.aggregations.FormattableMetricAggregation': '_types/aggregations/metric.ts#L51-L53', '_types.aggregations.FrequentItemSetsAggregate': '_types/aggregations/Aggregate.ts#L639-L640', -'_types.aggregations.FrequentItemSetsAggregation': '_types/aggregations/bucket.ts#L1159-L1183', +'_types.aggregations.FrequentItemSetsAggregation': '_types/aggregations/bucket.ts#L1158-L1182', '_types.aggregations.FrequentItemSetsBucket': '_types/aggregations/Aggregate.ts#L642-L645', -'_types.aggregations.FrequentItemSetsField': '_types/aggregations/bucket.ts#L1145-L1157', +'_types.aggregations.FrequentItemSetsField': '_types/aggregations/bucket.ts#L1144-L1156', '_types.aggregations.GapPolicy': '_types/aggregations/pipeline.ts#L61-L76', '_types.aggregations.GeoBoundsAggregate': '_types/aggregations/Aggregate.ts#L303-L306', '_types.aggregations.GeoBoundsAggregation': '_types/aggregations/metric.ts#L108-L114', '_types.aggregations.GeoCentroidAggregate': '_types/aggregations/Aggregate.ts#L308-L312', '_types.aggregations.GeoCentroidAggregation': '_types/aggregations/metric.ts#L116-L119', '_types.aggregations.GeoDistanceAggregate': '_types/aggregations/Aggregate.ts#L550-L554', -'_types.aggregations.GeoDistanceAggregation': '_types/aggregations/bucket.ts#L380-L403', +'_types.aggregations.GeoDistanceAggregation': '_types/aggregations/bucket.ts#L378-L401', '_types.aggregations.GeoHashGridAggregate': '_types/aggregations/Aggregate.ts#L506-L508', -'_types.aggregations.GeoHashGridAggregation': '_types/aggregations/bucket.ts#L405-L430', +'_types.aggregations.GeoHashGridAggregation': '_types/aggregations/bucket.ts#L403-L428', '_types.aggregations.GeoHashGridBucket': '_types/aggregations/Aggregate.ts#L510-L512', '_types.aggregations.GeoHexGridAggregate': '_types/aggregations/Aggregate.ts#L522-L523', '_types.aggregations.GeoHexGridBucket': '_types/aggregations/Aggregate.ts#L525-L527', @@ -453,17 +454,17 @@ '_types.aggregations.GeoLinePoint': '_types/aggregations/metric.ts#L155-L160', '_types.aggregations.GeoLineSort': '_types/aggregations/metric.ts#L148-L153', '_types.aggregations.GeoTileGridAggregate': '_types/aggregations/Aggregate.ts#L514-L516', -'_types.aggregations.GeoTileGridAggregation': '_types/aggregations/bucket.ts#L432-L458', +'_types.aggregations.GeoTileGridAggregation': '_types/aggregations/bucket.ts#L430-L456', '_types.aggregations.GeoTileGridBucket': '_types/aggregations/Aggregate.ts#L518-L520', -'_types.aggregations.GeohexGridAggregation': '_types/aggregations/bucket.ts#L460-L485', +'_types.aggregations.GeohexGridAggregation': '_types/aggregations/bucket.ts#L458-L483', '_types.aggregations.GlobalAggregate': '_types/aggregations/Aggregate.ts#L492-L493', -'_types.aggregations.GlobalAggregation': '_types/aggregations/bucket.ts#L487-L487', -'_types.aggregations.GoogleNormalizedDistanceHeuristic': '_types/aggregations/bucket.ts#L746-L751', +'_types.aggregations.GlobalAggregation': '_types/aggregations/bucket.ts#L485-L485', +'_types.aggregations.GoogleNormalizedDistanceHeuristic': '_types/aggregations/bucket.ts#L744-L749', '_types.aggregations.HdrMethod': '_types/aggregations/metric.ts#L216-L221', '_types.aggregations.HdrPercentileRanksAggregate': '_types/aggregations/Aggregate.ts#L169-L170', '_types.aggregations.HdrPercentilesAggregate': '_types/aggregations/Aggregate.ts#L166-L167', '_types.aggregations.HistogramAggregate': '_types/aggregations/Aggregate.ts#L340-L341', -'_types.aggregations.HistogramAggregation': '_types/aggregations/bucket.ts#L500-L546', +'_types.aggregations.HistogramAggregation': '_types/aggregations/bucket.ts#L498-L544', '_types.aggregations.HistogramBucket': '_types/aggregations/Aggregate.ts#L343-L346', '_types.aggregations.HoltLinearModelSettings': '_types/aggregations/pipeline.ts#L271-L274', '_types.aggregations.HoltMovingAverageAggregation': '_types/aggregations/pipeline.ts#L257-L260', @@ -477,11 +478,11 @@ '_types.aggregations.InferenceFeatureImportance': '_types/aggregations/Aggregate.ts#L678-L682', '_types.aggregations.InferenceTopClassEntry': '_types/aggregations/Aggregate.ts#L672-L676', '_types.aggregations.IpPrefixAggregate': '_types/aggregations/Aggregate.ts#L629-L630', -'_types.aggregations.IpPrefixAggregation': '_types/aggregations/bucket.ts#L1114-L1143', +'_types.aggregations.IpPrefixAggregation': '_types/aggregations/bucket.ts#L1113-L1142', '_types.aggregations.IpPrefixBucket': '_types/aggregations/Aggregate.ts#L632-L637', '_types.aggregations.IpRangeAggregate': '_types/aggregations/Aggregate.ts#L556-L558', -'_types.aggregations.IpRangeAggregation': '_types/aggregations/bucket.ts#L548-L557', -'_types.aggregations.IpRangeAggregationRange': '_types/aggregations/bucket.ts#L559-L572', +'_types.aggregations.IpRangeAggregation': '_types/aggregations/bucket.ts#L546-L555', +'_types.aggregations.IpRangeAggregationRange': '_types/aggregations/bucket.ts#L557-L570', '_types.aggregations.IpRangeBucket': '_types/aggregations/Aggregate.ts#L560-L564', '_types.aggregations.LinearMovingAverageAggregation': '_types/aggregations/pipeline.ts#L242-L245', '_types.aggregations.LongRareTermsAggregate': '_types/aggregations/Aggregate.ts#L431-L436', @@ -501,28 +502,28 @@ '_types.aggregations.MinAggregate': '_types/aggregations/Aggregate.ts#L197-L198', '_types.aggregations.MinAggregation': '_types/aggregations/metric.ts#L172-L172', '_types.aggregations.MinBucketAggregation': '_types/aggregations/pipeline.ts#L226-L226', -'_types.aggregations.MinimumInterval': '_types/aggregations/bucket.ts#L102-L109', +'_types.aggregations.MinimumInterval': '_types/aggregations/bucket.ts#L100-L107', '_types.aggregations.MissingAggregate': '_types/aggregations/Aggregate.ts#L483-L484', -'_types.aggregations.MissingAggregation': '_types/aggregations/bucket.ts#L574-L580', -'_types.aggregations.MissingOrder': '_types/aggregations/AggregationContainer.ts#L518-L522', +'_types.aggregations.MissingAggregation': '_types/aggregations/bucket.ts#L572-L578', +'_types.aggregations.MissingOrder': '_types/aggregations/AggregationContainer.ts#L517-L521', '_types.aggregations.MovingAverageAggregation': '_types/aggregations/pipeline.ts#L228-L234', '_types.aggregations.MovingAverageAggregationBase': '_types/aggregations/pipeline.ts#L236-L240', '_types.aggregations.MovingFunctionAggregation': '_types/aggregations/pipeline.ts#L288-L303', '_types.aggregations.MovingPercentilesAggregation': '_types/aggregations/pipeline.ts#L305-L317', '_types.aggregations.MultiBucketAggregateBase': '_types/aggregations/Aggregate.ts#L327-L329', '_types.aggregations.MultiBucketBase': '_types/aggregations/Aggregate.ts#L331-L338', -'_types.aggregations.MultiTermLookup': '_types/aggregations/bucket.ts#L624-L634', +'_types.aggregations.MultiTermLookup': '_types/aggregations/bucket.ts#L622-L632', '_types.aggregations.MultiTermsAggregate': '_types/aggregations/Aggregate.ts#L461-L463', -'_types.aggregations.MultiTermsAggregation': '_types/aggregations/bucket.ts#L582-L622', +'_types.aggregations.MultiTermsAggregation': '_types/aggregations/bucket.ts#L580-L620', '_types.aggregations.MultiTermsBucket': '_types/aggregations/Aggregate.ts#L465-L469', -'_types.aggregations.MutualInformationHeuristic': '_types/aggregations/bucket.ts#L753-L762', +'_types.aggregations.MutualInformationHeuristic': '_types/aggregations/bucket.ts#L751-L760', '_types.aggregations.NestedAggregate': '_types/aggregations/Aggregate.ts#L486-L487', -'_types.aggregations.NestedAggregation': '_types/aggregations/bucket.ts#L636-L641', +'_types.aggregations.NestedAggregation': '_types/aggregations/bucket.ts#L634-L639', '_types.aggregations.NormalizeAggregation': '_types/aggregations/pipeline.ts#L319-L324', '_types.aggregations.NormalizeMethod': '_types/aggregations/pipeline.ts#L326-L352', '_types.aggregations.ParentAggregate': '_types/aggregations/Aggregate.ts#L779-L780', -'_types.aggregations.ParentAggregation': '_types/aggregations/bucket.ts#L643-L648', -'_types.aggregations.PercentageScoreHeuristic': '_types/aggregations/bucket.ts#L764-L764', +'_types.aggregations.ParentAggregation': '_types/aggregations/bucket.ts#L641-L646', +'_types.aggregations.PercentageScoreHeuristic': '_types/aggregations/bucket.ts#L762-L762', '_types.aggregations.PercentileRanksAggregation': '_types/aggregations/metric.ts#L174-L193', '_types.aggregations.Percentiles': '_types/aggregations/Aggregate.ts#L150-L151', '_types.aggregations.PercentilesAggregateBase': '_types/aggregations/Aggregate.ts#L146-L148', @@ -531,18 +532,18 @@ '_types.aggregations.PercentilesBucketAggregation': '_types/aggregations/pipeline.ts#L354-L359', '_types.aggregations.PipelineAggregationBase': '_types/aggregations/pipeline.ts#L39-L51', '_types.aggregations.RangeAggregate': '_types/aggregations/Aggregate.ts#L531-L532', -'_types.aggregations.RangeAggregation': '_types/aggregations/bucket.ts#L650-L670', +'_types.aggregations.RangeAggregation': '_types/aggregations/bucket.ts#L648-L668', '_types.aggregations.RangeBucket': '_types/aggregations/Aggregate.ts#L534-L541', -'_types.aggregations.RareTermsAggregation': '_types/aggregations/bucket.ts#L687-L717', +'_types.aggregations.RareTermsAggregation': '_types/aggregations/bucket.ts#L685-L715', '_types.aggregations.RateAggregate': '_types/aggregations/Aggregate.ts#L741-L745', '_types.aggregations.RateAggregation': '_types/aggregations/metric.ts#L230-L241', '_types.aggregations.RateMode': '_types/aggregations/metric.ts#L243-L252', '_types.aggregations.ReverseNestedAggregate': '_types/aggregations/Aggregate.ts#L489-L490', -'_types.aggregations.ReverseNestedAggregation': '_types/aggregations/bucket.ts#L719-L725', +'_types.aggregations.ReverseNestedAggregation': '_types/aggregations/bucket.ts#L717-L723', '_types.aggregations.SamplerAggregate': '_types/aggregations/Aggregate.ts#L498-L499', -'_types.aggregations.SamplerAggregation': '_types/aggregations/bucket.ts#L727-L733', -'_types.aggregations.SamplerAggregationExecutionHint': '_types/aggregations/bucket.ts#L343-L356', -'_types.aggregations.ScriptedHeuristic': '_types/aggregations/bucket.ts#L766-L768', +'_types.aggregations.SamplerAggregation': '_types/aggregations/bucket.ts#L725-L731', +'_types.aggregations.SamplerAggregationExecutionHint': '_types/aggregations/bucket.ts#L341-L354', +'_types.aggregations.ScriptedHeuristic': '_types/aggregations/bucket.ts#L764-L766', '_types.aggregations.ScriptedMetricAggregate': '_types/aggregations/Aggregate.ts#L649-L652', '_types.aggregations.ScriptedMetricAggregation': '_types/aggregations/metric.ts#L254-L280', '_types.aggregations.SerialDifferencingAggregation': '_types/aggregations/pipeline.ts#L361-L367', @@ -551,9 +552,9 @@ '_types.aggregations.SignificantStringTermsAggregate': '_types/aggregations/Aggregate.ts#L602-L604', '_types.aggregations.SignificantStringTermsBucket': '_types/aggregations/Aggregate.ts#L606-L608', '_types.aggregations.SignificantTermsAggregateBase': '_types/aggregations/Aggregate.ts#L581-L586', -'_types.aggregations.SignificantTermsAggregation': '_types/aggregations/bucket.ts#L770-L834', +'_types.aggregations.SignificantTermsAggregation': '_types/aggregations/bucket.ts#L768-L832', '_types.aggregations.SignificantTermsBucketBase': '_types/aggregations/Aggregate.ts#L592-L595', -'_types.aggregations.SignificantTextAggregation': '_types/aggregations/bucket.ts#L836-L908', +'_types.aggregations.SignificantTextAggregation': '_types/aggregations/bucket.ts#L834-L906', '_types.aggregations.SimpleMovingAverageAggregation': '_types/aggregations/pipeline.ts#L247-L250', '_types.aggregations.SimpleValueAggregate': '_types/aggregations/Aggregate.ts#L224-L225', '_types.aggregations.SingleBucketAggregateBase': '_types/aggregations/Aggregate.ts#L473-L481', @@ -580,13 +581,13 @@ '_types.aggregations.TTestAggregation': '_types/aggregations/metric.ts#L294-L308', '_types.aggregations.TTestType': '_types/aggregations/metric.ts#L322-L335', '_types.aggregations.TermsAggregateBase': '_types/aggregations/Aggregate.ts#L377-L382', -'_types.aggregations.TermsAggregation': '_types/aggregations/bucket.ts#L910-L970', -'_types.aggregations.TermsAggregationCollectMode': '_types/aggregations/bucket.ts#L980-L989', -'_types.aggregations.TermsAggregationExecutionHint': '_types/aggregations/bucket.ts#L991-L996', +'_types.aggregations.TermsAggregation': '_types/aggregations/bucket.ts#L908-L968', +'_types.aggregations.TermsAggregationCollectMode': '_types/aggregations/bucket.ts#L978-L987', +'_types.aggregations.TermsAggregationExecutionHint': '_types/aggregations/bucket.ts#L989-L994', '_types.aggregations.TermsBucketBase': '_types/aggregations/Aggregate.ts#L391-L393', -'_types.aggregations.TermsExclude': '_types/aggregations/bucket.ts#L1001-L1002', -'_types.aggregations.TermsInclude': '_types/aggregations/bucket.ts#L998-L999', -'_types.aggregations.TermsPartition': '_types/aggregations/bucket.ts#L1004-L1013', +'_types.aggregations.TermsExclude': '_types/aggregations/bucket.ts#L999-L1000', +'_types.aggregations.TermsInclude': '_types/aggregations/bucket.ts#L996-L997', +'_types.aggregations.TermsPartition': '_types/aggregations/bucket.ts#L1002-L1011', '_types.aggregations.TestPopulation': '_types/aggregations/metric.ts#L310-L320', '_types.aggregations.TopHitsAggregate': '_types/aggregations/Aggregate.ts#L654-L657', '_types.aggregations.TopHitsAggregation': '_types/aggregations/metric.ts#L337-L392', @@ -602,7 +603,7 @@ '_types.aggregations.ValueCountAggregation': '_types/aggregations/metric.ts#L417-L417', '_types.aggregations.ValueType': '_types/aggregations/metric.ts#L419-L430', '_types.aggregations.VariableWidthHistogramAggregate': '_types/aggregations/Aggregate.ts#L362-L364', -'_types.aggregations.VariableWidthHistogramAggregation': '_types/aggregations/bucket.ts#L1015-L1035', +'_types.aggregations.VariableWidthHistogramAggregation': '_types/aggregations/bucket.ts#L1013-L1034', '_types.aggregations.VariableWidthHistogramBucket': '_types/aggregations/Aggregate.ts#L366-L373', '_types.aggregations.WeightedAverageAggregation': '_types/aggregations/metric.ts#L432-L446', '_types.aggregations.WeightedAverageValue': '_types/aggregations/metric.ts#L448-L458', @@ -628,7 +629,7 @@ '_types.analysis.ElisionTokenFilter': '_types/analysis/token_filters.ts#L187-L192', '_types.analysis.FingerprintAnalyzer': '_types/analysis/analyzers.ts#L37-L45', '_types.analysis.FingerprintTokenFilter': '_types/analysis/token_filters.ts#L194-L198', -'_types.analysis.HtmlStripCharFilter': '_types/analysis/char_filters.ts#L43-L45', +'_types.analysis.HtmlStripCharFilter': '_types/analysis/char_filters.ts#L43-L46', '_types.analysis.HunspellTokenFilter': '_types/analysis/token_filters.ts#L200-L206', '_types.analysis.HyphenationDecompounderTokenFilter': '_types/analysis/token_filters.ts#L58-L60', '_types.analysis.IcuAnalyzer': '_types/analysis/icu-plugin.ts#L67-L71', @@ -667,7 +668,7 @@ '_types.analysis.LowercaseNormalizer': '_types/analysis/normalizers.ts#L26-L28', '_types.analysis.LowercaseTokenFilter': '_types/analysis/token_filters.ts#L255-L258', '_types.analysis.LowercaseTokenizer': '_types/analysis/tokenizers.ts#L71-L73', -'_types.analysis.MappingCharFilter': '_types/analysis/char_filters.ts#L47-L51', +'_types.analysis.MappingCharFilter': '_types/analysis/char_filters.ts#L48-L52', '_types.analysis.MultiplexerTokenFilter': '_types/analysis/token_filters.ts#L260-L264', '_types.analysis.NGramTokenFilter': '_types/analysis/token_filters.ts#L266-L271', '_types.analysis.NGramTokenizer': '_types/analysis/tokenizers.ts#L39-L45', @@ -679,7 +680,7 @@ '_types.analysis.PathHierarchyTokenizer': '_types/analysis/tokenizers.ts#L89-L96', '_types.analysis.PatternAnalyzer': '_types/analysis/analyzers.ts#L74-L81', '_types.analysis.PatternCaptureTokenFilter': '_types/analysis/token_filters.ts#L278-L282', -'_types.analysis.PatternReplaceCharFilter': '_types/analysis/char_filters.ts#L53-L58', +'_types.analysis.PatternReplaceCharFilter': '_types/analysis/char_filters.ts#L54-L59', '_types.analysis.PatternReplaceTokenFilter': '_types/analysis/token_filters.ts#L284-L290', '_types.analysis.PatternTokenizer': '_types/analysis/tokenizers.ts#L98-L103', '_types.analysis.PhoneticEncoder': '_types/analysis/phonetic-plugin.ts#L23-L36', @@ -781,7 +782,7 @@ '_types.mapping.RoutingField': '_types/mapping/meta-fields.ts#L50-L52', '_types.mapping.RuntimeField': '_types/mapping/RuntimeFields.ts#L26-L48', '_types.mapping.RuntimeFieldFetchFields': '_types/mapping/RuntimeFields.ts#L50-L54', -'_types.mapping.RuntimeFieldType': '_types/mapping/RuntimeFields.ts#L56-L65', +'_types.mapping.RuntimeFieldType': '_types/mapping/RuntimeFields.ts#L56-L66', '_types.mapping.ScaledFloatNumberProperty': '_types/mapping/core.ts#L174-L178', '_types.mapping.SearchAsYouTypeProperty': '_types/mapping/core.ts#L198-L208', '_types.mapping.ShapeProperty': '_types/mapping/geo.ts#L73-L85', @@ -844,14 +845,14 @@ '_types.query_dsl.IntervalsQuery': '_types/query_dsl/fulltext.ts#L235-L263', '_types.query_dsl.IntervalsWildcard': '_types/query_dsl/fulltext.ts#L265-L280', '_types.query_dsl.Like': '_types/query_dsl/specialized.ts#L186-L191', -'_types.query_dsl.LikeDocument': '_types/query_dsl/specialized.ts#L165-L184', +'_types.query_dsl.LikeDocument': '_types/query_dsl/specialized.ts#L162-L184', '_types.query_dsl.MatchAllQuery': '_types/query_dsl/MatchAllQuery.ts#L22-L22', '_types.query_dsl.MatchBoolPrefixQuery': '_types/query_dsl/fulltext.ts#L349-L403', '_types.query_dsl.MatchNoneQuery': '_types/query_dsl/MatchNoneQuery.ts#L22-L22', '_types.query_dsl.MatchPhrasePrefixQuery': '_types/query_dsl/fulltext.ts#L428-L454', '_types.query_dsl.MatchPhraseQuery': '_types/query_dsl/fulltext.ts#L405-L426', '_types.query_dsl.MatchQuery': '_types/query_dsl/fulltext.ts#L282-L347', -'_types.query_dsl.MoreLikeThisQuery': '_types/query_dsl/specialized.ts#L78-L163', +'_types.query_dsl.MoreLikeThisQuery': '_types/query_dsl/specialized.ts#L78-L160', '_types.query_dsl.MultiMatchQuery': '_types/query_dsl/fulltext.ts#L456-L539', '_types.query_dsl.MultiValueMode': '_types/query_dsl/compound.ts#L343-L360', '_types.query_dsl.NestedQuery': '_types/query_dsl/joining.ts#L106-L130', @@ -1469,10 +1470,10 @@ 'indices.shard_stores.ShardStoreWrapper': 'indices/shard_stores/types.ts#L56-L58', 'indices.shrink.Request': 'indices/shrink/IndicesShrinkRequest.ts#L27-L75', 'indices.shrink.Response': 'indices/shrink/IndicesShrinkResponse.ts#L22-L28', -'indices.simulate_index_template.Request': 'indices/simulate_index_template/IndicesSimulateIndexTemplateRequest.ts#L33-L115', -'indices.simulate_index_template.Response': 'indices/simulate_index_template/IndicesSimulateIndexTemplateResponse.ts#L20-L22', +'indices.simulate_index_template.Request': 'indices/simulate_index_template/IndicesSimulateIndexTemplateRequest.ts#L24-L49', +'indices.simulate_index_template.Response': 'indices/simulate_index_template/IndicesSimulateIndexTemplateResponse.ts#L25-L30', 'indices.simulate_template.Overlapping': 'indices/simulate_template/IndicesSimulateTemplateResponse.ts#L39-L42', -'indices.simulate_template.Request': 'indices/simulate_template/IndicesSimulateTemplateRequest.ts#L25-L61', +'indices.simulate_template.Request': 'indices/simulate_template/IndicesSimulateTemplateRequest.ts#L27-L114', 'indices.simulate_template.Response': 'indices/simulate_template/IndicesSimulateTemplateResponse.ts#L26-L31', 'indices.simulate_template.Template': 'indices/simulate_template/IndicesSimulateTemplateResponse.ts#L33-L37', 'indices.split.Request': 'indices/split/IndicesSplitRequest.ts#L27-L74', @@ -1640,19 +1641,19 @@ 'ml._types.CategorizationAnalyzerDefinition': 'ml/_types/Analysis.ts#L184-L197', 'ml._types.CategorizationStatus': 'ml/_types/Model.ts#L83-L86', 'ml._types.Category': 'ml/_types/Category.ts#L23-L49', -'ml._types.ChunkingConfig': 'ml/_types/Datafeed.ts#L239-L252', -'ml._types.ChunkingMode': 'ml/_types/Datafeed.ts#L233-L237', +'ml._types.ChunkingConfig': 'ml/_types/Datafeed.ts#L238-L251', +'ml._types.ChunkingMode': 'ml/_types/Datafeed.ts#L232-L236', 'ml._types.ClassificationInferenceOptions': 'ml/_types/inference.ts#L93-L108', 'ml._types.ConditionOperator': 'ml/_types/Rule.ts#L74-L79', 'ml._types.DataCounts': 'ml/_types/Job.ts#L352-L372', 'ml._types.DataDescription': 'ml/_types/Job.ts#L374-L390', -'ml._types.Datafeed': 'ml/_types/Datafeed.ts#L37-L58', +'ml._types.Datafeed': 'ml/_types/Datafeed.ts#L36-L57', 'ml._types.DatafeedAuthorization': 'ml/_types/Authorization.ts#L31-L43', -'ml._types.DatafeedConfig': 'ml/_types/Datafeed.ts#L60-L117', -'ml._types.DatafeedRunningState': 'ml/_types/Datafeed.ts#L198-L212', -'ml._types.DatafeedState': 'ml/_types/Datafeed.ts#L133-L138', -'ml._types.DatafeedStats': 'ml/_types/Datafeed.ts#L140-L169', -'ml._types.DatafeedTimingStats': 'ml/_types/Datafeed.ts#L171-L196', +'ml._types.DatafeedConfig': 'ml/_types/Datafeed.ts#L59-L116', +'ml._types.DatafeedRunningState': 'ml/_types/Datafeed.ts#L197-L211', +'ml._types.DatafeedState': 'ml/_types/Datafeed.ts#L132-L137', +'ml._types.DatafeedStats': 'ml/_types/Datafeed.ts#L139-L168', +'ml._types.DatafeedTimingStats': 'ml/_types/Datafeed.ts#L170-L195', 'ml._types.DataframeAnalysis': 'ml/_types/DataframeAnalytics.ts#L134-L213', 'ml._types.DataframeAnalysisAnalyzedFields': 'ml/_types/DataframeAnalytics.ts#L238-L244', 'ml._types.DataframeAnalysisClassification': 'ml/_types/DataframeAnalytics.ts#L227-L236', @@ -1690,7 +1691,7 @@ 'ml._types.DataframeEvaluationRegressionMetricsHuber': 'ml/_types/DataframeEvaluation.ts#L117-L120', 'ml._types.DataframeEvaluationRegressionMetricsMsle': 'ml/_types/DataframeEvaluation.ts#L112-L115', 'ml._types.DataframeState': 'ml/_types/Dataframe.ts#L20-L26', -'ml._types.DelayedDataCheckConfig': 'ml/_types/Datafeed.ts#L119-L130', +'ml._types.DelayedDataCheckConfig': 'ml/_types/Datafeed.ts#L118-L129', 'ml._types.DeploymentAllocationState': 'ml/_types/TrainedModel.ts#L289-L302', 'ml._types.DeploymentAssignmentState': 'ml/_types/TrainedModel.ts#L304-L309', 'ml._types.DeploymentState': 'ml/_types/TrainedModel.ts#L274-L287', @@ -1745,7 +1746,7 @@ 'ml._types.RoutingState': 'ml/_types/TrainedModel.ts#L351-L372', 'ml._types.RuleAction': 'ml/_types/Rule.ts#L41-L50', 'ml._types.RuleCondition': 'ml/_types/Rule.ts#L52-L65', -'ml._types.RunningStateSearchInterval': 'ml/_types/Datafeed.ts#L214-L231', +'ml._types.RunningStateSearchInterval': 'ml/_types/Datafeed.ts#L213-L230', 'ml._types.SnapshotUpgradeState': 'ml/_types/Model.ts#L94-L99', 'ml._types.TextClassificationInferenceOptions': 'ml/_types/inference.ts#L189-L199', 'ml._types.TextClassificationInferenceUpdateOptions': 'ml/_types/inference.ts#L363-L372', @@ -2711,10 +2712,10 @@ if (hash.length > 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/76da5bd28f23df7f75a6c16eead9e75045f6f7bb/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/21f5860b8119dcc2e1fdecb371c64c647e5bad07/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/ilm/ElasticsearchIlmAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ElasticsearchIlmAsyncClient.java index d574df141..97b56770b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ElasticsearchIlmAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ElasticsearchIlmAsyncClient.java @@ -312,6 +312,19 @@ public final CompletableFuture putLifecycle( return putLifecycle(fn.apply(new PutLifecycleRequest.Builder()).build()); } + /** + * Creates a lifecycle policy + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture putLifecycle() { + return this.transport.performRequestAsync(new PutLifecycleRequest.Builder().build(), + PutLifecycleRequest._ENDPOINT, this.transportOptions); + } + // ----- Endpoint: ilm.remove_policy /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ElasticsearchIlmClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ElasticsearchIlmClient.java index b8d8d5bf7..c485b8c36 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ElasticsearchIlmClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ElasticsearchIlmClient.java @@ -321,6 +321,19 @@ public final PutLifecycleResponse putLifecycle( return putLifecycle(fn.apply(new PutLifecycleRequest.Builder()).build()); } + /** + * Creates a lifecycle policy + * + * @see Documentation + * on elastic.co + */ + + public PutLifecycleResponse putLifecycle() throws IOException, ElasticsearchException { + return this.transport.performRequest(new PutLifecycleRequest.Builder().build(), PutLifecycleRequest._ENDPOINT, + this.transportOptions); + } + // ----- Endpoint: ilm.remove_policy /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/PutLifecycleRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/PutLifecycleRequest.java index 5766c5f74..d2e40f9ac 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/PutLifecycleRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/PutLifecycleRequest.java @@ -30,7 +30,6 @@ 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 jakarta.json.stream.JsonGenerator; import java.lang.String; @@ -69,6 +68,7 @@ public class PutLifecycleRequest extends RequestBase implements JsonpSerializabl @Nullable private final Time masterTimeout; + @Nullable private final String name; @Nullable @@ -82,7 +82,7 @@ public class PutLifecycleRequest extends RequestBase implements JsonpSerializabl private PutLifecycleRequest(Builder builder) { this.masterTimeout = builder.masterTimeout; - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.name = builder.name; this.policy = builder.policy; this.timeout = builder.timeout; @@ -104,10 +104,11 @@ public final Time masterTimeout() { } /** - * Required - Identifier for the policy. + * Identifier for the policy. *

* API name: {@code policy} */ + @Nullable public final String name() { return this.name; } @@ -162,6 +163,7 @@ public static class Builder extends RequestBase.AbstractBuilder @Nullable private Time masterTimeout; + @Nullable private String name; @Nullable @@ -192,11 +194,11 @@ public final Builder masterTimeout(Function> f } /** - * Required - Identifier for the policy. + * Identifier for the policy. *

* API name: {@code policy} */ - public final Builder name(String value) { + public final Builder name(@Nullable String value) { this.name = value; return this; } @@ -289,7 +291,8 @@ protected static void setupPutLifecycleRequestDeserializer(ObjectDeserializerAPI * specification */ -@JsonpDeserializable -public class SimulateIndexTemplateRequest extends RequestBase implements JsonpSerializable { - private final Map meta; - - @Nullable - private final Boolean allowAutoCreate; - - private final List composedOf; - - @Nullable - private final Boolean create; - - @Nullable - private final DataStreamVisibility dataStream; +public class SimulateIndexTemplateRequest extends RequestBase { @Nullable private final Boolean includeDefaults; - private final List indexPatterns; - @Nullable private final Time masterTimeout; private final String name; - @Nullable - private final Integer priority; - - @Nullable - private final IndexTemplateMapping template; - - @Nullable - private final Long version; - // --------------------------------------------------------------------------------------------- private SimulateIndexTemplateRequest(Builder builder) { - this.meta = ApiTypeHelper.unmodifiable(builder.meta); - this.allowAutoCreate = builder.allowAutoCreate; - this.composedOf = ApiTypeHelper.unmodifiable(builder.composedOf); - this.create = builder.create; - this.dataStream = builder.dataStream; this.includeDefaults = builder.includeDefaults; - this.indexPatterns = ApiTypeHelper.unmodifiable(builder.indexPatterns); this.masterTimeout = builder.masterTimeout; this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.priority = builder.priority; - this.template = builder.template; - this.version = builder.version; } @@ -126,68 +86,6 @@ public static SimulateIndexTemplateRequest of(Function - * API name: {@code _meta} - */ - public final Map meta() { - return this.meta; - } - - /** - * This setting overrides the value of the action.auto_create_index - * cluster setting. If set to true in a template, then indices can - * be automatically created using that template even if auto-creation of indices - * is disabled via actions.auto_create_index. If set to - * false, then indices or data streams matching the template must - * always be explicitly created, and may never be automatically created. - *

- * API name: {@code allow_auto_create} - */ - @Nullable - public final Boolean allowAutoCreate() { - return this.allowAutoCreate; - } - - /** - * An ordered list of component template names. Component templates are merged - * in the order specified, meaning that the last component template specified - * has the highest precedence. - *

- * API name: {@code composed_of} - */ - public final List composedOf() { - return this.composedOf; - } - - /** - * If true, the template passed in the body is only used if no - * existing templates match the same index patterns. If false, the - * simulation uses the template with the highest priority. Note that the - * template is not permanently added or updated in either case; it is only used - * for the simulation. - *

- * API name: {@code create} - */ - @Nullable - public final Boolean create() { - return this.create; - } - - /** - * If this object is included, the template is used to create data streams and - * their backing indices. Supports an empty object. Data streams require a - * matching index template with a data_stream object. - *

- * API name: {@code data_stream} - */ - @Nullable - public final DataStreamVisibility dataStream() { - return this.dataStream; - } - /** * If true, returns all relevant default configurations for the index template. *

@@ -198,16 +96,6 @@ public final Boolean includeDefaults() { return this.includeDefaults; } - /** - * Array of wildcard (*) expressions used to match the names of - * data streams and indices during creation. - *

- * API name: {@code index_patterns} - */ - public final List indexPatterns() { - return this.indexPatterns; - } - /** * 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. @@ -220,7 +108,7 @@ public final Time masterTimeout() { } /** - * Required - Index or template name to simulate + * Required - Name of the index to simulate *

* API name: {@code name} */ @@ -228,112 +116,6 @@ public final String name() { return this.name; } - /** - * Priority to determine index template precedence when a new data stream or - * index is created. The index template with the highest priority is chosen. If - * no priority is specified the template is treated as though it is of priority - * 0 (lowest priority). This number is not automatically generated by - * Elasticsearch. - *

- * API name: {@code priority} - */ - @Nullable - public final Integer priority() { - return this.priority; - } - - /** - * Template to be applied. It may optionally include an aliases, - * mappings, or settings configuration. - *

- * API name: {@code template} - */ - @Nullable - public final IndexTemplateMapping template() { - return this.template; - } - - /** - * Version number used to manage index templates externally. This number is not - * automatically generated by Elasticsearch. - *

- * API name: {@code version} - */ - @Nullable - public final Long version() { - return this.version; - } - - /** - * 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.meta)) { - generator.writeKey("_meta"); - generator.writeStartObject(); - for (Map.Entry item0 : this.meta.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.allowAutoCreate != null) { - generator.writeKey("allow_auto_create"); - generator.write(this.allowAutoCreate); - - } - if (ApiTypeHelper.isDefined(this.composedOf)) { - generator.writeKey("composed_of"); - generator.writeStartArray(); - for (String item0 : this.composedOf) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (this.dataStream != null) { - generator.writeKey("data_stream"); - this.dataStream.serialize(generator, mapper); - - } - if (ApiTypeHelper.isDefined(this.indexPatterns)) { - generator.writeKey("index_patterns"); - generator.writeStartArray(); - for (String item0 : this.indexPatterns) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (this.priority != null) { - generator.writeKey("priority"); - generator.write(this.priority); - - } - if (this.template != null) { - generator.writeKey("template"); - this.template.serialize(generator, mapper); - - } - if (this.version != null) { - generator.writeKey("version"); - generator.write(this.version); - - } - - } - // --------------------------------------------------------------------------------------------- /** @@ -343,148 +125,14 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { - @Nullable - private Map meta; - - @Nullable - private Boolean allowAutoCreate; - - @Nullable - private List composedOf; - - @Nullable - private Boolean create; - - @Nullable - private DataStreamVisibility dataStream; - @Nullable private Boolean includeDefaults; - @Nullable - private List indexPatterns; - @Nullable private Time masterTimeout; private String name; - @Nullable - private Integer priority; - - @Nullable - private IndexTemplateMapping template; - - @Nullable - private Long version; - - /** - * Optional user metadata about the index template. May have any contents. This - * map is not automatically generated by Elasticsearch. - *

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

- * Adds all entries of map to meta. - */ - public final Builder meta(Map map) { - this.meta = _mapPutAll(this.meta, map); - return this; - } - - /** - * Optional user metadata about the index template. May have any contents. This - * map is not automatically generated by Elasticsearch. - *

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

- * Adds an entry to meta. - */ - public final Builder meta(String key, JsonData value) { - this.meta = _mapPut(this.meta, key, value); - return this; - } - - /** - * This setting overrides the value of the action.auto_create_index - * cluster setting. If set to true in a template, then indices can - * be automatically created using that template even if auto-creation of indices - * is disabled via actions.auto_create_index. If set to - * false, then indices or data streams matching the template must - * always be explicitly created, and may never be automatically created. - *

- * API name: {@code allow_auto_create} - */ - public final Builder allowAutoCreate(@Nullable Boolean value) { - this.allowAutoCreate = value; - return this; - } - - /** - * An ordered list of component template names. Component templates are merged - * in the order specified, meaning that the last component template specified - * has the highest precedence. - *

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

- * Adds all elements of list to composedOf. - */ - public final Builder composedOf(List list) { - this.composedOf = _listAddAll(this.composedOf, list); - return this; - } - - /** - * An ordered list of component template names. Component templates are merged - * in the order specified, meaning that the last component template specified - * has the highest precedence. - *

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

- * Adds one or more values to composedOf. - */ - public final Builder composedOf(String value, String... values) { - this.composedOf = _listAdd(this.composedOf, value, values); - return this; - } - - /** - * If true, the template passed in the body is only used if no - * existing templates match the same index patterns. If false, the - * simulation uses the template with the highest priority. Note that the - * template is not permanently added or updated in either case; it is only used - * for the simulation. - *

- * API name: {@code create} - */ - public final Builder create(@Nullable Boolean value) { - this.create = value; - return this; - } - - /** - * If this object is included, the template is used to create data streams and - * their backing indices. Supports an empty object. Data streams require a - * matching index template with a data_stream object. - *

- * API name: {@code data_stream} - */ - public final Builder dataStream(@Nullable DataStreamVisibility value) { - this.dataStream = value; - return this; - } - - /** - * If this object is included, the template is used to create data streams and - * their backing indices. Supports an empty object. Data streams require a - * matching index template with a data_stream object. - *

- * API name: {@code data_stream} - */ - public final Builder dataStream( - Function> fn) { - return this.dataStream(fn.apply(new DataStreamVisibility.Builder()).build()); - } - /** * If true, returns all relevant default configurations for the index template. *

@@ -495,32 +143,6 @@ public final Builder includeDefaults(@Nullable Boolean value) { return this; } - /** - * Array of wildcard (*) expressions used to match the names of - * data streams and indices during creation. - *

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

- * Adds all elements of list to indexPatterns. - */ - public final Builder indexPatterns(List list) { - this.indexPatterns = _listAddAll(this.indexPatterns, list); - return this; - } - - /** - * Array of wildcard (*) expressions used to match the names of - * data streams and indices during creation. - *

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

- * Adds one or more values to indexPatterns. - */ - public final Builder indexPatterns(String value, String... values) { - this.indexPatterns = _listAdd(this.indexPatterns, value, values); - 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. @@ -543,7 +165,7 @@ public final Builder masterTimeout(Function> f } /** - * Required - Index or template name to simulate + * Required - Name of the index to simulate *

* API name: {@code name} */ @@ -552,52 +174,6 @@ public final Builder name(String value) { return this; } - /** - * Priority to determine index template precedence when a new data stream or - * index is created. The index template with the highest priority is chosen. If - * no priority is specified the template is treated as though it is of priority - * 0 (lowest priority). This number is not automatically generated by - * Elasticsearch. - *

- * API name: {@code priority} - */ - public final Builder priority(@Nullable Integer value) { - this.priority = value; - return this; - } - - /** - * Template to be applied. It may optionally include an aliases, - * mappings, or settings configuration. - *

- * API name: {@code template} - */ - public final Builder template(@Nullable IndexTemplateMapping value) { - this.template = value; - return this; - } - - /** - * Template to be applied. It may optionally include an aliases, - * mappings, or settings configuration. - *

- * API name: {@code template} - */ - public final Builder template(Function> fn) { - return this.template(fn.apply(new IndexTemplateMapping.Builder()).build()); - } - - /** - * Version number used to manage index templates externally. This number is not - * automatically generated by Elasticsearch. - *

- * API name: {@code version} - */ - public final Builder version(@Nullable Long value) { - this.version = value; - return this; - } - @Override protected Builder self() { return this; @@ -618,30 +194,6 @@ public SimulateIndexTemplateRequest build() { // --------------------------------------------------------------------------------------------- - /** - * Json deserializer for {@link SimulateIndexTemplateRequest} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, SimulateIndexTemplateRequest::setupSimulateIndexTemplateRequestDeserializer); - - protected static void setupSimulateIndexTemplateRequestDeserializer( - ObjectDeserializer op) { - - op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); - op.add(Builder::allowAutoCreate, JsonpDeserializer.booleanDeserializer(), "allow_auto_create"); - op.add(Builder::composedOf, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "composed_of"); - op.add(Builder::dataStream, DataStreamVisibility._DESERIALIZER, "data_stream"); - op.add(Builder::indexPatterns, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "index_patterns"); - op.add(Builder::priority, JsonpDeserializer.integerDeserializer(), "priority"); - op.add(Builder::template, IndexTemplateMapping._DESERIALIZER, "template"); - op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); - - } - - // --------------------------------------------------------------------------------------------- - /** * Endpoint "{@code indices.simulate_index_template}". */ @@ -695,13 +247,10 @@ protected static void setupSimulateIndexTemplateRequestDeserializer( if (request.masterTimeout != null) { params.put("master_timeout", request.masterTimeout._toJsonString()); } - if (request.create != null) { - params.put("create", String.valueOf(request.create)); - } if (request.includeDefaults != null) { params.put("include_defaults", String.valueOf(request.includeDefaults)); } return params; - }, SimpleEndpoint.emptyMap(), true, SimulateIndexTemplateResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, SimulateIndexTemplateResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateIndexTemplateResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateIndexTemplateResponse.java index ddc66e621..b53fc70d9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateIndexTemplateResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateIndexTemplateResponse.java @@ -19,13 +19,23 @@ package co.elastic.clients.elasticsearch.indices; +import co.elastic.clients.elasticsearch.indices.simulate_template.Overlapping; +import co.elastic.clients.elasticsearch.indices.simulate_template.Template; 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; //---------------------------------------------------------------- // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. @@ -50,17 +60,160 @@ * "../doc-files/api-spec.html#indices.simulate_index_template.Response">API * specification */ +@JsonpDeserializable +public class SimulateIndexTemplateResponse implements JsonpSerializable { + private final List overlapping; -public class SimulateIndexTemplateResponse { - public SimulateIndexTemplateResponse() { + private final Template template; + + // --------------------------------------------------------------------------------------------- + + private SimulateIndexTemplateResponse(Builder builder) { + + this.overlapping = ApiTypeHelper.unmodifiable(builder.overlapping); + this.template = ApiTypeHelper.requireNonNull(builder.template, this, "template"); + + } + + public static SimulateIndexTemplateResponse of(Function> fn) { + return fn.apply(new Builder()).build(); } /** - * Singleton instance for {@link SimulateIndexTemplateResponse}. + * API name: {@code overlapping} */ - public static final SimulateIndexTemplateResponse _INSTANCE = new SimulateIndexTemplateResponse(); + public final List overlapping() { + return this.overlapping; + } + + /** + * Required - API name: {@code template} + */ + public final Template template() { + return this.template; + } + + /** + * 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.overlapping)) { + generator.writeKey("overlapping"); + generator.writeStartArray(); + for (Overlapping item0 : this.overlapping) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + generator.writeKey("template"); + this.template.serialize(generator, mapper); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .fixedValue(SimulateIndexTemplateResponse._INSTANCE); + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SimulateIndexTemplateResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private List overlapping; + + private Template template; + + /** + * API name: {@code overlapping} + *

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

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

+ * Adds a value to overlapping using a builder lambda. + */ + public final Builder overlapping(Function> fn) { + return overlapping(fn.apply(new Overlapping.Builder()).build()); + } + + /** + * Required - API name: {@code template} + */ + public final Builder template(Template value) { + this.template = value; + return this; + } + + /** + * Required - API name: {@code template} + */ + public final Builder template(Function> fn) { + return this.template(fn.apply(new Template.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link SimulateIndexTemplateResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SimulateIndexTemplateResponse build() { + _checkSingleUse(); + + return new SimulateIndexTemplateResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SimulateIndexTemplateResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SimulateIndexTemplateResponse::setupSimulateIndexTemplateResponseDeserializer); + + protected static void setupSimulateIndexTemplateResponseDeserializer( + ObjectDeserializer op) { + + op.add(Builder::overlapping, JsonpDeserializer.arrayDeserializer(Overlapping._DESERIALIZER), "overlapping"); + op.add(Builder::template, Template._DESERIALIZER, "template"); + + } } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateTemplateRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateTemplateRequest.java index c23ccef78..9da1d4386 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateTemplateRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateTemplateRequest.java @@ -22,6 +22,8 @@ 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.elasticsearch.indices.put_index_template.IndexTemplateMapping; +import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -33,10 +35,12 @@ import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; -import jakarta.json.stream.JsonParser; 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; @@ -69,29 +73,58 @@ */ @JsonpDeserializable public class SimulateTemplateRequest extends RequestBase implements JsonpSerializable { + private final Map meta; + + @Nullable + private final Boolean allowAutoCreate; + + private final List composedOf; + @Nullable private final Boolean create; + @Nullable + private final DataStreamVisibility dataStream; + + private final List ignoreMissingComponentTemplates; + @Nullable private final Boolean includeDefaults; + private final List indexPatterns; + @Nullable private final Time masterTimeout; @Nullable private final String name; - private final IndexTemplate template; + @Nullable + private final Integer priority; + + @Nullable + private final IndexTemplateMapping template; + + @Nullable + private final Long version; // --------------------------------------------------------------------------------------------- private SimulateTemplateRequest(Builder builder) { + this.meta = ApiTypeHelper.unmodifiable(builder.meta); + this.allowAutoCreate = builder.allowAutoCreate; + this.composedOf = ApiTypeHelper.unmodifiable(builder.composedOf); this.create = builder.create; + this.dataStream = builder.dataStream; + this.ignoreMissingComponentTemplates = ApiTypeHelper.unmodifiable(builder.ignoreMissingComponentTemplates); this.includeDefaults = builder.includeDefaults; + this.indexPatterns = ApiTypeHelper.unmodifiable(builder.indexPatterns); this.masterTimeout = builder.masterTimeout; this.name = builder.name; - this.template = ApiTypeHelper.requireNonNull(builder.template, this, "template"); + this.priority = builder.priority; + this.template = builder.template; + this.version = builder.version; } @@ -99,6 +132,42 @@ public static SimulateTemplateRequest of(Function + * API name: {@code _meta} + */ + public final Map meta() { + return this.meta; + } + + /** + * This setting overrides the value of the action.auto_create_index + * cluster setting. If set to true in a template, then indices can + * be automatically created using that template even if auto-creation of indices + * is disabled via actions.auto_create_index. If set to + * false, then indices or data streams matching the template must + * always be explicitly created, and may never be automatically created. + *

+ * API name: {@code allow_auto_create} + */ + @Nullable + public final Boolean allowAutoCreate() { + return this.allowAutoCreate; + } + + /** + * An ordered list of component template names. Component templates are merged + * in the order specified, meaning that the last component template specified + * has the highest precedence. + *

+ * API name: {@code composed_of} + */ + public final List composedOf() { + return this.composedOf; + } + /** * If true, the template passed in the body is only used if no existing * templates match the same index patterns. If false, the simulation uses the @@ -112,6 +181,28 @@ public final Boolean create() { return this.create; } + /** + * If this object is included, the template is used to create data streams and + * their backing indices. Supports an empty object. Data streams require a + * matching index template with a data_stream object. + *

+ * API name: {@code data_stream} + */ + @Nullable + public final DataStreamVisibility dataStream() { + return this.dataStream; + } + + /** + * The configuration option ignore_missing_component_templates can be used when + * an index template references a component template that might not exist + *

+ * API name: {@code ignore_missing_component_templates} + */ + public final List ignoreMissingComponentTemplates() { + return this.ignoreMissingComponentTemplates; + } + /** * If true, returns all relevant default configurations for the index template. *

@@ -122,6 +213,16 @@ public final Boolean includeDefaults() { return this.includeDefaults; } + /** + * Array of wildcard (*) expressions used to match the names of + * data streams and indices during creation. + *

+ * API name: {@code index_patterns} + */ + public final List indexPatterns() { + return this.indexPatterns; + } + /** * 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. @@ -146,17 +247,118 @@ public final String name() { } /** - * Required - Request body. + * Priority to determine index template precedence when a new data stream or + * index is created. The index template with the highest priority is chosen. If + * no priority is specified the template is treated as though it is of priority + * 0 (lowest priority). This number is not automatically generated by + * Elasticsearch. + *

+ * API name: {@code priority} + */ + @Nullable + public final Integer priority() { + return this.priority; + } + + /** + * Template to be applied. It may optionally include an aliases, + * mappings, or settings configuration. + *

+ * API name: {@code template} */ - public final IndexTemplate template() { + @Nullable + public final IndexTemplateMapping template() { return this.template; } /** - * Serialize this value to JSON. + * Version number used to manage index templates externally. This number is not + * automatically generated by Elasticsearch. + *

+ * API name: {@code version} + */ + @Nullable + public final Long version() { + return this.version; + } + + /** + * Serialize this object to JSON. */ public void serialize(JsonGenerator generator, JsonpMapper mapper) { - this.template.serialize(generator, mapper); + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (ApiTypeHelper.isDefined(this.meta)) { + generator.writeKey("_meta"); + generator.writeStartObject(); + for (Map.Entry item0 : this.meta.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (this.allowAutoCreate != null) { + generator.writeKey("allow_auto_create"); + generator.write(this.allowAutoCreate); + + } + if (ApiTypeHelper.isDefined(this.composedOf)) { + generator.writeKey("composed_of"); + generator.writeStartArray(); + for (String item0 : this.composedOf) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (this.dataStream != null) { + generator.writeKey("data_stream"); + this.dataStream.serialize(generator, mapper); + + } + if (ApiTypeHelper.isDefined(this.ignoreMissingComponentTemplates)) { + generator.writeKey("ignore_missing_component_templates"); + generator.writeStartArray(); + for (String item0 : this.ignoreMissingComponentTemplates) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.indexPatterns)) { + generator.writeKey("index_patterns"); + generator.writeStartArray(); + for (String item0 : this.indexPatterns) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (this.priority != null) { + generator.writeKey("priority"); + generator.write(this.priority); + + } + if (this.template != null) { + generator.writeKey("template"); + this.template.serialize(generator, mapper); + + } + if (this.version != null) { + generator.writeKey("version"); + generator.write(this.version); + + } } @@ -169,19 +371,113 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { + @Nullable + private Map meta; + + @Nullable + private Boolean allowAutoCreate; + + @Nullable + private List composedOf; + @Nullable private Boolean create; + @Nullable + private DataStreamVisibility dataStream; + + @Nullable + private List ignoreMissingComponentTemplates; + @Nullable private Boolean includeDefaults; + @Nullable + private List indexPatterns; + @Nullable private Time masterTimeout; @Nullable private String name; - private IndexTemplate template; + @Nullable + private Integer priority; + + @Nullable + private IndexTemplateMapping template; + + @Nullable + private Long version; + + /** + * Optional user metadata about the index template. May have any contents. This + * map is not automatically generated by Elasticsearch. + *

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

+ * Adds all entries of map to meta. + */ + public final Builder meta(Map map) { + this.meta = _mapPutAll(this.meta, map); + return this; + } + + /** + * Optional user metadata about the index template. May have any contents. This + * map is not automatically generated by Elasticsearch. + *

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

+ * Adds an entry to meta. + */ + public final Builder meta(String key, JsonData value) { + this.meta = _mapPut(this.meta, key, value); + return this; + } + + /** + * This setting overrides the value of the action.auto_create_index + * cluster setting. If set to true in a template, then indices can + * be automatically created using that template even if auto-creation of indices + * is disabled via actions.auto_create_index. If set to + * false, then indices or data streams matching the template must + * always be explicitly created, and may never be automatically created. + *

+ * API name: {@code allow_auto_create} + */ + public final Builder allowAutoCreate(@Nullable Boolean value) { + this.allowAutoCreate = value; + return this; + } + + /** + * An ordered list of component template names. Component templates are merged + * in the order specified, meaning that the last component template specified + * has the highest precedence. + *

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

+ * Adds all elements of list to composedOf. + */ + public final Builder composedOf(List list) { + this.composedOf = _listAddAll(this.composedOf, list); + return this; + } + + /** + * An ordered list of component template names. Component templates are merged + * in the order specified, meaning that the last component template specified + * has the highest precedence. + *

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

+ * Adds one or more values to composedOf. + */ + public final Builder composedOf(String value, String... values) { + this.composedOf = _listAdd(this.composedOf, value, values); + return this; + } /** * If true, the template passed in the body is only used if no existing @@ -196,6 +492,57 @@ public final Builder create(@Nullable Boolean value) { return this; } + /** + * If this object is included, the template is used to create data streams and + * their backing indices. Supports an empty object. Data streams require a + * matching index template with a data_stream object. + *

+ * API name: {@code data_stream} + */ + public final Builder dataStream(@Nullable DataStreamVisibility value) { + this.dataStream = value; + return this; + } + + /** + * If this object is included, the template is used to create data streams and + * their backing indices. Supports an empty object. Data streams require a + * matching index template with a data_stream object. + *

+ * API name: {@code data_stream} + */ + public final Builder dataStream( + Function> fn) { + return this.dataStream(fn.apply(new DataStreamVisibility.Builder()).build()); + } + + /** + * The configuration option ignore_missing_component_templates can be used when + * an index template references a component template that might not exist + *

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

+ * Adds all elements of list to + * ignoreMissingComponentTemplates. + */ + public final Builder ignoreMissingComponentTemplates(List list) { + this.ignoreMissingComponentTemplates = _listAddAll(this.ignoreMissingComponentTemplates, list); + return this; + } + + /** + * The configuration option ignore_missing_component_templates can be used when + * an index template references a component template that might not exist + *

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

+ * Adds one or more values to ignoreMissingComponentTemplates. + */ + public final Builder ignoreMissingComponentTemplates(String value, String... values) { + this.ignoreMissingComponentTemplates = _listAdd(this.ignoreMissingComponentTemplates, value, values); + return this; + } + /** * If true, returns all relevant default configurations for the index template. *

@@ -206,6 +553,32 @@ public final Builder includeDefaults(@Nullable Boolean value) { return this; } + /** + * Array of wildcard (*) expressions used to match the names of + * data streams and indices during creation. + *

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

+ * Adds all elements of list to indexPatterns. + */ + public final Builder indexPatterns(List list) { + this.indexPatterns = _listAddAll(this.indexPatterns, list); + return this; + } + + /** + * Array of wildcard (*) expressions used to match the names of + * data streams and indices during creation. + *

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

+ * Adds one or more values to indexPatterns. + */ + public final Builder indexPatterns(String value, String... values) { + this.indexPatterns = _listAdd(this.indexPatterns, value, values); + 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. @@ -240,26 +613,49 @@ public final Builder name(@Nullable String value) { } /** - * Required - Request body. + * Priority to determine index template precedence when a new data stream or + * index is created. The index template with the highest priority is chosen. If + * no priority is specified the template is treated as though it is of priority + * 0 (lowest priority). This number is not automatically generated by + * Elasticsearch. + *

+ * API name: {@code priority} */ - public final Builder template(IndexTemplate value) { - this.template = value; + public final Builder priority(@Nullable Integer value) { + this.priority = value; return this; } /** - * Required - Request body. + * Template to be applied. It may optionally include an aliases, + * mappings, or settings configuration. + *

+ * API name: {@code template} */ - public final Builder template(Function> fn) { - return this.template(fn.apply(new IndexTemplate.Builder()).build()); + public final Builder template(@Nullable IndexTemplateMapping value) { + this.template = value; + return this; } - @Override - public Builder withJson(JsonParser parser, JsonpMapper mapper) { + /** + * Template to be applied. It may optionally include an aliases, + * mappings, or settings configuration. + *

+ * API name: {@code template} + */ + public final Builder template(Function> fn) { + return this.template(fn.apply(new IndexTemplateMapping.Builder()).build()); + } - @SuppressWarnings("unchecked") - IndexTemplate value = (IndexTemplate) IndexTemplate._DESERIALIZER.deserialize(parser, mapper); - return this.template(value); + /** + * Version number used to manage index templates externally. This number is not + * automatically generated by Elasticsearch. + *

+ * API name: {@code version} + */ + public final Builder version(@Nullable Long value) { + this.version = value; + return this; } @Override @@ -280,13 +676,31 @@ public SimulateTemplateRequest build() { } } - public static final JsonpDeserializer _DESERIALIZER = createSimulateTemplateRequestDeserializer(); - protected static JsonpDeserializer createSimulateTemplateRequestDeserializer() { + // --------------------------------------------------------------------------------------------- - JsonpDeserializer valueDeserializer = IndexTemplate._DESERIALIZER; + /** + * Json deserializer for {@link SimulateTemplateRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SimulateTemplateRequest::setupSimulateTemplateRequestDeserializer); + + protected static void setupSimulateTemplateRequestDeserializer( + ObjectDeserializer op) { + + op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); + op.add(Builder::allowAutoCreate, JsonpDeserializer.booleanDeserializer(), "allow_auto_create"); + op.add(Builder::composedOf, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "composed_of"); + op.add(Builder::dataStream, DataStreamVisibility._DESERIALIZER, "data_stream"); + op.add(Builder::ignoreMissingComponentTemplates, + JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "ignore_missing_component_templates"); + op.add(Builder::indexPatterns, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "index_patterns"); + op.add(Builder::priority, JsonpDeserializer.integerDeserializer(), "priority"); + op.add(Builder::template, IndexTemplateMapping._DESERIALIZER, "template"); + op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); - return JsonpDeserializer.of(valueDeserializer.acceptedEvents(), (parser, mapper, event) -> new Builder() - .template(valueDeserializer.deserialize(parser, mapper, event)).build()); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_api_keys/ApiKeyFiltersAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_api_keys/ApiKeyFiltersAggregation.java index 82d7eab14..79e912df5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_api_keys/ApiKeyFiltersAggregation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/query_api_keys/ApiKeyFiltersAggregation.java @@ -24,6 +24,8 @@ import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ObjectBuilder; @@ -58,7 +60,10 @@ * specification */ @JsonpDeserializable -public class ApiKeyFiltersAggregation extends BucketAggregationBase implements ApiKeyAggregationVariant { +public class ApiKeyFiltersAggregation extends BucketAggregationBase + implements + ApiKeyAggregationVariant, + JsonpSerializable { @Nullable private final Buckets filters; @@ -74,7 +79,6 @@ public class ApiKeyFiltersAggregation extends BucketAggregationBase implements A // --------------------------------------------------------------------------------------------- private ApiKeyFiltersAggregation(Builder builder) { - super(builder); this.filters = builder.filters; this.otherBucket = builder.otherBucket; @@ -137,9 +141,17 @@ public final Boolean keyed() { return this.keyed; } + /** + * 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) { - super.serializeInternal(generator, mapper); if (this.filters != null) { generator.writeKey("filters"); this.filters.serialize(generator, mapper); @@ -163,6 +175,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + @Override + public String toString() { + return JsonpUtils.toString(this); + } + // --------------------------------------------------------------------------------------------- /** @@ -263,7 +280,7 @@ public ApiKeyFiltersAggregation build() { protected static void setupApiKeyFiltersAggregationDeserializer( ObjectDeserializer op) { - BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::filters, Buckets.createBucketsDeserializer(ApiKeyQuery._DESERIALIZER), "filters"); op.add(Builder::otherBucket, JsonpDeserializer.booleanDeserializer(), "other_bucket"); op.add(Builder::otherBucketKey, JsonpDeserializer.stringDeserializer(), "other_bucket_key"); diff --git a/java-client/src/test/java/co/elastic/clients/documentation/usage/IndexingTest.java b/java-client/src/test/java/co/elastic/clients/documentation/usage/IndexingTest.java index b06b31d13..0ac9c45be 100644 --- a/java-client/src/test/java/co/elastic/clients/documentation/usage/IndexingTest.java +++ b/java-client/src/test/java/co/elastic/clients/documentation/usage/IndexingTest.java @@ -46,7 +46,7 @@ public class IndexingTest extends ModelTestCase { .index("product") .id("bk-1") .version(1) - .primaryTerm(1) + .primaryTerm(1L) .seqNo(1) .result(Result.Created) .shards(s -> s.total(1).successful(1).failed(0))