# Index 128 out of bounds for length 128

**URL:** <https://discuss.elastic.co/t/index-128-out-of-bounds-for-length-128/287971>\
**Category:** Elasticsearch\
**Created:** [October 29, 2021, 5:42am UTC](https://discuss.elastic.co/t/index-128-out-of-bounds-for-length-128/287971 "2021-10-29T05:42:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shreyanshes103](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@shreyanshes103](https://discuss.elastic.co/u/shreyanshes103)\
**Post date:** [October 29, 2021, 5:42am UTC](https://discuss.elastic.co/t/index-128-out-of-bounds-for-length-128/287971/1 "2021-10-29T05:42:16Z")

</div>

Hi All ,getting error like this..."caused\_by" : {  
"type" : "array\_index\_out\_of\_bounds\_exception",  
"reason" : "Index 128 out of bounds for length 128",  
"caused\_by" : {  
"type" : "array\_index\_out\_of\_bounds\_exception",  
"reason" : "Index 128 out of bounds for length 128"  
}

while doing aggregation on nested Fields and its giving only for one particular document but data stored in that doc seems good as other have ....

here is the StackTrace of error:Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 128 out of bounds for length 128  
at org.apache.lucene.codecs.lucene84.Lucene84PostingsReader$BlockDocsEnum.freq(Lucene84PostingsReader.java:363) ~[lucene-core-8.4.0.jar:8.4.0 bc02ab906445fcf4e297f4ef00ab4a54fdd72ca2 - jpountz - 2019-12-19 20:16:14]  
at org.apache.lucene.search.TermScorer.score(TermScorer.java:75) ~[lucene-core-8.4.0.jar:8.4.0 bc02ab906445fcf4e297f4ef00ab4a54fdd72ca2 - jpountz - 2019-12-19 20:16:14]  
at org.apache.lucene.search.TopScoreDocCollector$SimpleTopScoreDocCollector$1.collect(TopScoreDocCollector.java:76) ~[lucene-core-8.4.0.jar:8.4.0 bc02ab906445fcf4e297f4ef00ab4a54fdd72ca2 - jpountz - 2019-12-19 20:16:14]  
at org.Elasticsearch.search.aggregations.metrics.TopHitsAggregator$1.collect(TopHitsAggregator.java:156) ~[Elasticsearch-7.6.2.jar:7.6.2]  
at org.Elasticsearch.search.aggregations.bucket.composite.CompositeAggregator$3.collect(CompositeAggregator.java:405) ~[Elasticsearch-7.6.2.jar:7.6.2]

And it is working fine without TopHits aggregation but whenever applied top hits aggregation its breaking and giving error like this..

here is the quey :

#query for currupt doc----field == PRICE\_CTRL ...  
GET /hotfix-qa.masterdataonline.com\_1005\_do\_0\_en\_local2/\_search  
{  
"size": 0,  
"query": {  
"bool": {  
"must": [  
{  
"match": {  
"id": "264682"  
}  
}  
]  
}  
},  
"aggregations": {  
"nested\_tags": {  
"nested": {  
"path": "hyvs.4.rows"  
},  
"aggregations": {  
"bucket": {  
"composite": {  
"size": 1000,  
"sources": [  
{  
"FILTER": {  
"terms": {  
"field": "hyvs.4.rows.PRICE\_CTRL.vc.c.keyword",  
"missing\_bucket": false,  
"order": "desc"  
}  
}  
}  
]  
},  
"aggregations": {  
"items": {  
"top\_hits": {  
"from": 0,  
"size": 100,  
"version": false,  
"seq\_no\_primary\_term": false,  
"explain": true,  
"\_source": {  
"includes": [  
"hyvs.4.rows.PRICE\_CTRL.vc"  
],  
"excludes":   
}  
}  
}  
}  
}  
}  
}  
}  
}

and structure of document....:

![Screenshot from 2021-10-29 11-11-17](https://us1.discourse-cdn.com/elastic/original/3X/c/e/ce573ca04aa566bcfaba1d87f52c647b9f2a979e.png)

If anyone has faced this kind of issue please post the answer ASAP

aprt from this ,the root error was like that......

 ![Screenshot from 2021-10-29 11-14-07](https://us1.discourse-cdn.com/elastic/original/3X/a/c/ace0112c51af09168ab4e87184fb677acbc20a45.png)

---

<div class="post-metadata">

**Author:** ![shreyanshes103](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@shreyanshes103](https://discuss.elastic.co/u/shreyanshes103)\
**Post date:** [November 1, 2021, 8:02am UTC](https://discuss.elastic.co/t/index-128-out-of-bounds-for-length-128/287971/2 "2021-11-01T08:02:11Z")

</div>

Can someone please answer this?

@dadoonet  
@Mark_Harwood

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 29, 2021, 8:02am UTC](https://discuss.elastic.co/t/index-128-out-of-bounds-for-length-128/287971/3 "2021-11-29T08:02:24Z")

</div>

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