0

I am using elasticsearch-2.2.0 version. I need to enable scripting using JAVA API. Basically I want to create a node using NodeBuilder and enable scripting support.

I tried setting the properties "script.inline : true" and "script.indexed : true" as below :

Settings settings = Settings.builder().put("script.inline", true).put("script.indexed", true).build();

but still it does not works.

Is there a way to enable scripting in elasticsearch-2.2.0 version using JAVA ?

7
  • Do you get any error in your logs? Commented Apr 25, 2016 at 10:30
  • Yes I am getting error : Exception in thread "main" java.lang.NoClassDefFoundError: org/elasticsearch/plugins/AbstractPlugin at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) Commented Apr 25, 2016 at 10:33
  • Can you show which elasticsearch dependency you have in your pom.xml in the client code? Commented Apr 25, 2016 at 10:34
  • <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> <version>2.2.0</version> </dependency> <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch-lang-groovy</artifactId> <version>2.2.0</version> </dependency> <dependency> <groupId>org.apache.lucene</groupId> <artifactId>lucene-expressions</artifactId> <version>4.10.2</version> </dependency> Commented Apr 25, 2016 at 10:35
  • Is there anything relevant in the logs before/after that stack trace? Commented Apr 25, 2016 at 10:40

1 Answer 1

1

This is similar to this issue and it seems that when creating a local NodeClient the lang-groovy module is not loaded by default.

So you need to add another dependency in your pom.xml

<dependency>
   <groupId>org.elasticsearch.module</groupId>    
   <artifactId>lang-groovy</artifactId>
   <version>2.2.0</version>
</dependency>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.