# ArrayIndexOutOfBoundException: -1 with nested facets

**URL:** <https://discuss.elastic.co/t/arrayindexoutofboundexception-1-with-nested-facets/5834>\
**Category:** Elasticsearch\
**Created:** [November 10, 2011, 12:54pm UTC](https://discuss.elastic.co/t/arrayindexoutofboundexception-1-with-nested-facets/5834 "2011-11-10T12:54:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wojciech\_Durczynski](https://avatars.discourse-cdn.com/v4/letter/w/fbc32d/32.png) [@Wojciech\_Durczynski](https://discuss.elastic.co/u/Wojciech_Durczynski)\
**Post date:** [November 10, 2011, 12:54pm UTC](https://discuss.elastic.co/t/arrayindexoutofboundexception-1-with-nested-facets/5834/1 "2011-11-10T12:54:51Z")

</div>

Hello Shay

I noticed a problem with faceting on nested documents.  
If I index some documents with fields of nested type and then do some  
faceting on nested objects - it works.  
But if I reindex my documents (they have changed, so are indexed again to  
the same index and with the same ids), then query with facets causes:

Caused by: org.elasticsearch.search.query.QueryPhaseExecutionException:  
[om\_b3585e93-374b-432a-aa63-9d75b2c2b725][0]:  
query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@c002669b)],from[0],size[0]:  
Query Failed [Failed to execute main query]  
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:221)  
at  
org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:295)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:501)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:492)  
at  
org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:238)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
at java.lang.Thread.run(Thread.java:619)  
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1  
at org.apache.lucene.util.FixedBitSet.prevSetBit(FixedBitSet.java:166)  
at  
org.elasticsearch.index.search.nested.NestedChildrenCollector.collect(NestedChildrenCollector.java:82)  
at  
org.elasticsearch.common.lucene.MultiCollector.collect(MultiCollector.java:57)  
at org.apache.lucene.search.Scorer.score(Scorer.java:90)  
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:526)  
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)  
... 7 more

The problem exists in ES 0.17.8.

---

<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:** [November 13, 2011, 7:07am UTC](https://discuss.elastic.co/t/arrayindexoutofboundexception-1-with-nested-facets/5834/2 "2011-11-13T07:07:22Z")

</div>

Heya,

Another user reported something similar, and still have not managed to  
chase this down. It would really help if you can create a recreation of it,  
including indexing the data. Is it possible?

2011/11/10 Wojciech Durczyński [wojciech.durczynski@comarch.com](mailto:wojciech.durczynski@comarch.com)

> Hello Shay
> 
> I noticed a problem with faceting on nested documents.  
> If I index some documents with fields of nested type and then do some  
> faceting on nested objects - it works.  
> But if I reindex my documents (they have changed, so are indexed again to  
> the same index and with the same ids), then query with facets causes:
> 
> Caused by: org.elasticsearch.search.query.QueryPhaseExecutionException:  
> [om\_b3585e93-374b-432a-aa63-9d75b2c2b725][0]:  
> query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@c002669b)],from[0],size[0]:  
> Query Failed [Failed to execute main query]  
> at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:221)  
> at  
> org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:295)  
> at  
> org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:501)  
> at  
> org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:492)  
> at  
> org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:238)  
> at  
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
> at  
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
> at java.lang.Thread.run(Thread.java:619)  
> Caused by: java.lang.ArrayIndexOutOfBoundsException: -1  
> at org.apache.lucene.util.FixedBitSet.prevSetBit(FixedBitSet.java:166)  
> at  
> org.elasticsearch.index.search.nested.NestedChildrenCollector.collect(NestedChildrenCollector.java:82)  
> at  
> org.elasticsearch.common.lucene.MultiCollector.collect(MultiCollector.java:57)  
> at org.apache.lucene.search.Scorer.score(Scorer.java:90)  
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:526)  
> 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)  
> ... 7 more
> 
> The problem exists in ES 0.17.8.

---

<div class="post-metadata">

