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:

org.elasticsearch.action.search.ReduceSearchPhaseException: [reduce] 
	at org.elasticsearch.action.search.type.TransportSearchQueryAndFetchAction$AsyncAction$1.onFailure(TransportSearchQueryAndFetchAction.java:95) ~[elasticsearch-2.2.0.jar:2.2.0]
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:39) ~[elasticsearch-2.2.0.jar:2.2.0]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_45]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_45]
	at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_45]
Caused by: java.lang.IllegalArgumentException: script_lang not supported [expression]
	at org.elasticsearch.script.ScriptService.getScriptEngineServiceForLang(ScriptService.java:211) ~[elasticsearch-2.2.0.jar:2.2.0]
	at org.elasticsearch.script.ScriptService.compile(ScriptService.java:241) ~[elasticsearch-2.2.0.jar:2.2.0]
	at org.elasticsearch.search.aggregations.pipeline.bucketscript.BucketScriptPipelineAggregator.reduce(BucketScriptPipelineAggregator.java:107) ~[elasticsearch-2.2.0.jar:2.2.0]
	at org.elasticsearch.search.aggregations.InternalAggregation.reduce(InternalAggregation.java:155) ~[elasticsearch-2.2.0.jar:2.2.0]
	at org.elasticsearch.search.aggregations.InternalAggregations.reduce(InternalAggregations.java:170) ~[elasticsearch-2.2.0.jar:2.2.0]
	at org.elasticsearch.search.aggregations.bucket.terms.InternalTerms$Bucket.reduce(InternalTerms.java:110) ~[elasticsearch-2.2.0.jar:2.2.0]
	at org.elasticsearch.search.aggregations.bucket.terms.InternalTerms.doReduce(InternalTerms.java:220) ~[elasticsearch-2.2.0.jar:2.2.0]
	at org.elasticsearch.search.aggregations.InternalAggregation.reduce(InternalAggregation.java:153) ~[elasticsearch-2.2.0.jar:2.2.0]
	at org.elasticsearch.search.aggregations.InternalAggregations.reduce(InternalAggregations.java:170) ~[elasticsearch-2.2.0.jar:2.2.0]
	at org.elasticsearch.search.controller.SearchPhaseController.merge(SearchPhaseController.java:411) ~[elasticsearch-2.2.0.jar:2.2.0]
	at org.elasticsearch.action.search.type.TransportSearchQueryAndFetchAction$AsyncAction$1.doRun(TransportSearchQueryAndFetchAction.java:84) ~[elasticsearch-2.2.0.jar:2.2.0]
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[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.

Tom;


(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

    @Override
    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