diff --git a/CHANGELOG.md b/CHANGELOG.md index b0eed26bb9..585fb4d433 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ This section is for maintaining a changelog for all breaking changes for the cli - Fixed don't invoke the mapper's serialize method for the RangeQuery JsonData raw value ([#1309](https://github.com/opensearch-project/opensearch-java/pull/1309)) - Fixed `GetSnapshotResponse` deserialization ([#1299](https://github.com/opensearch-project/opensearch-java/pull/1299)) - Fixed `CreateSnapshotResponse` deserialization when wait_for_completion is false ([#1332](https://github.com/opensearch-project/opensearch-java/pull/1332)) +- Fixed serialization of nested aggregates under `SingleBucketAggregateBase` ([#1350](https://github.com/opensearch-project/opensearch-java/pull/1350)) ### Security diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SingleBucketAggregateBase.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SingleBucketAggregateBase.java index 35ade2fbb9..d96f002654 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SingleBucketAggregateBase.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/SingleBucketAggregateBase.java @@ -37,6 +37,7 @@ import java.util.Map; import java.util.function.Function; import javax.annotation.Nullable; +import org.opensearch.client.json.ExternallyTaggedUnion; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectDeserializer; @@ -71,8 +72,10 @@ public final long docCount() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); + + ExternallyTaggedUnion.serializeTypedKeysInner(this.aggregations, generator, mapper); + generator.writeKey("doc_count"); generator.write(this.docCount);