**Author:** ![Rubish\_Gupta](https://avatars.discourse-cdn.com/v4/letter/r/45deac/32.png) [@Rubish\_Gupta](https://discuss.elastic.co/u/Rubish_Gupta)\
**Post date:** [November 14, 2011, 7:14am UTC](https://discuss.elastic.co/t/arrayindexoutofboundexception-1-with-nested-facets/5834/3 "2011-11-14T07:14:35Z")

</div>

I am also facing a similar problem, but I am not sure if its related to  
reindexing of docs. It results in the exception even if I delete the index  
and index docs for the first time. I will try to come with a simple  
re-creation.

[2011-11-14 12:38:59,524][DEBUG][action.search.type] [Baron Macabre]  
[development\_users][0], node[oF0hOAX7T6Sx3doYuOHxsA], [P], s[STARTED]:  
Failed to execute [org.elasticsearch.action.search.SearchRequest@70eaa683]  
org.elasticsearch.search.query.QueryPhaseExecutionException:  
[development\_users][0]:  
query[ConstantScore(_:_)],from[0],size[0],sort[\<custom:"profile\_completeness":  
org.elasticsearch.index.field.data.doubles.DoubleFieldDataType$1@4783165b\>!,\<custom:"created\_at":  
org.elasticsearch.index.field.data.longs.LongFieldDataType$1@6f30d50a\>]:  
Query Failed [Failed to execute main query]  
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:221)  
at  
org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:295)  
at  
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteFetch(SearchServiceTransportAction.java:224)  
at  
org.elasticsearch.action.search.type.TransportSearchQueryAndFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryAndFetchAction.java:71)  
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(ThreadPoolExecutor.java:886)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
at java.lang.Thread.run(Thread.java:662)  
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1  
at org.apache.lucene.util.FixedBitSet.prevSetBit(FixedBitSet.java:166)  
at  
org.elasticsearch.index.search.nested.NestedChildrenCollector.collect(NestedChildrenCollector.java:82)  
at  
org.elasticsearch.common.lucene.MultiCollector.collect(MultiCollector.java:57)  
at org.apache.lucene.search.Scorer.score(Scorer.java:90)  
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:526)  
at  
org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:198)  
at  
org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:153)  
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:433)  
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:356)  
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:215)  
... 9 more

I am on elasticsearch/0.17.9

On Sun, Nov 13, 2011 at 12:37 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> Heya,
> 
> Another user reported something similar, and still have not managed to  
> chase this down. It would really help if you can create a recreation of it,  
> including indexing the data. Is it possible?
> 
> 2011/11/10 Wojciech Durczyński [wojciech.durczynski@comarch.com](mailto:wojciech.durczynski@comarch.com)
> 
> > Hello Shay
> > 
> > I noticed a problem with faceting on nested documents.  
> > If I index some documents with fields of nested type and then do some  
> > faceting on nested objects - it works.  
> > But if I reindex my documents (they have changed, so are indexed again to  
> > the same index and with the same ids), then query with facets causes:
> > 
> > Caused by: org.elasticsearch.search.query.QueryPhaseExecutionException:  
> > [om\_b3585e93-374b-432a-aa63-9d75b2c2b725][0]:  
> > query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@c002669b)],from[0],size[0]:  
> > Query Failed [Failed to execute main query]  
> > at  
> > org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:221)  
> > at  
> > org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:295)  
> > at  
> > org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:501)  
> > at  
> > org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:492)  
> > at  
> > org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:238)  
> > at  
> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
> > at  
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
> > at java.lang.Thread.run(Thread.java:619)  
> > Caused by: java.lang.ArrayIndexOutOfBoundsException: -1  
> > at org.apache.lucene.util.FixedBitSet.prevSetBit(FixedBitSet.java:166)  
> > at  
> > org.elasticsearch.index.search.nested.NestedChildrenCollector.collect(NestedChildrenCollector.java:82)  
> > at  
> > org.elasticsearch.common.lucene.MultiCollector.collect(MultiCollector.java:57)  
> > at org.apache.lucene.search.Scorer.score(Scorer.java:90)  
> > at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:526)  
> > 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)  
> > ... 7 more
> > 
> > The problem exists in ES 0.17.8.

---

<div class="post-metadata">

