I tried also to store the script as file in the script directory: did not help. Disabling the java security manager also did not change anything. So: any idea what I should do?
I think you need to override them specifically again for groovy
script.engine.groovy.inline.search: true
script.engine.groovy.inline.update: true
script.engine.groovy.inline.mapping: true
I'm having the same issue. Unfortunately, Jayme's suggestion doesn't fix the problem. Were it simply a configuration issue, the "reason" messaging would differ, pointing out that groovy is disabled for requests of this type.
After I updated from 2.1.1 to 2.2.0 I see this error when trying to use scripts.
{"type":"illegal_argument_exception","reason":"Unable to find on disk file script [closest_listing] using lang [groovy]"}
closest_lisitng.groovy is the script located at /etc/elasticsearch/scripts
Is it the right solution? I was doing this simple tutorial with a fresh brew install then doing a few command lines, when I had the same error at this command line:
Is it the right solution? I was doing this simple tutorial with a fresh brew install
Reinstall from Homebrew again; the first version of the updated formula for Elasticsearch 2.2.0 did not install the modules folder from the distribution but it does now. I'm sorry!
Can anyone tell me how to enable it for an embedded ElasticSearch?
Groovy worked without any problems in 2.1.1 ( Only "script.engine.groovy.inline.search", "true" was needed in my case).
I added all the Jars from the new module directories.
+1 on this one. I'm running embedded in a grails app, so groovy is already on the classpath. I get a (non-fatal) stack trace when I create the node: script_lang not supported [groovy] when it encounters my .groovy file in the script dir. It used to work just fine on 1.7.x. I tried adding an inline script field using the search builder, but it fails in a similar way, claiming "script_lang not supported [groovy]". Any help would be greatly appreciated.
*** Update: I think the reason why it doesn't work is because groovy as a scripting language has been pulled out into the 'lang-groovy' plugin (see https://github.com/elastic/elasticsearch/pull/13834). This is a problem for embedded nodes because there doesn't seem to be a way to install plugins using the NodeBuilder (see Add plugins from classpath in embedded Elasticsearch client node). I think in the short term 2.1.2 still works as it did before, so I'll be rolling back to that version for now.
With the help of one of your links I solved the problem with Groovy.
This code should work for ES 2.2 (Java 8 is needed!):
Settings settings = Settings.settingsBuilder(). put( "script.engine.groovy.inline.search", "true") ...
Environment env = new Environment(settings);
Collection<Class<? extends Plugin>> classpathPlugins = Collections.singletonList(GroovyPlugin.class);
node = new MockNode(env, Version.CURRENT, classpathPlugins );
node.start();
import java.util.Collection;
import org.elasticsearch.Version;
import org.elasticsearch.env.Environment;
import org.elasticsearch.node.Node;
import org.elasticsearch.plugins.Plugin;
public class MockNode extends Node {
// these are kept here so a copy of this MockNode can be created, since Node does not store them
private Version version;
private Collection<Class<? extends Plugin>> plugins;
public MockNode(Environment env, Version version, Collection<Class<? extends Plugin>> classpathPlugins)
{
super(env, version, classpathPlugins);
this.version = version;
this.plugins = classpathPlugins;
}
public Collection<Class<? extends Plugin>> getPlugins() {
return plugins;
}
public Version getVersion() {
return version;
}
}
The workaround posted by @FisherKing works but it seems odd to me that there is no official and straightforward way of doing this.
Is this issue to be fixed in an upcoming release?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.