diff --git a/CHANGELOG.md b/CHANGELOG.md index 77981d5a68..00118cc4ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Added - Added support for "smartcn" analyzer ([#605](https://github.com/opensearch-project/opensearch-java/pull/605)) - Added support for "cjk" analyzer ([#604](https://github.com/opensearch-project/opensearch-java/pull/604)) +- Added size attribute to MultiTermsAggregation ([#614](https://github.com/opensearch-project/opensearch-java/pull/614)) ### Dependencies - Bumps `org.ajoberstar.grgit:grgit-gradle` from 5.0.0 to 5.2.0 diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MultiTermsAggregation.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MultiTermsAggregation.java index 7470809839..a4b58fe966 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MultiTermsAggregation.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/MultiTermsAggregation.java @@ -43,19 +43,24 @@ import java.util.List; import java.util.function.Function; +import javax.annotation.Nullable; + // typedef: _types.aggregations.MultiTermsAggregation @JsonpDeserializable public class MultiTermsAggregation extends BucketAggregationBase implements AggregationVariant { private final List terms; + @Nullable + private final Integer size; + // --------------------------------------------------------------------------------------------- private MultiTermsAggregation(Builder builder) { super(builder); this.terms = ApiTypeHelper.unmodifiableRequired(builder.terms, this, "terms"); - + this.size = builder.size; } public static MultiTermsAggregation of(Function> fn) { @@ -77,9 +82,22 @@ public final List terms() { return this.terms; } + /** + * API name: {@code size} + */ + @Nullable + public final Integer size() { + return this.size; + } + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { super.serializeInternal(generator, mapper); + if (this.size != null) { + generator.writeKey("size"); + generator.write(this.size); + + } if (ApiTypeHelper.isDefined(this.terms)) { generator.writeKey("terms"); generator.writeStartArray(); @@ -104,6 +122,9 @@ public static class Builder extends BucketAggregationBase.AbstractBuilder { private List terms; + @Nullable + private Integer size; + /** * Required - API name: {@code terms} *

@@ -133,6 +154,14 @@ public final Builder terms(Function op) { BucketAggregationBase.setupBucketAggregationBaseDeserializer(op); + op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size"); op.add(Builder::terms, JsonpDeserializer.arrayDeserializer(MultiTermLookup._DESERIALIZER), "terms"); - } }