**Author:** ![Rubish\_Gupta](https://avatars.discourse-cdn.com/v4/letter/r/45deac/32.png) [@Rubish\_Gupta](https://discuss.elastic.co/u/Rubish_Gupta)\
**Post date:** [November 14, 2011, 8:25am UTC](https://discuss.elastic.co/t/arrayindexoutofboundexception-1-with-nested-facets/5834/4 "2011-11-14T08:25:06Z")

</div>

Here([ArrayIndexOutOfBound for ES nested facets · GitHub](https://gist.github.com/1363521)) are the curl commands to recreate the  
issue on ES 0.17.9. It is not minimalistic, but just a recreation.

On Mon, Nov 14, 2011 at 12:44 PM, rubish gupta \<[rubish.gupta@almaconnect.com](mailto:rubish.gupta@almaconnect.com)

> wrote:

> I am also facing a similar problem, but I am not sure if its related to  
> reindexing of docs. It results in the exception even if I delete the index  
> and index docs for the first time. I will try to come with a simple  
> re-creation.
> 
> [2011-11-14 12:38:59,524][DEBUG][action.search.type] [Baron  
> Macabre] [development\_users][0], node[oF0hOAX7T6Sx3doYuOHxsA], [P],  
> s[STARTED]: Failed to execute  
> [org.elasticsearch.action.search.SearchRequest@70eaa683]  
> org.elasticsearch.search.query.QueryPhaseExecutionException:  
> [development\_users][0]:  
> query[ConstantScore(_:_)],from[0],size[0],sort[\<custom:"profile\_completeness":  
> org.elasticsearch.index.field.data.doubles.DoubleFieldDataType$1@4783165b\>!,\<custom:"created\_at":  
> org.elasticsearch.index.field.data.longs.LongFieldDataType$1@6f30d50a\>]:  
> Query Failed [Failed to execute main query]  
> at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:221)  
> at  
> org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:295)  
> at  
> org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteFetch(SearchServiceTransportAction.java:224)  
> at  
> org.elasticsearch.action.search.type.TransportSearchQueryAndFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryAndFetchAction.java:71)  
> 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(ThreadPoolExecutor.java:886)  
> at  
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
> at java.lang.Thread.run(Thread.java:662)  
> Caused by: java.lang.ArrayIndexOutOfBoundsException: -1  
> at org.apache.lucene.util.FixedBitSet.prevSetBit(FixedBitSet.java:166)  
> at  
> org.elasticsearch.index.search.nested.NestedChildrenCollector.collect(NestedChildrenCollector.java:82)  
> at  
> org.elasticsearch.common.lucene.MultiCollector.collect(MultiCollector.java:57)  
> at org.apache.lucene.search.Scorer.score(Scorer.java:90)  
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:526)  
> at  
> org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:198)  
> at  
> org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:153)  
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:433)  
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:356)  
> at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:215)  
> ... 9 more
> 
> I am on elasticsearch/0.17.9
> 
> On Sun, Nov 13, 2011 at 12:37 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> 
> > Heya,
> > 
> > Another user reported something similar, and still have not managed to  
> > chase this down. It would really help if you can create a recreation of it,  
> > including indexing the data. Is it possible?
> > 
> > 2011/11/10 Wojciech Durczyński [wojciech.durczynski@comarch.com](mailto:wojciech.durczynski@comarch.com)
> > 
> > > Hello Shay
> > > 
> > > I noticed a problem with faceting on nested documents.  
> > > If I index some documents with fields of nested type and then do some  
> > > faceting on nested objects - it works.  
> > > But if I reindex my documents (they have changed, so are indexed again  
> > > to the same index and with the same ids), then query with facets causes:
> > > 
> > > Caused by: org.elasticsearch.search.query.QueryPhaseExecutionException:  
> > > [om\_b3585e93-374b-432a-aa63-9d75b2c2b725][0]:  
> > > query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@c002669b)],from[0],size[0]:  
> > > Query Failed [Failed to execute main query]  
> > > at  
> > > org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:221)  
> > > at  
> > > org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:295)  
> > > at  
> > > org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:501)  
> > > at  
> > > org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:492)  
> > > at  
> > > org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:238)  
> > > at  
> > > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
> > > at  
> > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
> > > at java.lang.Thread.run(Thread.java:619)  
> > > Caused by: java.lang.ArrayIndexOutOfBoundsException: -1  
> > > at org.apache.lucene.util.FixedBitSet.prevSetBit(FixedBitSet.java:166)  
> > > at  
> > > org.elasticsearch.index.search.nested.NestedChildrenCollector.collect(NestedChildrenCollector.java:82)  
> > > at  
> > > org.elasticsearch.common.lucene.MultiCollector.collect(MultiCollector.java:57)  
> > > at org.apache.lucene.search.Scorer.score(Scorer.java:90)  
> > > at  
> > > org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:526)  
> > > 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)  
> > > ... 7 more
> > > 
> > > The problem exists in ES 0.17.8.

