IndexOutOfBoundsException using nested terms aggregation under composite aggregation

Exception thrown when using a terms aggragation as nested under a composite aggregation.
The query is ok on small indices but the problem starts after about 2m+ documents.
Any ideas?

My query:
POST my_index/_search
{
"query": {
"match_all": {}
},
"size": 1,
"aggs": {
"comp": {
"terms": {
"field": "yrow.5"
},
"aggs": {
"nested": {
"terms": {
"field": "field2",
"order": {
"_key": "desc"
}
}
}
}
}
}
}

StackTrace:
...
Caused by: java.lang.IndexOutOfBoundsException
at java.nio.Buffer.checkIndex(Buffer.java:546) ~[?:1.8.0_201]
at java.nio.DirectByteBuffer.getInt(DirectByteBuffer.java:685) ~[?:1.8.0_201]
at org.apache.lucene.store.ByteBufferGuard.getInt(ByteBufferGuard.java:128) ~[lucene-core-7.2.1.jar:7.2.1 b2b6438b37073bee1fca40374e85bf91aa457c0b - ubuntu - 2018-01-10 00:48:43]
at org.apache.lucene.store.ByteBufferIndexInput$SingleBufferImpl.readInt(ByteBufferIndexInput.java:415) ~[lucene-core-7.2.1.jar:7.2.1 b2b6438b37073bee1fca40374e85bf91aa457c0b - ubuntu - 2018-01-10 00:48:43]
at org.apache.lucene.util.packed.DirectReader$DirectPackedReader32.get(DirectReader.java:267) ~[lucene-core-7.2.1.jar:7.2.1 b2b6438b37073bee1fca40374e85bf91aa457c0b - ubuntu - 2018-01-10 00:48:43]
at org.apache.lucene.codecs.lucene70.Lucene70DocValuesProducer$4.longValue(Lucene70DocValuesProducer.java:490) ~[lucene-core-7.2.1.jar:7.2.1 b2b6438b37073bee1fca40374e85bf91aa457c0b - ubuntu - 2018-01-10 00:48:43]
at org.apache.lucene.index.SingletonSortedNumericDocValues.nextValue(SingletonSortedNumericDocValues.java:73) ~[lucene-core-7.2.1.jar:7.2.1 b2b6438b37073bee1fca40374e85bf91aa457c0b - ubuntu - 2018-01-10 00:48:43]
at org.elasticsearch.search.aggregations.bucket.terms.LongTermsAggregator$1.collect(LongTermsAggregator.java:85) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.search.aggregations.AggregatorFactory$MultiBucketAggregatorWrapper$1.collect(AggregatorFactory.java:140) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.search.aggregations.bucket.BucketsAggregator.collectExistingBucket(BucketsAggregator.java:84) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.search.aggregations.bucket.composite.CompositeAggregator.lambda$getSecondPassCollector$0(CompositeAggregator.java:246) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.search.aggregations.bucket.composite.CompositeValuesSource$LongValuesSource.lambda$getLeafCollector$0(CompositeValuesSource.java:324) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.search.aggregations.bucket.composite.CompositeAggregator.buildAggregation(CompositeAggregator.java:122) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.search.aggregations.AggregationPhase.execute(AggregationPhase.java:130) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:113) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:307) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:340) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:316) ~[elasticsearch-6.2.3.jar:6.2.3]
... 9 more

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.