Recently I was upgrading from Elasticsearch 1.1.1 to 1.3.1 and I wanted to change a dynamic script from MVEL to Groovy as MVEL is not sandboxed and thus deprecated. While all my manual tests on a standalone ES 1.3.1 worked perfectly, my automated tests running an in-memory ES node kept on failing with:
ElasticsearchIllegalArgumentException[script_lang not supported [groovy]];
I then changed the log level and saw this:
DEBUG org.elasticsearch.script - [Spymaster] failed to load groovy
java.lang.ClassNotFoundException: groovy.lang.GroovyClassLoader
So the solution was simply to add the same groovy dependency to my pom file as was in the lib folder of the standalone ES installation:
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.3.2</version>
<scope>test</scope>
</dependency>