diff --git a/CHANGELOG.md b/CHANGELOG.md index 06b9a9fdf..6b5fa970a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Removed ### Fixed +- Fixed serialization of `time_zone` field in `CompositeDateHistogramAggregationSource` ([#1362](https://github.com/opensearch-project/opensearch-java/pull/1362)) ### Security diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeDateHistogramAggregationSource.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeDateHistogramAggregationSource.java index 34fe20c09..9e67d4f49 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeDateHistogramAggregationSource.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/CompositeDateHistogramAggregationSource.java @@ -29,14 +29,15 @@ public class CompositeDateHistogramAggregationSource extends CompositeValuesSour @Nullable private final Long offset; - private final String zoneId; + @Nullable + private final String timeZone; private CompositeDateHistogramAggregationSource(Builder builder) { super(builder); this.calendarInterval = builder.calendarInterval; this.fixedInterval = builder.fixedInterval; this.offset = builder.offset; - this.zoneId = builder.zoneId; + this.timeZone = builder.timeZone; } public static CompositeDateHistogramAggregationSource of(Function> fn) { @@ -65,14 +66,22 @@ public final Time fixedInterval() { @Nullable public final Long offset() { return this.offset; + } + /** + * API name: {@code time_zone} + */ + public final String timeZone() { + return this.timeZone; } /** - * Required - API name: {@code zone_id} + * API name: {@code time_zone} + * @deprecated Use {@link #timeZone()} instead. */ + @Deprecated public final String zoneId() { - return this.zoneId; + return timeZone(); } /** @@ -103,8 +112,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } - generator.writeKey("zone_id"); - generator.write(this.zoneId); + if (this.timeZone != null) { + generator.writeKey("time_zone"); + generator.write(this.timeZone); + } } /** @@ -124,7 +135,8 @@ public static class Builder extends CompositeValuesSource.AbstractBuilder