feliperazeek / playframework-elasticsearch

Integrate Elastic Search in a Play! Framework Application. This module uses JPA events to notify Elastic Search of events of their own. It embeds a running Elastic Search instance for Rapid Development.
http://geeks.aretotally.in/play-framework-module-elastic-search-distributed-searching-with-json-http-rest-or-java
84 stars 43 forks source link

Nullpointer in the module when trying a very simple search #27

Closed roderik closed 12 years ago

roderik commented 13 years ago

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<Station> 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();
bgooren commented 13 years ago

Hi roderik, 0.2 is unstable, felipe pushed a version which does not work correctly. I've remedied the issue in pull request #24, but I think he released 0.2 before the merge.

For now, please use 0.1, or manually uncomment lines 65-67 in ElasticSearch.java and comment out line 68.

bgooren commented 12 years ago

Hi roderik, have you tried 0.3? if this issue is fixed, please close it.

roderik commented 12 years ago

Hello, i've not had time to play with it any further, we're launching a site based on play this week so i't all hand on deck :) I'll close this for now.