---

<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:** [November 15, 2011, 7:42am UTC](https://discuss.elastic.co/t/arrayindexoutofboundexception-1-with-nested-facets/5834/5 "2011-11-15T07:42:57Z")

</div>

Heya,

Thanks for the recreation!, fixed:  
[https://github.com/elasticsearch/elasticsearch/issues/1467](https://github.com/elasticsearch/elasticsearch/issues/1467).

-shay.banon

On Mon, Nov 14, 2011 at 9:14 AM, rubish gupta  
[rubish.gupta@almaconnect.com](mailto:rubish.gupta@almaconnect.com)wrote:

> I am also facing a similar problem, but I am not sure if its related to  
> reindexing of docs. It results in the exception even if I delete the index  
> and index docs for the first time. I will try to come with a simple  
> re-creation.
> 
> [2011-11-14 12:38:59,524][DEBUG][action.search.type] [Baron  
> Macabre] [development\_users][0], node[oF0hOAX7T6Sx3doYuOHxsA], [P],  
> s[STARTED]: Failed to execute  
> [org.elasticsearch.action.search.SearchRequest@70eaa683]  
> org.elasticsearch.search.query.QueryPhaseExecutionException:  
> [development\_users][0]:  
> query[ConstantScore(_:_)],from[0],size[0],sort[\<custom:"profile\_completeness":  
> org.elasticsearch.index.field.data.doubles.DoubleFieldDataType$1@4783165b\>!,\<custom:"created\_at":  
> org.elasticsearch.index.field.data.longs.LongFieldDataType$1@6f30d50a\>]:  
> Query Failed [Failed to execute main query]  
> at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:221)  
> at  
> org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:295)  
> at  
> org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteFetch(SearchServiceTransportAction.java:224)  
> at  
> org.elasticsearch.action.search.type.TransportSearchQueryAndFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryAndFetchAction.java:71)  
> 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(ThreadPoolExecutor.java:886)  
> at  
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
> at java.lang.Thread.run(Thread.java:662)  
> Caused by: java.lang.ArrayIndexOutOfBoundsException: -1  
> at org.apache.lucene.util.FixedBitSet.prevSetBit(FixedBitSet.java:166)  
> at  
> org.elasticsearch.index.search.nested.NestedChildrenCollector.collect(NestedChildrenCollector.java:82)  
> at  
> org.elasticsearch.common.lucene.MultiCollector.collect(MultiCollector.java:57)  
> at org.apache.lucene.search.Scorer.score(Scorer.java:90)  
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:526)  
> at  
> org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:198)  
> at  
> org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:153)  
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:433)  
> at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:356)  
> at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:215)  
> ... 9 more
> 
> I am on elasticsearch/0.17.9
> 
> On Sun, Nov 13, 2011 at 12:37 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> 
> > Heya,
> > 
> > Another user reported something similar, and still have not managed to  
> > chase this down. It would really help if you can create a recreation of it,  
> > including indexing the data. Is it possible?
> > 
> > 2011/11/10 Wojciech Durczyński [wojciech.durczynski@comarch.com](mailto:wojciech.durczynski@comarch.com)
> > 
> > > Hello Shay
> > > 
> > > I noticed a problem with faceting on nested documents.  
> > > If I index some documents with fields of nested type and then do some  
> > > faceting on nested objects - it works.  
> > > But if I reindex my documents (they have changed, so are indexed again  
> > > to the same index and with the same ids), then query with facets causes:
> > > 
> > > Caused by: org.elasticsearch.search.query.QueryPhaseExecutionException:  
> > > [om\_b3585e93-374b-432a-aa63-9d75b2c2b725][0]:  
> > > query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@c002669b)],from[0],size[0]:  
> > > Query Failed [Failed to execute main query]  
> > > at  
> > > org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:221)  
> > > at  
> > > org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:295)  
> > > at  
> > > org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:501)  
> > > at  
> > > org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:492)  
> > > at  
> > > org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:238)  
> > > at  
> > > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
> > > at  
> > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
> > > at java.lang.Thread.run(Thread.java:619)  
> > > Caused by: java.lang.ArrayIndexOutOfBoundsException: -1  
> > > at org.apache.lucene.util.FixedBitSet.prevSetBit(FixedBitSet.java:166)  
> > > at  
> > > org.elasticsearch.index.search.nested.NestedChildrenCollector.collect(NestedChildrenCollector.java:82)  
> > > at  
> > > org.elasticsearch.common.lucene.MultiCollector.collect(MultiCollector.java:57)  
> > > at org.apache.lucene.search.Scorer.score(Scorer.java:90)  
> > > at  
> > > org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:526)  
> > > 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)  
> > > ... 7 more
> > > 
> > > The problem exists in ES 0.17.8.

