# Still have a bug? Query Failed ArrayIndexOutOfBoundsException

**URL:** <https://discuss.elastic.co/t/still-have-a-bug-query-failed-arrayindexoutofboundsexception/5664>\
**Category:** Elasticsearch\
**Created:** [October 23, 2011, 8:44pm UTC](https://discuss.elastic.co/t/still-have-a-bug-query-failed-arrayindexoutofboundsexception/5664 "2011-10-23T20:44:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bryan\_Green](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bryan_green/32/3028_2.png) [@Bryan\_Green](https://discuss.elastic.co/u/Bryan_Green)\
**Post date:** [October 23, 2011, 8:44pm UTC](https://discuss.elastic.co/t/still-have-a-bug-query-failed-arrayindexoutofboundsexception/5664/1 "2011-10-23T20:44:04Z")

</div>

Hi,

I'm running 0.17.9. This might be similar to 1400 that I reported on  
previously. I'm going to delete the indexes and refresh the data (seemed to  
fix it last time.) (and it fixed it this time 🙂

Here is some more information.

Thanks again,  
Bryan Green

_Search results_ (26 hits reported from 5 shards, one failure...)  
{  
"took": 24,  
"timed\_out": false,  
"\_shards": {  
"total": 6,  
"successful": 5,  
"failed": 1,  
"failures": [  
{  
"index": "kk",  
"shard": 1,  
"status": 500,  
"reason": "QueryPhaseExecutionException[[kk][1]:  
query[ConstantScore(_:_)],from[0],size[999]: Query Failed [Failed to execute  
main query]]; nested: ArrayIndexOutOfBoundsException[7]; "  
}  
]  
}

_error log_  
[2011-10-23 14:48:40,074][DEBUG][action.search.type] [Bloom, Astrid]  
[kk]  
[1], node[Lmmlvrg3TneuX9nXGzCWvw], [P], s[STARTED]: Failed to execute  
[org.elasticsearch.action.search.SearchRequest@46837311]  
org.elasticsearch.search.query.QueryPhaseExecutionException: [kk][1]:  
query[ConstantScore(_:_)],from[0],size[999]: Query Failed [Failed to execute  
main query]  
at  
org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:221)  
at  
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:234)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:134)  
at  
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:205)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:192)  
at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:178)  
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown  
Source)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown  
Source)  
at java.lang.Thread.run(Unknown Source)  
Caused by: java.lang.ArrayIndexOutOfBoundsException: 7  
at  
org.apache.lucene.util.FixedBitSet.nextSetBit(FixedBitSet.java:144)  
at  
org.elasticsearch.common.lucene.docset.DocSets.and(DocSets.java:86)  
at  
org.elasticsearch.common.lucene.search.XBooleanFilter.getDocIdSet(XBooleanFilter.java:107)  
at  
org.elasticsearch.common.lucene.search.FilteredCollector.setNextReader(FilteredCollector.java:59)  
at  
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:523)  
at  
org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:198)  
at  
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:391)  
at  
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:298)  
at  
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:286)  
at  
org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:217)  
... 9 more

_Here is my query:_  
{  
"from": 0,  
"size": 999,  
"filter": {  
"bool": {  
"must": [  
{  
"or": [  
{  
"term": {  
"s\_field\_type": "image"  
}  
},  
{  
"missing": {  
"field": "s\_field\_type"  
}  
}  
]  
},  
{  
"or": [  
{  
"term": {  
"item\_attr\_items": "item\_attr"  
}  
},  
{  
"missing": {  
"field": "item\_attr\_items"  
}  
}  
]  
}  
]  
}  
}  
}

