# NPE in ContextIndexSearcher

**URL:** <https://discuss.elastic.co/t/npe-in-contextindexsearcher/4420>\
**Category:** Elasticsearch\
**Created:** [May 17, 2011, 7:19am UTC](https://discuss.elastic.co/t/npe-in-contextindexsearcher/4420 "2011-05-17T07:19:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dpilato](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dpilato/32/2449_2.png) [@dpilato](https://discuss.elastic.co/u/dpilato)\
**Post date:** [May 17, 2011, 7:19am UTC](https://discuss.elastic.co/t/npe-in-contextindexsearcher/4420/1 "2011-05-17T07:19:19Z")

</div>

Hi,

I'm using the ElasticSearch FrontEnd client ( [https://github.com/mobz/elasticsearch-head](https://github.com/mobz/elasticsearch-head) ). The last version in master...

I use it with ES 0.16.1.

When I try to search (simple match\_all query), I get a NPE.

Here is what ESFrontEnd is sending to ES :  
{  
query: {  
bool: {  
must: [  
{  
match\_all: { }  
}  
]  
must\_not: []  
should: []  
}  
}  
from: 0  
size: 50  
sort: []  
facets: { }  
}

In ES logs, I get :  
[2011-05-17 09:08:40,592][DEBUG][action.search.type] [The Entity] [dau][4], node[6bzzlBiuTVu52IhXYwE4Qw], [P], s[STARTED]: Failed to execute [org.elasticsearch.action.search.SearchRequest@1b6ba28]  
java.lang.NullPointerException  
at org.elasticsearch.search.internal.ContextIndexSearcher.removeCollectors(ContextIndexSearcher.java:81)  
at org.elasticsearch.search.facet.FacetPhase.execute(FacetPhase.java:72)  
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:220)  
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:222)  
at org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:134)  
at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:76)  
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:192)  
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.access$000(TransportSearchTypeAction.java:75)  
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$1.run(TransportSearchTypeAction.java:151)  
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)

It seems that there is a NPE in ContextIndexSearcher.removeCollectors().  
Something strange is that I'm not in DEBUG mode. I use the standard logging setup file but the trace seems to be a DEBUG trace...

Thanks for any help.  
Should I open a bug for that ?

Cheers

---

