@@ -159,16 +159,21 @@ public final AggregationVariant _get() {
159159 return _value ;
160160 }
161161
162+ @ Nonnull
163+ private final Map <String , Aggregation > aggregations ;
164+
162165 @ Nonnull
163166 private final Map <String , JsonData > meta ;
164167
165168 public Aggregation (AggregationVariant value ) {
166169 this ._kind = ApiTypeHelper .requireNonNull (value ._aggregationKind (), this , "<variant kind>" );
167170 this ._value = ApiTypeHelper .requireNonNull (value , this , "<variant value>" );
171+ this .aggregations = null ;
168172 this .meta = null ;
169173 }
170174
171175 private Aggregation (Builder builder ) {
176+ this .aggregations = ApiTypeHelper .unmodifiable (builder .aggregations );
172177 this .meta = ApiTypeHelper .unmodifiable (builder .meta );
173178 this ._kind = ApiTypeHelper .requireNonNull (builder ._kind , builder , "<variant kind>" );
174179 this ._value = ApiTypeHelper .requireNonNull (builder ._value , builder , "<variant value>" );
@@ -178,6 +183,17 @@ public static Aggregation of(Function<Aggregation.Builder, ObjectBuilder<Aggrega
178183 return fn .apply (new Builder ()).build ();
179184 }
180185
186+ /**
187+ * Sub-aggregations for this aggregation. Only applies to bucket aggregations.
188+ * <p>
189+ * API name: {@code aggregations}
190+ * </p>
191+ */
192+ @ Nonnull
193+ public final Map <String , Aggregation > aggregations () {
194+ return this .aggregations ;
195+ }
196+
181197 /**
182198 * API name: {@code meta}
183199 */
@@ -1229,6 +1245,16 @@ public WeightedAverageAggregation weightedAvg() {
12291245 @ Override
12301246 public void serialize (JsonGenerator generator , JsonpMapper mapper ) {
12311247 generator .writeStartObject ();
1248+ if (ApiTypeHelper .isDefined (this .aggregations )) {
1249+ generator .writeKey ("aggregations" );
1250+ generator .writeStartObject ();
1251+ for (Map .Entry <String , Aggregation > item0 : this .aggregations .entrySet ()) {
1252+ generator .writeKey (item0 .getKey ());
1253+ item0 .getValue ().serialize (generator , mapper );
1254+ }
1255+ generator .writeEnd ();
1256+ }
1257+
12321258 if (ApiTypeHelper .isDefined (this .meta )) {
12331259 generator .writeKey ("meta" );
12341260 generator .writeStartObject ();
@@ -1259,16 +1285,66 @@ public static class Builder extends ObjectBuilderBase {
12591285 private Kind _kind ;
12601286 private AggregationVariant _value ;
12611287 @ Nullable
1288+ private Map <String , Aggregation > aggregations ;
1289+ @ Nullable
12621290 private Map <String , JsonData > meta ;
12631291
12641292 public Builder () {}
12651293
12661294 private Builder (Aggregation o ) {
1295+ this .aggregations = _mapCopy (o .aggregations );
12671296 this .meta = _mapCopy (o .meta );
12681297 this ._kind = o ._kind ;
12691298 this ._value = o ._value ;
12701299 }
12711300
1301+ /**
1302+ * Sub-aggregations for this aggregation. Only applies to bucket aggregations.
1303+ * <p>
1304+ * API name: {@code aggregations}
1305+ * </p>
1306+ *
1307+ * <p>
1308+ * Adds all elements of <code>map</code> to <code>aggregations</code>.
1309+ * </p>
1310+ */
1311+ @ Nonnull
1312+ public final Builder aggregations (Map <String , Aggregation > map ) {
1313+ this .aggregations = _mapPutAll (this .aggregations , map );
1314+ return this ;
1315+ }
1316+
1317+ /**
1318+ * Sub-aggregations for this aggregation. Only applies to bucket aggregations.
1319+ * <p>
1320+ * API name: {@code aggregations}
1321+ * </p>
1322+ *
1323+ * <p>
1324+ * Adds an entry to <code>aggregations</code>.
1325+ * </p>
1326+ */
1327+ @ Nonnull
1328+ public final Builder aggregations (String key , Aggregation value ) {
1329+ this .aggregations = _mapPut (this .aggregations , key , value );
1330+ return this ;
1331+ }
1332+
1333+ /**
1334+ * Sub-aggregations for this aggregation. Only applies to bucket aggregations.
1335+ * <p>
1336+ * API name: {@code aggregations}
1337+ * </p>
1338+ *
1339+ * <p>
1340+ * Adds a value to <code>aggregations</code> using a builder lambda.
1341+ * </p>
1342+ */
1343+ @ Nonnull
1344+ public final Builder aggregations (String key , Function <Aggregation .Builder , ObjectBuilder <Aggregation >> fn ) {
1345+ return aggregations (key , fn .apply (new Aggregation .Builder ()).build ());
1346+ }
1347+
12721348 /**
12731349 * API name: {@code meta}
12741350 *
@@ -1979,6 +2055,53 @@ protected Aggregation build() {
19792055 public class ContainerBuilder implements ObjectBuilder <Aggregation > {
19802056 private ContainerBuilder () {}
19812057
2058+ /**
2059+ * Sub-aggregations for this aggregation. Only applies to bucket aggregations.
2060+ * <p>
2061+ * API name: {@code aggregations}
2062+ * </p>
2063+ *
2064+ * <p>
2065+ * Adds all elements of <code>map</code> to <code>aggregations</code>.
2066+ * </p>
2067+ */
2068+ @ Nonnull
2069+ public final ContainerBuilder aggregations (Map <String , Aggregation > map ) {
2070+ Builder .this .aggregations = _mapPutAll (Builder .this .aggregations , map );
2071+ return this ;
2072+ }
2073+
2074+ /**
2075+ * Sub-aggregations for this aggregation. Only applies to bucket aggregations.
2076+ * <p>
2077+ * API name: {@code aggregations}
2078+ * </p>
2079+ *
2080+ * <p>
2081+ * Adds an entry to <code>aggregations</code>.
2082+ * </p>
2083+ */
2084+ @ Nonnull
2085+ public final ContainerBuilder aggregations (String key , Aggregation value ) {
2086+ Builder .this .aggregations = _mapPut (Builder .this .aggregations , key , value );
2087+ return this ;
2088+ }
2089+
2090+ /**
2091+ * Sub-aggregations for this aggregation. Only applies to bucket aggregations.
2092+ * <p>
2093+ * API name: {@code aggregations}
2094+ * </p>
2095+ *
2096+ * <p>
2097+ * Adds a value to <code>aggregations</code> using a builder lambda.
2098+ * </p>
2099+ */
2100+ @ Nonnull
2101+ public final ContainerBuilder aggregations (String key , Function <Aggregation .Builder , ObjectBuilder <Aggregation >> fn ) {
2102+ return aggregations (key , fn .apply (new Aggregation .Builder ()).build ());
2103+ }
2104+
19822105 /**
19832106 * API name: {@code meta}
19842107 *
@@ -2013,6 +2136,7 @@ public Aggregation build() {
20132136 }
20142137
20152138 protected static void setupAggregationDeserializer (ObjectDeserializer <Builder > op ) {
2139+ op .add (Builder ::aggregations , JsonpDeserializer .stringMapDeserializer (Aggregation ._DESERIALIZER ), "aggregations" , "aggs" );
20162140 op .add (Builder ::meta , JsonpDeserializer .stringMapDeserializer (JsonData ._DESERIALIZER ), "meta" );
20172141 op .add (Builder ::adjacencyMatrix , AdjacencyMatrixAggregation ._DESERIALIZER , "adjacency_matrix" );
20182142 op .add (Builder ::autoDateHistogram , AutoDateHistogramAggregation ._DESERIALIZER , "auto_date_histogram" );
@@ -2092,6 +2216,7 @@ public int hashCode() {
20922216 int result = 17 ;
20932217 result = 31 * result + Objects .hashCode (this ._kind );
20942218 result = 31 * result + Objects .hashCode (this ._value );
2219+ result = 31 * result + Objects .hashCode (this .aggregations );
20952220 result = 31 * result + Objects .hashCode (this .meta );
20962221 return result ;
20972222 }
@@ -2103,6 +2228,7 @@ public boolean equals(Object o) {
21032228 Aggregation other = (Aggregation ) o ;
21042229 return Objects .equals (this ._kind , other ._kind )
21052230 && Objects .equals (this ._value , other ._value )
2231+ && Objects .equals (this .aggregations , other .aggregations )
21062232 && Objects .equals (this .meta , other .meta );
21072233 }
21082234}
0 commit comments