When running Elasticsearch embedded in Java, I cannot use scripts of language 'expression'. I'm getting these errors:
script_score the script could not be loaded]; nested: ElasticsearchIllegalArgumentException[script_lang not supported [expression]];
Debugging shows that the ExpressionScriptEngineService is not injected into the ScriptEngine.
Running the exact same query on a standalone elasticsearch runs fine.
I'm using 1.5.2, but tested also on 1.6.0, with the same behaviour.
the expression lib is marked as optional in the pom
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-expressions</artifactId>
<version>${lucene.maven.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
if you pull it in manually does this fix it?
This fixes it! Thanks a lot!
Just a little annoying that we have to keep this version in sync with the version elasticsearch uses, if we upgrade in the future, but that's not that big a deal.
cool thanks
What is the up-to-date guidance here, now that lang-expression is it's own module? Including both org.elasticsearch.lang-expression and org.apache.lucene.lucene-expressions as dependencies doesn't seem to work.
Ok, figured it out :)
For the future reader - make sure you include both lang-expression from org.elasticsearch.module and the lucene package mentioned above; and then add ExpressionPlugin.class to nodePlugins in your InternalCluster configs
@synhershko could you, please, explain where InternalCluster configs are located and how to add ExpressionPlugin.class? Thanks.
InternalCluster configs are located in one of the methods in the class where the cluster is initialized
Most helpful comment
Ok, figured it out :)
For the future reader - make sure you include both lang-expression from org.elasticsearch.module and the lucene package mentioned above; and then add ExpressionPlugin.class to nodePlugins in your InternalCluster configs