[2.2.0] [Java] Embedded Server + Groovy scripts

Hi,
For testing purposes, I need to run a groovy script in an update request against the embedded server. My problem is that I am not able to load a Groove Script Engine. I added this maven dependency:

        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>2.4.0</version>

But I am still getting this error when I try to make a call:

"Caused by: java.lang.IllegalArgumentException: script_lang not supported [groovy]
at org.elasticsearch.script.ScriptService.getScriptEngineServiceForLang(ScriptService.java:211)
at org.elasticsearch.script.ScriptService.compile(ScriptService.java:241)
at org.elasticsearch.script.ScriptService.executable(ScriptService.java:441)
at org.elasticsearch.action.update.UpdateHelper.executeScript(UpdateHelper.java:249)"

Is there any way to run a groovy script in Embedded ES 2.2.0 using Java Client?

My node configuration is like that:

    nodeBuilder
            .clusterName("testing")
            .local(true)
    ;
    nodeBuilder.settings()
            .put("client.transport.ping_timeout", "5s")
            .put("path.home", "test")
            .put("number_of_shards", 1)
            .put("http.enabled", false)
    ;

Embedding elasticsearch is not supported anymore.

So, there is not a solution for my problem even if I use 2.2.0? What is the current proposition for integration testing - run a stand-alone server?

There are plenty of threads about integration testing on this forum.

In short: run your tests against an external server.

If you are using maven, the maven elasticsearch plugin is really nice.
You can also read http://david.pilato.fr/blog/2016/10/18/elasticsearch-real-integration-tests-updated-for-ga/

1 Like

Thanks.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.