diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/RangeBucket.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/RangeBucket.java index 58b5a74b76..b8dd31a18b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/RangeBucket.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/aggregations/RangeBucket.java @@ -51,6 +51,9 @@ @JsonpDeserializable public class RangeBucket extends MultiBucketBase { + + @Nullable + private final String key; @Nullable private final Double from; @@ -68,6 +71,7 @@ public class RangeBucket extends MultiBucketBase { private RangeBucket(Builder builder) { super(builder); + this.key = builder.key; this.from = builder.from; this.to = builder.to; this.fromAsString = builder.fromAsString; @@ -79,6 +83,14 @@ public static RangeBucket of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * API name: {@code key} + */ + @Nullable + public final String key() { + return this.key; + } + /** * API name: {@code from} */ @@ -114,6 +126,11 @@ public final String toAsString() { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { super.serializeInternal(generator, mapper); + if (this.key != null) { + generator.writeKey("key"); + generator.write(this.key); + + } if (this.from != null) { generator.writeKey("from"); generator.write(this.from); @@ -144,6 +161,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { */ public static class Builder extends MultiBucketBase.AbstractBuilder implements ObjectBuilder { + + @Nullable + private String key; @Nullable private Double from; @@ -156,6 +176,14 @@ public static class Builder extends MultiBucketBase.AbstractBuilder imp @Nullable private String toAsString; + /** + * API name: {@code key} + */ + public final Builder key(String value) { + this.key = value; + return this; + } + /** * API name: {@code from} */ @@ -216,6 +244,7 @@ public RangeBucket build() { protected static void setupRangeBucketDeserializer(ObjectDeserializer op) { setupMultiBucketBaseDeserializer(op); + op.add(Builder::key, JsonpDeserializer.stringDeserializer(), "key"); op.add(Builder::from, JsonpDeserializer.doubleDeserializer(), "from"); op.add(Builder::to, JsonpDeserializer.doubleDeserializer(), "to"); op.add(Builder::fromAsString, JsonpDeserializer.stringDeserializer(), "from_as_string");