From 9ea25c4f2e0645a364ddf30383ff12f37a792662 Mon Sep 17 00:00:00 2001 From: Peng Huo Date: Thu, 17 Feb 2022 10:17:10 -0800 Subject: [PATCH] Adjust main version after backport to 1.x (#2147) Signed-off-by: Peng Huo --- .../test/search.aggregation/230_composite.yml | 32 +++++++++++++++++++ .../CompositeValuesSourceBuilder.java | 4 +-- .../bucket/composite/InternalComposite.java | 4 +-- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/230_composite.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/230_composite.yml index 1ec3a302d68..b54555a5767 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/230_composite.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/230_composite.yml @@ -1030,3 +1030,35 @@ setup: - length: { aggregations.test.buckets: 1 } - match: { aggregations.test.buckets.0.key.keyword: "foo" } - match: { aggregations.test.buckets.0.doc_count: 1 } +--- +"Simple Composite aggregation with missing order": + - skip: + version: " - 1.2.99" + reason: missing_order is supported in 1.3.0. + + - do: + search: + rest_total_hits_as_int: true + index: test + body: + aggregations: + test: + composite: + sources: [ + "kw": { + "terms": { + "field": "keyword", + "missing_bucket": true, + "missing_order": "last" + } + } + ] + + - match: {hits.total: 6} + - length: { aggregations.test.buckets: 3 } + - match: { aggregations.test.buckets.0.key.kw: "bar" } + - match: { aggregations.test.buckets.0.doc_count: 3 } + - match: { aggregations.test.buckets.1.key.kw: "foo" } + - match: { aggregations.test.buckets.1.doc_count: 2 } + - match: { aggregations.test.buckets.2.key.kw: null } + - match: { aggregations.test.buckets.2.doc_count: 2 } diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/CompositeValuesSourceBuilder.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/CompositeValuesSourceBuilder.java index 6d047197b38..9ac43c812e4 100644 --- a/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/CompositeValuesSourceBuilder.java +++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/composite/CompositeValuesSourceBuilder.java @@ -81,7 +81,7 @@ public abstract class CompositeValuesSourceBuilder order.writeTo(output), missingOrders); } out.writeList(buckets);