feliperazeek/playframework-elasticsearch — Issue #27: Nullpointer in the module when trying a very simple search
Author: roderik
Created: 2011-10-17 08:33:54+00:00
State: open

I'm trying the most simple query possible to try out elastic search, yet i'm having not a lot of luck. I've tried to describe all related info below. Only thing different from my setup than the documentation is in regard to two dependencies as described in issue #26.

Dependencies used in my project:

- play -> elasticsearch 0.2
- org.elasticsearch -> elasticsearch 0.17.8
- se.scalablesolutions.akka -> akka-amqp 1.2

Method in my controller:

public static void all() {
WildcardQueryBuilder wildcardQuery = QueryBuilders.wildcardQuery("name", "wa*");
SearchResults stations = ElasticSearch.search(wildcardQuery, Station.class);
render(stations);
}

Model Station:

@ElasticSearchable
@Entity
public class Station extends Model {

@Required
public String name;
@Required
public String latitude;
@Required
public String longitude;
}

Exception in the log:

```
Internal Server Error (500) for request GET /all

Execution exception (In /app/controllers/Application.java around line 21)
NullPointerException occured : null

play.exceptions.JavaExecutionException
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:229)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.NullPointerException
at play.modules.elasticsearch.Query.fetch(Query.java:123)
at play.modules.elasticsearch.ElasticSearch.search(ElasticSearch.java:151)
at play.modules.elasticsearch.ElasticSearch.search(ElasticSearch.java:102)
at controllers.Application.all(Application.java:21)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:546)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:500)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:476)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:471)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:159)
... 1 more
```

Line 123 in play.modules.elasticsearch.Query:
```
SearchResponse searchResponse = request.execute().actionGet();
```