---

<div class="post-metadata">

**Author:** ![Rubish\_Gupta](https://avatars.discourse-cdn.com/v4/letter/r/45deac/32.png) [@Rubish\_Gupta](https://discuss.elastic.co/u/Rubish_Gupta)\
**Post date:** [November 15, 2011, 8:21am UTC](https://discuss.elastic.co/t/arrayindexoutofboundexception-1-with-nested-facets/5834/6 "2011-11-15T08:21:12Z")

</div>

Thanks for the quick fix. Will this be included in 0.18.3?

2011/11/15 Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com)

> Heya,
> 
> Thanks for the recreation!, fixed:  
> [Nested facet execution can fail with ArrayIndexOutOfBounds · Issue #1467 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1467).
> 
> -shay.banon
> 
> On Mon, Nov 14, 2011 at 9:14 AM, rubish gupta \<  
> [rubish.gupta@almaconnect.com](mailto:rubish.gupta@almaconnect.com)\> wrote:
> 
> > I am also facing a similar problem, but I am not sure if its related to  
> > reindexing of docs. It results in the exception even if I delete the index  
> > and index docs for the first time. I will try to come with a simple  
> > re-creation.
> > 
> > [2011-11-14 12:38:59,524][DEBUG][action.search.type] [Baron  
> > Macabre] [development\_users][0], node[oF0hOAX7T6Sx3doYuOHxsA], [P],  
> > s[STARTED]: Failed to execute  
> > [org.elasticsearch.action.search.SearchRequest@70eaa683]  
> > org.elasticsearch.search.query.QueryPhaseExecutionException:  
> > [development\_users][0]:  
> > query[ConstantScore(_:_)],from[0],size[0],sort[\<custom:"profile\_completeness":  
> > org.elasticsearch.index.field.data.doubles.DoubleFieldDataType$1@4783165b\>!,\<custom:"created\_at":  
> > org.elasticsearch.index.field.data.longs.LongFieldDataType$1@6f30d50a\>]:  
> > Query Failed [Failed to execute main query]  
> > at  
> > org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:221)  
> > at  
> > org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:295)  
> > at  
> > org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteFetch(SearchServiceTransportAction.java:224)  
> > at  
> > org.elasticsearch.action.search.type.TransportSearchQueryAndFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryAndFetchAction.java:71)  
> > 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(ThreadPoolExecutor.java:886)  
> > at  
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
> > at java.lang.Thread.run(Thread.java:662)  
> > Caused by: java.lang.ArrayIndexOutOfBoundsException: -1  
> > at org.apache.lucene.util.FixedBitSet.prevSetBit(FixedBitSet.java:166)  
> > at  
> > org.elasticsearch.index.search.nested.NestedChildrenCollector.collect(NestedChildrenCollector.java:82)  
> > at  
> > org.elasticsearch.common.lucene.MultiCollector.collect(MultiCollector.java:57)  
> > at org.apache.lucene.search.Scorer.score(Scorer.java:90)  
> > at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:526)  
> > at  
> > org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:198)  
> > at  
> > org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:153)  
> > at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:433)  
> > at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:356)  
> > at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:215)  
> > ... 9 more
> > 
> > I am on elasticsearch/0.17.9
> > 
> > On Sun, Nov 13, 2011 at 12:37 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > 
> > > Heya,
> > > 
> > > Another user reported something similar, and still have not managed to  
> > > chase this down. It would really help if you can create a recreation of it,  
> > > including indexing the data. Is it possible?
> > > 
> > > 2011/11/10 Wojciech Durczyński [wojciech.durczynski@comarch.com](mailto:wojciech.durczynski@comarch.com)
> > > 
> > > > Hello Shay
> > > > 
> > > > I noticed a problem with faceting on nested documents.  
> > > > If I index some documents with fields of nested type and then do some  
> > > > faceting on nested objects - it works.  
> > > > But if I reindex my documents (they have changed, so are indexed again  
> > > > to the same index and with the same ids), then query with facets causes:
> > > > 
> > > > Caused by: org.elasticsearch.search.query.QueryPhaseExecutionException:  
> > > > [om\_b3585e93-374b-432a-aa63-9d75b2c2b725][0]:  
> > > > query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@c002669b)],from[0],size[0]:  
> > > > Query Failed [Failed to execute main query]  
> > > > at  
> > > > org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:221)  
> > > > at  
> > > > org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:295)  
> > > > at  
> > > > org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:501)  
> > > > at  
> > > > org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:492)  
> > > > at  
> > > > org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:238)  
> > > > at  
> > > > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
> > > > at  
> > > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
> > > > at java.lang.Thread.run(Thread.java:619)  
> > > > Caused by: java.lang.ArrayIndexOutOfBoundsException: -1  
> > > > at org.apache.lucene.util.FixedBitSet.prevSetBit(FixedBitSet.java:166)  
> > > > at  
> > > > org.elasticsearch.index.search.nested.NestedChildrenCollector.collect(NestedChildrenCollector.java:82)  
> > > > at  
> > > > org.elasticsearch.common.lucene.MultiCollector.collect(MultiCollector.java:57)  
> > > > at org.apache.lucene.search.Scorer.score(Scorer.java:90)  
> > > > at  
> > > > org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:526)  
> > > > 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)  
> > > > ... 7 more
> > > > 
> > > > The problem exists in ES 0.17.8.

