Skip to content

Commit 5e96c56

Browse files
committed
Tests - fix incorrect test assumption that zero-doc buckets will be returned by the adjacency matrix aggregation. Closes #29159 (#29167)
1 parent 181ff83 commit 5e96c56

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/src/test/java/org/elasticsearch/search/aggregations/bucket/adjacency/InternalAdjacencyMatrixTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ protected void assertReduced(InternalAdjacencyMatrix reduced, List<InternalAdjac
8282
final Map<String, Long> expectedCounts = new TreeMap<>();
8383
for (InternalAdjacencyMatrix input : inputs) {
8484
for (InternalAdjacencyMatrix.InternalBucket bucket : input.getBuckets()) {
85-
expectedCounts.compute(bucket.getKeyAsString(),
85+
if (bucket.getDocCount() > 0) {
86+
expectedCounts.compute(bucket.getKeyAsString(),
8687
(key, oldValue) -> (oldValue == null ? 0 : oldValue) + bucket.getDocCount());
88+
}
8789
}
8890
}
8991
final Map<String, Long> actualCounts = new TreeMap<>();

0 commit comments

Comments
 (0)