Lang-expression in an embedded Elastic environment

(Tom) #1

Hi, I've recently upgraded to Elastic 2.2.0 (from 1.7.x) to take advantage of the pipeline aggregations.

I have an embedded Elastic for integration/functional tests (that was working flawlessly) but now that Lucene expressions engine has been pulled out from the core, my embedded Elastic fails to handle queries with inline scripts, as shown below: [reduce] 
	at$AsyncAction$1.onFailure( ~[elasticsearch-2.2.0.jar:2.2.0]
	at ~[elasticsearch-2.2.0.jar:2.2.0]
	at java.util.concurrent.ThreadPoolExecutor.runWorker( ~[?:1.8.0_45]
	at java.util.concurrent.ThreadPoolExecutor$ ~[?:1.8.0_45]
	at ~[?:1.8.0_45]
Caused by: java.lang.IllegalArgumentException: script_lang not supported [expression]
	at org.elasticsearch.script.ScriptService.getScriptEngineServiceForLang( ~[elasticsearch-2.2.0.jar:2.2.0]
	at org.elasticsearch.script.ScriptService.compile( ~[elasticsearch-2.2.0.jar:2.2.0]
	at ~[elasticsearch-2.2.0.jar:2.2.0]
	at ~[elasticsearch-2.2.0.jar:2.2.0]
	at ~[elasticsearch-2.2.0.jar:2.2.0]
	at$Bucket.reduce( ~[elasticsearch-2.2.0.jar:2.2.0]
	at ~[elasticsearch-2.2.0.jar:2.2.0]
	at ~[elasticsearch-2.2.0.jar:2.2.0]
	at ~[elasticsearch-2.2.0.jar:2.2.0]
	at ~[elasticsearch-2.2.0.jar:2.2.0]
	at$AsyncAction$1.doRun( ~[elasticsearch-2.2.0.jar:2.2.0]
	at ~[elasticsearch-2.2.0.jar:2.2.0]
	... 3 more

A regular Elastic installation bundles this engine as a module so the same queries that fails locally succeeds when executed against a remote node, but I don't know how to achieve the same with a local embedded node (if even possible). Is there any mechanism by which one can load a module for a local node through the Java client?

Any help or ideas will be much appreciated. Thanks in advance.


(Nik Everett) #2

If you are using ESIntegTestCase you can probably get it by adding that module and its dependencies to the classpath and adding

    protected Collection<Class<? extends Plugin>> nodePlugins() {
        return pluginList(ReindexPlugin.class);

to your test.

(Tom) #3

Mmmh, nope, not using ESIntegTestCase as I'm using Scala and Scalatest.

(system) #4