<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:** [May 17, 2011, 1:02pm UTC](https://discuss.elastic.co/t/npe-in-contextindexsearcher/4420/2 "2011-05-17T13:02:52Z")

</div>

Heya,

Yea, this looks like a possible bug when providing empty facets element. Opened an issue for it: [Search: Empty facets element causes search failures · Issue #938 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/938).

-shay.banon  
On Tuesday, May 17, 2011 at 10:19 AM, dpilato wrote:

> Hi,
> 
> I'm using the Elasticsearch FrontEnd client (  
> [GitHub - mobz/elasticsearch-head: A web front end for an elastic search cluster](https://github.com/mobz/elasticsearch-head) ). The last version in master...
> 
> I use it with ES 0.16.1.
> 
> When I try to search (simple match\_all query), I get a NPE.
> 
> Here is what ESFrontEnd is sending to ES :  
> {  
> query: {  
> bool: {  
> must: [  
> {  
> match\_all: { }  
> }  
> ]  
> must\_not:   
> should:   
> }  
> }  
> from: 0  
> size: 50  
> sort:   
> facets: { }  
> }
> 
> In ES logs, I get :  
> [2011-05-17 09:08:40,592][DEBUG][action.search.type] [The Entity]  
> [dau][4], node[6bzzlBiuTVu52IhXYwE4Qw], [P], s[STARTED]: Failed to execute  
> [org.elasticsearch.action.search.SearchRequest@1b6ba28]  
> java.lang.NullPointerException  
> at  
> org.elasticsearch.search.internal.ContextIndexSearcher.removeCollectors(ContextIndexSearcher.java:81)  
> at org.elasticsearch.search.facet.FacetPhase.execute(FacetPhase.java:72)  
> at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:220)  
> at  
> org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:222)  
> at  
> org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:134)  
> at  
> org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:76)  
> at  
> org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:192)  
> at  
> org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.access$000(TransportSearchTypeAction.java:75)  
> at  
> org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$1.run(TransportSearchTypeAction.java:151)  
> 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)
> 
> It seems that there is a NPE in ContextIndexSearcher.removeCollectors().  
> Something strange is that I'm not in DEBUG mode. I use the standard logging  
> setup file but the trace seems to be a DEBUG trace...
> 
> Thanks for any help.  
> Should I open a bug for that ?
> 
> Cheers
> 
> --  
> View this message in context: [http://elasticsearch-users.115913.n3.nabble.com/NPE-in-ContextIndexSearcher-tp2951467p2951467.html](http://elasticsearch-users.115913.n3.nabble.com/NPE-in-ContextIndexSearcher-tp2951467p2951467.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![Alois\_Cochard](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alois_cochard/32/3176_2.png) [@Alois\_Cochard](https://discuss.elastic.co/u/Alois_Cochard)\
**Post date:** [May 24, 2011, 6:10am UTC](https://discuss.elastic.co/t/npe-in-contextindexsearcher/4420/3 "2011-05-24T06:10:51Z")

</div>

I have same exception on my cluster when trying to open elasticsearch-  
head browser ☹

On May 17, 3:02 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Heya,
> 
> Yea, this looks like a possible bug when providing empty facets element. Opened an issue for it:[Search: Empty facets element causes search failures · Issue #938 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/938).
> 
> -shay.banon
> 
> On Tuesday, May 17, 2011 at 10:19 AM, dpilato wrote:
> 
> > Hi,
> 
> > I'm using the Elasticsearch FrontEnd client (  
> > [GitHub - mobz/elasticsearch-head: A web front end for an elastic search cluster](https://github.com/mobz/elasticsearch-head)). The last version in master...
> 
> > I use it with ES 0.16.1.
> 
> > When I try to search (simple match\_all query), I get a NPE.
> 
> > Here is what ESFrontEnd is sending to ES :  
> > {  
> > query: {  
> > bool: {  
> > must: [  
> > {  
> > match\_all: { }  
> > }  
> > ]  
> > must\_not:   
> > should:   
> > }  
> > }  
> > from: 0  
> > size: 50  
> > sort:   
> > facets: { }  
> > }
> 
> > In ES logs, I get :  
> > [2011-05-17 09:08:40,592][DEBUG][action.search.type] [The Entity]  
> > [dau][4], node[6bzzlBiuTVu52IhXYwE4Qw], [P], s[STARTED]: Failed to execute  
> > [org.elasticsearch.action.search.SearchRequest@1b6ba28]  
> > java.lang.NullPointerException  
> > at  
> > org.elasticsearch.search.internal.ContextIndexSearcher.removeCollectors(Con textIndexSearcher.java:81)  
> > at org.elasticsearch.search.facet.FacetPhase.execute(FacetPhase.java:72)  
> > at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:220)  
> > at  
> > org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java :222)  
> > at  
> > org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQue ry(SearchServiceTransportAction.java:134)  
> > at  
> > org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$As yncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:76 )  
> > at  
> > org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAct ion.performFirstPhase(TransportSearchTypeAction.java:192)  
> > at  
> > org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAct ion.access$000(TransportSearchTypeAction.java:75)  
> > at  
> > org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAct ion$1.run(TransportSearchTypeAction.java:151)  
> > at  
> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.j ava:886)  
> > at  
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java: 908)  
> > at java.lang.Thread.run(Thread.java:619)
> 
> > It seems that there is a NPE in ContextIndexSearcher.removeCollectors().  
> > Something strange is that I'm not in DEBUG mode. I use the standard logging  
> > setup file but the trace seems to be a DEBUG trace...
> 
> > Thanks for any help.  
> > Should I open a bug for that ?
> 
> > Cheers
> 
> > --  
> > View this message in context:[http://elasticsearch-users.115913.n3.nabble.com/NPE-in-ContextIndexSe](http://elasticsearch-users.115913.n3.nabble.com/NPE-in-ContextIndexSe)...  
> > Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<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, 4:05am UTC](https://discuss.elastic.co/t/npe-in-contextindexsearcher/4420/4 "2017-07-06T04:05:30Z")

</div>


