Error about script_lang not supported


(Cristi Boariu) #1

I am using elastic search 1.5.2. When running this query from JAVA:

{
 
  "fields" : "_source",
  "script_fields" : {
    "distance" : {
      "script" : "doc['location.pin'].empty? 0 : doc['location.pin'].distanceInMiles(lat,lon);",
      "params" : {
        "lon" : -118.412,
        "lat" : 34.087
      }
    }
  }
}

I receive: nested: ElasticsearchIllegalArgumentException[script_lang not supported [groovy]]; }]

When running this query alone against my server it works.

Do you know what I am missing?


(Lee Hinman) #2

Are you using ES in an embedded way here? ES tries to load the groovy language when it starts up, but if the jar is missing (or it was unable to load it for other reasons), then it disables the scripting language.

You should see a "failed to load groovy" message with a stacktrace in the logs, can you post that here?


(David Pilato) #3

I think you have to add Groovy to your project as it's optional:

        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>2.4.0</version>
            <scope>compile</scope>
            <optional>true</optional>
        </dependency>

(Cristi Boariu) #4

Thanks a lot @dadoonet it works now...


(system) #5