What else would be helpful?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [October 23, 2011, 10:31pm UTC](https://discuss.elastic.co/t/still-have-a-bug-query-failed-arrayindexoutofboundsexception/5664/2 "2011-10-23T22:31:58Z")

</div>

Grr, seems like there is still a problem with bool filter..., fixed in  
[Bool Filter fails with ArrayIndexOutOfBoundsException · Issue #1419 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1419) on both 0.17 and  
master branches.

On Sun, Oct 23, 2011 at 10:44 PM, Bryan Green [bryogreen@gmail.com](mailto:bryogreen@gmail.com) wrote:

> Hi,
> 
> I'm running 0.17.9. This might be similar to 1400 that I reported on  
> previously. I'm going to delete the indexes and refresh the data (seemed to  
> fix it last time.) (and it fixed it this time 🙂
> 
> Here is some more information.
> 
> Thanks again,  
> Bryan Green
> 
> _Search results_ (26 hits reported from 5 shards, one failure...)  
> {  
> "took": 24,  
> "timed\_out": false,  
> "\_shards": {  
> "total": 6,  
> "successful": 5,  
> "failed": 1,  
> "failures": [  
> {  
> "index": "kk",  
> "shard": 1,  
> "status": 500,  
> "reason": "QueryPhaseExecutionException[[kk][1]:  
> query[ConstantScore(_:_)],from[0],size[999]: Query Failed [Failed to execute  
> main query]]; nested: ArrayIndexOutOfBoundsException[7]; "  
> }  
> ]  
> }
> 
> _error log_  
> [2011-10-23 14:48:40,074][DEBUG][action.search.type] [Bloom, Astrid]  
> [kk]  
> [1], node[Lmmlvrg3TneuX9nXGzCWvw], [P], s[STARTED]: Failed to execute  
> [org.elasticsearch.action.search.SearchRequest@46837311]  
> org.elasticsearch.search.query.QueryPhaseExecutionException: [kk][1]:  
> query[ConstantScore(_:_)],from[0],size[999]: Query Failed [Failed to execute  
> main query]  
> at  
> org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:221)  
> at  
> org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:234)  
> at  
> org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:134)  
> at  
> org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)  
> at  
> org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:205)  
> at  
> org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:192)  
> at  
> org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:178)  
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown  
> Source)  
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown  
> Source)  
> at java.lang.Thread.run(Unknown Source)  
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 7  
> at  
> org.apache.lucene.util.FixedBitSet.nextSetBit(FixedBitSet.java:144)  
> at  
> org.elasticsearch.common.lucene.docset.DocSets.and(DocSets.java:86)  
> at  
> org.elasticsearch.common.lucene.search.XBooleanFilter.getDocIdSet(XBooleanFilter.java:107)  
> at  
> org.elasticsearch.common.lucene.search.FilteredCollector.setNextReader(FilteredCollector.java:59)  
> at  
> org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:523)  
> at  
> org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:198)  
> at  
> org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:391)  
> at  
> org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:298)  
> at  
> org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:286)  
> at  
> org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:217)  
> ... 9 more
> 
> _Here is my query:_  
> {  
> "from": 0,  
> "size": 999,  
> "filter": {  
> "bool": {  
> "must": [  
> {  
> "or": [  
> {  
> "term": {  
> "s\_field\_type": "image"  
> }  
> },  
> {  
> "missing": {  
> "field": "s\_field\_type"  
> }  
> }  
> ]  
> },  
> {  
> "or": [  
> {  
> "term": {  
> "item\_attr\_items": "item\_attr"  
> }  
> },  
> {  
> "missing": {  
> "field": "item\_attr\_items"  
> }  
> }  
> ]  
> }  
> ]  
> }  
> }  
> }
> 
> What else would be helpful?

---

<div class="post-metadata">

**Author:** ![Bryan\_Green](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bryan_green/32/3028_2.png) [@Bryan\_Green](https://discuss.elastic.co/u/Bryan_Green)\
**Post date:** [October 24, 2011, 2:45am UTC](https://discuss.elastic.co/t/still-have-a-bug-query-failed-arrayindexoutofboundsexception/5664/3 "2011-10-24T02:45:37Z")

</div>

All is well that ends well. Thank you Shay.

---

<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:** [July 6, 2017, 3:51am UTC](https://discuss.elastic.co/t/still-have-a-bug-query-failed-arrayindexoutofboundsexception/5664/4 "2017-07-06T03:51:06Z")

</div>


