> fn) {
/**
* API name: {@code order}
+ *
+ * Adds all elements of list
to order
.
*/
- public final Builder order(@Nullable HistogramOrder value) {
- this.order = value;
+ public final Builder order(List> list) {
+ this.order = _listAddAll(this.order, list);
return this;
}
/**
* API name: {@code order}
+ *
+ * Adds one or more values to order
.
*/
- public final Builder order(Function> fn) {
- return this.order(fn.apply(new HistogramOrder.Builder()).build());
+ public final Builder order(NamedValue value, NamedValue... values) {
+ this.order = _listAdd(this.order, value, values);
+ return this;
}
/**
@@ -624,7 +638,8 @@ protected static void setupDateHistogramAggregationDeserializer(
op.add(Builder::minDocCount, JsonpDeserializer.integerDeserializer(), "min_doc_count");
op.add(Builder::missing, JsonpDeserializer.stringDeserializer(), "missing");
op.add(Builder::offset, Time._DESERIALIZER, "offset");
- op.add(Builder::order, HistogramOrder._DESERIALIZER, "order");
+ op.add(Builder::order,
+ JsonpDeserializer.arrayDeserializer(NamedValue.deserializer(() -> SortOrder._DESERIALIZER)), "order");
op.add(Builder::params, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "params");
op.add(Builder::script, Script._DESERIALIZER, "script");
op.add(Builder::timeZone, JsonpDeserializer.stringDeserializer(), "time_zone");
diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/HistogramAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/HistogramAggregation.java
index 4ea4c5dff..959cf5604 100644
--- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/HistogramAggregation.java
+++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/HistogramAggregation.java
@@ -24,6 +24,7 @@
package co.elastic.clients.elasticsearch._types.aggregations;
import co.elastic.clients.elasticsearch._types.Script;
+import co.elastic.clients.elasticsearch._types.SortOrder;
import co.elastic.clients.elasticsearch.transform.PivotGroupBy;
import co.elastic.clients.elasticsearch.transform.PivotGroupByVariant;
import co.elastic.clients.json.JsonpDeserializable;
@@ -31,12 +32,15 @@
import co.elastic.clients.json.JsonpMapper;
import co.elastic.clients.json.ObjectBuilderDeserializer;
import co.elastic.clients.json.ObjectDeserializer;
+import co.elastic.clients.util.ApiTypeHelper;
+import co.elastic.clients.util.NamedValue;
import co.elastic.clients.util.ObjectBuilder;
import jakarta.json.stream.JsonGenerator;
import java.lang.Boolean;
import java.lang.Double;
import java.lang.Integer;
import java.lang.String;
+import java.util.List;
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Nullable;
@@ -72,8 +76,7 @@ public class HistogramAggregation extends BucketAggregationBase implements Aggre
@Nullable
private final Double offset;
- @Nullable
- private final HistogramOrder order;
+ private final List> order;
@Nullable
private final Script script;
@@ -96,7 +99,7 @@ private HistogramAggregation(Builder builder) {
this.minDocCount = builder.minDocCount;
this.missing = builder.missing;
this.offset = builder.offset;
- this.order = builder.order;
+ this.order = ApiTypeHelper.unmodifiable(builder.order);
this.script = builder.script;
this.format = builder.format;
this.keyed = builder.keyed;
@@ -182,8 +185,7 @@ public final Double offset() {
/**
* API name: {@code order}
*/
- @Nullable
- public final HistogramOrder order() {
+ public final List> order() {
return this.order;
}
@@ -249,9 +251,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.write(this.offset);
}
- if (this.order != null) {
+ if (ApiTypeHelper.isDefined(this.order)) {
generator.writeKey("order");
- this.order.serialize(generator, mapper);
+ generator.writeStartArray();
+ for (NamedValue item0 : this.order) {
+ generator.writeStartObject();
+ generator.writeKey(item0.name());
+ item0.value().serialize(generator, mapper);
+ generator.writeEnd();
+
+ }
+ generator.writeEnd();
}
if (this.script != null) {
@@ -303,7 +313,7 @@ public static class Builder extends BucketAggregationBase.AbstractBuilder> order;
@Nullable
private Script script;
@@ -388,17 +398,22 @@ public final Builder offset(@Nullable Double value) {
/**
* API name: {@code order}
+ *
+ * Adds all elements of list
to order
.
*/
- public final Builder order(@Nullable HistogramOrder value) {
- this.order = value;
+ public final Builder order(List> list) {
+ this.order = _listAddAll(this.order, list);
return this;
}
/**
* API name: {@code order}
+ *
+ * Adds one or more values to order
.
*/
- public final Builder order(Function> fn) {
- return this.order(fn.apply(new HistogramOrder.Builder()).build());
+ public final Builder order(NamedValue value, NamedValue... values) {
+ this.order = _listAdd(this.order, value, values);
+ return this;
}
/**
@@ -470,7 +485,8 @@ protected static void setupHistogramAggregationDeserializer(ObjectDeserializer SortOrder._DESERIALIZER)), "order");
op.add(Builder::script, Script._DESERIALIZER, "script");
op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format");
op.add(Builder::keyed, JsonpDeserializer.booleanDeserializer(), "keyed");
diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MultiTermsAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MultiTermsAggregation.java
index 2d8803d78..d2c10f31f 100644
--- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MultiTermsAggregation.java
+++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/MultiTermsAggregation.java
@@ -23,14 +23,19 @@
package co.elastic.clients.elasticsearch._types.aggregations;
+import co.elastic.clients.elasticsearch._types.SortOrder;
import co.elastic.clients.json.JsonpDeserializable;
import co.elastic.clients.json.JsonpDeserializer;
import co.elastic.clients.json.JsonpMapper;
import co.elastic.clients.json.ObjectBuilderDeserializer;
import co.elastic.clients.json.ObjectDeserializer;
import co.elastic.clients.util.ApiTypeHelper;
+import co.elastic.clients.util.NamedValue;
import co.elastic.clients.util.ObjectBuilder;
import jakarta.json.stream.JsonGenerator;
+import java.lang.Boolean;
+import java.lang.Integer;
+import java.lang.Long;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
@@ -46,6 +51,26 @@
*/
@JsonpDeserializable
public class MultiTermsAggregation extends BucketAggregationBase implements AggregationVariant {
+ @Nullable
+ private final TermsAggregationCollectMode collectMode;
+
+ private final List> order;
+
+ @Nullable
+ private final Long minDocCount;
+
+ @Nullable
+ private final Long shardMinDocCount;
+
+ @Nullable
+ private final Integer shardSize;
+
+ @Nullable
+ private final Boolean showTermDocCountError;
+
+ @Nullable
+ private final Integer size;
+
private final List terms;
// ---------------------------------------------------------------------------------------------
@@ -53,6 +78,13 @@ public class MultiTermsAggregation extends BucketAggregationBase implements Aggr
private MultiTermsAggregation(Builder builder) {
super(builder);
+ this.collectMode = builder.collectMode;
+ this.order = ApiTypeHelper.unmodifiable(builder.order);
+ this.minDocCount = builder.minDocCount;
+ this.shardMinDocCount = builder.shardMinDocCount;
+ this.shardSize = builder.shardSize;
+ this.showTermDocCountError = builder.showTermDocCountError;
+ this.size = builder.size;
this.terms = ApiTypeHelper.unmodifiableRequired(builder.terms, this, "terms");
}
@@ -69,6 +101,61 @@ public Aggregation.Kind _aggregationKind() {
return Aggregation.Kind.MultiTerms;
}
+ /**
+ * API name: {@code collect_mode}
+ */
+ @Nullable
+ public final TermsAggregationCollectMode collectMode() {
+ return this.collectMode;
+ }
+
+ /**
+ * API name: {@code order}
+ */
+ public final List> order() {
+ return this.order;
+ }
+
+ /**
+ * API name: {@code min_doc_count}
+ */
+ @Nullable
+ public final Long minDocCount() {
+ return this.minDocCount;
+ }
+
+ /**
+ * API name: {@code shard_min_doc_count}
+ */
+ @Nullable
+ public final Long shardMinDocCount() {
+ return this.shardMinDocCount;
+ }
+
+ /**
+ * API name: {@code shard_size}
+ */
+ @Nullable
+ public final Integer shardSize() {
+ return this.shardSize;
+ }
+
+ /**
+ * API name: {@code show_term_doc_count_error}
+ */
+ @Nullable
+ public final Boolean showTermDocCountError() {
+ return this.showTermDocCountError;
+ }
+
+ /**
+ * API name: {@code size}
+ */
+ @Nullable
+ public final Integer size() {
+ return this.size;
+ }
+
/**
* Required - API name: {@code terms}
*/
@@ -79,6 +166,48 @@ public final List terms() {
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
super.serializeInternal(generator, mapper);
+ if (this.collectMode != null) {
+ generator.writeKey("collect_mode");
+ this.collectMode.serialize(generator, mapper);
+ }
+ if (ApiTypeHelper.isDefined(this.order)) {
+ generator.writeKey("order");
+ generator.writeStartArray();
+ for (NamedValue item0 : this.order) {
+ generator.writeStartObject();
+ generator.writeKey(item0.name());
+ item0.value().serialize(generator, mapper);
+ generator.writeEnd();
+
+ }
+ generator.writeEnd();
+
+ }
+ if (this.minDocCount != null) {
+ generator.writeKey("min_doc_count");
+ generator.write(this.minDocCount);
+
+ }
+ if (this.shardMinDocCount != null) {
+ generator.writeKey("shard_min_doc_count");
+ generator.write(this.shardMinDocCount);
+
+ }
+ if (this.shardSize != null) {
+ generator.writeKey("shard_size");
+ generator.write(this.shardSize);
+
+ }
+ if (this.showTermDocCountError != null) {
+ generator.writeKey("show_term_doc_count_error");
+ generator.write(this.showTermDocCountError);
+
+ }
+ if (this.size != null) {
+ generator.writeKey("size");
+ generator.write(this.size);
+
+ }
if (ApiTypeHelper.isDefined(this.terms)) {
generator.writeKey("terms");
generator.writeStartArray();
@@ -101,8 +230,97 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
public static class Builder extends BucketAggregationBase.AbstractBuilder
implements
ObjectBuilder {
+ @Nullable
+ private TermsAggregationCollectMode collectMode;
+
+ @Nullable
+ private List> order;
+
+ @Nullable
+ private Long minDocCount;
+
+ @Nullable
+ private Long shardMinDocCount;
+
+ @Nullable
+ private Integer shardSize;
+
+ @Nullable
+ private Boolean showTermDocCountError;
+
+ @Nullable
+ private Integer size;
+
private List terms;
+ /**
+ * API name: {@code collect_mode}
+ */
+ public final Builder collectMode(@Nullable TermsAggregationCollectMode value) {
+ this.collectMode = value;
+ return this;
+ }
+
+ /**
+ * API name: {@code order}
+ *
+ * Adds all elements of list
to order
.
+ */
+ public final Builder order(List> list) {
+ this.order = _listAddAll(this.order, list);
+ return this;
+ }
+
+ /**
+ * API name: {@code order}
+ *
+ * Adds one or more values to order
.
+ */
+ public final Builder order(NamedValue value, NamedValue... values) {
+ this.order = _listAdd(this.order, value, values);
+ return this;
+ }
+
+ /**
+ * API name: {@code min_doc_count}
+ */
+ public final Builder minDocCount(@Nullable Long value) {
+ this.minDocCount = value;
+ return this;
+ }
+
+ /**
+ * API name: {@code shard_min_doc_count}
+ */
+ public final Builder shardMinDocCount(@Nullable Long value) {
+ this.shardMinDocCount = value;
+ return this;
+ }
+
+ /**
+ * API name: {@code shard_size}
+ */
+ public final Builder shardSize(@Nullable Integer value) {
+ this.shardSize = value;
+ return this;
+ }
+
+ /**
+ * API name: {@code show_term_doc_count_error}
+ */
+ public final Builder showTermDocCountError(@Nullable Boolean value) {
+ this.showTermDocCountError = value;
+ return this;
+ }
+
+ /**
+ * API name: {@code size}
+ */
+ public final Builder size(@Nullable Integer value) {
+ this.size = value;
+ return this;
+ }
+
/**
* Required - API name: {@code terms}
*
@@ -160,6 +378,14 @@ public MultiTermsAggregation build() {
protected static void setupMultiTermsAggregationDeserializer(ObjectDeserializer op) {
BucketAggregationBase.setupBucketAggregationBaseDeserializer(op);
+ op.add(Builder::collectMode, TermsAggregationCollectMode._DESERIALIZER, "collect_mode");
+ op.add(Builder::order,
+ JsonpDeserializer.arrayDeserializer(NamedValue.deserializer(() -> SortOrder._DESERIALIZER)), "order");
+ op.add(Builder::minDocCount, JsonpDeserializer.longDeserializer(), "min_doc_count");
+ op.add(Builder::shardMinDocCount, JsonpDeserializer.longDeserializer(), "shard_min_doc_count");
+ op.add(Builder::shardSize, JsonpDeserializer.integerDeserializer(), "shard_size");
+ op.add(Builder::showTermDocCountError, JsonpDeserializer.booleanDeserializer(), "show_term_doc_count_error");
+ op.add(Builder::size, JsonpDeserializer.integerDeserializer(), "size");
op.add(Builder::terms, JsonpDeserializer.arrayDeserializer(MultiTermLookup._DESERIALIZER), "terms");
}
diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TermsAggregation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TermsAggregation.java
index b6b2e82e9..fe795cf40 100644
--- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TermsAggregation.java
+++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/TermsAggregation.java
@@ -34,13 +34,13 @@
import co.elastic.clients.json.ObjectBuilderDeserializer;
import co.elastic.clients.json.ObjectDeserializer;
import co.elastic.clients.util.ApiTypeHelper;
+import co.elastic.clients.util.NamedValue;
import co.elastic.clients.util.ObjectBuilder;
import jakarta.json.stream.JsonGenerator;
import java.lang.Boolean;
import java.lang.Integer;
import java.lang.String;
import java.util.List;
-import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Nullable;
@@ -85,7 +85,7 @@ public class TermsAggregation extends BucketAggregationBase implements Aggregati
@Nullable
private final String valueType;
- private final List