Skip to content

Commit ccda39d

Browse files
committed
Nested facet execution can fail with ArrayIndexOutOfBounds, closes elastic#1467.
1 parent 46d1d19 commit ccda39d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/elasticsearch/src/main/java/org/elasticsearch/index/search/nested/NestedChildrenCollector.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ public NestedChildrenCollector(FacetCollector collector, Filter parentFilter, Fi
7979
}
8080

8181
@Override public void collect(int parentDoc) throws IOException {
82+
if (parentDoc == 0) {
83+
return;
84+
}
8285
int prevParentDoc = parentDocs.prevSetBit(parentDoc - 1);
8386
for (int i = (parentDoc - 1); i > prevParentDoc; i--) {
8487
if (!currentReader.isDeleted(i) && childDocs.get(i)) {

0 commit comments

Comments
 (0)