diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b3a3ea873125..0412cc602d65f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,12 +81,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Client with Java 8 runtime and Apache HttpClient 5 Transport fails with java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer ([#13100](https://github.com/opensearch-project/opensearch-java/pull/13100)) - Fix from and size parameter can be negative when searching ([#13047](https://github.com/opensearch-project/OpenSearch/pull/13047)) - Enabled mockTelemetryPlugin for IT and fixed OOM issues ([#13054](https://github.com/opensearch-project/OpenSearch/pull/13054)) -- Fix implement mark() and markSupported() in class FilterStreamInput ([#13098](https://github.com/opensearch-project/OpenSearch/pull/13098)) -- Fix IndicesRequestCache Stale calculation ([#13070](https://github.com/opensearch-project/OpenSearch/pull/13070)] +- Fix implement mark() and markSupported() in class FilterStreamInput[ ([#13098](https://github.com/opensearch-project/OpenSearch/pull/13098)) +- Fix IndicesRequestCache Stale calculation ([#13070](https://github.com/opensearch-project/OpenSearch/pull/13070)]]() - Fix snapshot _status API to return correct status for partial snapshots ([#12812](https://github.com/opensearch-project/OpenSearch/pull/12812)) - Improve the error messages for _stats with closed indices ([#13012](https://github.com/opensearch-project/OpenSearch/pull/13012)) - Ignore BaseRestHandler unconsumed content check as it's always consumed. ([#13290](https://github.com/opensearch-project/OpenSearch/pull/13290)) - Fix mapper_parsing_exception when using flat_object fields with names longer than 11 characters ([#13259](https://github.com/opensearch-project/OpenSearch/pull/13259)) +- The aggs result of NestedAggregator with sub NestedAggregator may be not accurately ([#13324](https://github.com/opensearch-project/OpenSearch/pull/13324)) ### Security diff --git a/server/src/main/java/org/opensearch/search/aggregations/bucket/nested/NestedAggregator.java b/server/src/main/java/org/opensearch/search/aggregations/bucket/nested/NestedAggregator.java index 20fc8590e09b2..5e291a40d08d5 100644 --- a/server/src/main/java/org/opensearch/search/aggregations/bucket/nested/NestedAggregator.java +++ b/server/src/main/java/org/opensearch/search/aggregations/bucket/nested/NestedAggregator.java @@ -143,26 +143,26 @@ public void collect(int parentDoc, long bucket) throws IOException { } static Tuple getChildAndParentId(BitSet parentDocs, DocIdSetIterator childDocs, int parentDoc) throws IOException { - int currentRootDoc; + int currentParentDoc; int prevParentDoc = parentDocs.prevSetBit(parentDoc); if (prevParentDoc == -1) { - currentRootDoc = parentDocs.nextSetBit(0); + currentParentDoc = parentDocs.nextSetBit(0); } else if (prevParentDoc == parentDoc) { - currentRootDoc = parentDoc; - if (currentRootDoc == 0) { + currentParentDoc = parentDoc; + if (currentParentDoc == 0) { prevParentDoc = -1; } else { - prevParentDoc = parentDocs.prevSetBit(currentRootDoc - 1); + prevParentDoc = parentDocs.prevSetBit(currentParentDoc - 1); } } else { - currentRootDoc = parentDocs.nextSetBit(prevParentDoc + 1); + currentParentDoc = parentDocs.nextSetBit(prevParentDoc + 1); } int childDocId = childDocs.docID(); if (childDocId <= prevParentDoc) { childDocId = childDocs.advance(prevParentDoc + 1); } - return Tuple.tuple(currentRootDoc, childDocId); + return Tuple.tuple(currentParentDoc, childDocId); } @Override