---

<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:** [November 15, 2011, 8:43am UTC](https://discuss.elastic.co/t/arrayindexoutofboundexception-1-with-nested-facets/5834/7 "2011-11-15T08:43:46Z")

</div>

Yes, each issue inclues tag that shows which version they will be in.

On Tue, Nov 15, 2011 at 10:21 AM, rubish gupta \<[rubish.gupta@almaconnect.com](mailto:rubish.gupta@almaconnect.com)

> wrote:

> Thanks for the quick fix. Will this be included in 0.18.3?
> 
> 2011/11/15 Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com)
> 
> > Heya,
> > 
> > Thanks for the recreation!, fixed:  
> > [Nested facet execution can fail with ArrayIndexOutOfBounds · Issue #1467 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1467).
> > 
> > -shay.banon
> > 
> > On Mon, Nov 14, 2011 at 9:14 AM, rubish gupta \<  
> > [rubish.gupta@almaconnect.com](mailto:rubish.gupta@almaconnect.com)\> wrote:
> > 
> > > I am also facing a similar problem, but I am not sure if its related to  
> > > reindexing of docs. It results in the exception even if I delete the index  
> > > and index docs for the first time. I will try to come with a simple  
> > > re-creation.
> > > 
> > > [2011-11-14 12:38:59,524][DEBUG][action.search.type] [Baron  
> > > Macabre] [development\_users][0], node[oF0hOAX7T6Sx3doYuOHxsA], [P],  
> > > s[STARTED]: Failed to execute  
> > > [org.elasticsearch.action.search.SearchRequest@70eaa683]  
> > > org.elasticsearch.search.query.QueryPhaseExecutionException:  
> > > [development\_users][0]:  
> > > query[ConstantScore(_:_)],from[0],size[0],sort[\<custom:"profile\_completeness":  
> > > org.elasticsearch.index.field.data.doubles.DoubleFieldDataType$1@4783165b\>!,\<custom:"created\_at":  
> > > org.elasticsearch.index.field.data.longs.LongFieldDataType$1@6f30d50a\>]:  
> > > Query Failed [Failed to execute main query]  
> > > at  
> > > org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:221)  
> > > at  
> > > org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:295)  
> > > at  
> > > org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteFetch(SearchServiceTransportAction.java:224)  
> > > at  
> > > org.elasticsearch.action.search.type.TransportSearchQueryAndFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryAndFetchAction.java:71)  
> > > 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(ThreadPoolExecutor.java:886)  
> > > at  
> > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
> > > at java.lang.Thread.run(Thread.java:662)  
> > > Caused by: java.lang.ArrayIndexOutOfBoundsException: -1  
> > > at org.apache.lucene.util.FixedBitSet.prevSetBit(FixedBitSet.java:166)  
> > > at  
> > > org.elasticsearch.index.search.nested.NestedChildrenCollector.collect(NestedChildrenCollector.java:82)  
> > > at  
> > > org.elasticsearch.common.lucene.MultiCollector.collect(MultiCollector.java:57)  
> > > at org.apache.lucene.search.Scorer.score(Scorer.java:90)  
> > > at  
> > > org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:526)  
> > > at  
> > > org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:198)  
> > > at  
> > > org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:153)  
> > > at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:433)  
> > > at  
> > > org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:356)  
> > > at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:215)  
> > > ... 9 more
> > > 
> > > I am on elasticsearch/0.17.9
> > > 
> > > On Sun, Nov 13, 2011 at 12:37 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:
> > > 
> > > > Heya,
> > > > 
> > > > Another user reported something similar, and still have not managed  
> > > > to chase this down. It would really help if you can create a recreation of  
> > > > it, including indexing the data. Is it possible?
> > > > 
> > > > 2011/11/10 Wojciech Durczyński [wojciech.durczynski@comarch.com](mailto:wojciech.durczynski@comarch.com)
> > > > 
> > > > > Hello Shay
> > > > > 
> > > > > I noticed a problem with faceting on nested documents.  
> > > > > If I index some documents with fields of nested type and then do some  
> > > > > faceting on nested objects - it works.  
> > > > > But if I reindex my documents (they have changed, so are indexed again  
> > > > > to the same index and with the same ids), then query with facets causes:
> > > > > 
> > > > > Caused by:  
> > > > > org.elasticsearch.search.query.QueryPhaseExecutionException:  
> > > > > [om\_b3585e93-374b-432a-aa63-9d75b2c2b725][0]:  
> > > > > query[ConstantScore(org.elasticsearch.common.lucene.search.AndFilter@c002669b)],from[0],size[0]:  
> > > > > Query Failed [Failed to execute main query]  
> > > > > at  
> > > > > org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:221)  
> > > > > at  
> > > > > org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:295)  
> > > > > at  
> > > > > org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:501)  
> > > > > at  
> > > > > org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:492)  
> > > > > at  
> > > > > org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:238)  
> > > > > at  
> > > > > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)  
> > > > > at  
> > > > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
> > > > > at java.lang.Thread.run(Thread.java:619)  
> > > > > Caused by: java.lang.ArrayIndexOutOfBoundsException: -1  
> > > > > at org.apache.lucene.util.FixedBitSet.prevSetBit(FixedBitSet.java:166)  
> > > > > at  
> > > > > org.elasticsearch.index.search.nested.NestedChildrenCollector.collect(NestedChildrenCollector.java:82)  
> > > > > at  
> > > > > org.elasticsearch.common.lucene.MultiCollector.collect(MultiCollector.java:57)  
> > > > > at org.apache.lucene.search.Scorer.score(Scorer.java:90)  
> > > > > at  
> > > > > org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:526)  
> > > > > 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)  
> > > > > ... 7 more
> > > > > 
> > > > > The problem exists in ES 0.17.8.

---

<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:48am UTC](https://discuss.elastic.co/t/arrayindexoutofboundexception-1-with-nested-facets/5834/8 "2017-07-06T03:48:37Z")

</div>


