In ES 5.3.1 how can a plugin get a handle to the current Node?

I have a plugin that was written for Elasticsearch version 2.3.2 similar to this one:

The script was registered with the plugin like this:

module.registerScript("lookup", LookupScript.Factory.class);

Reference: https://github.com/imotov/elasticsearch-native-script-example/blob/2.x/src/main/java/org/elasticsearch/examples/nativescript/plugin/NativeScriptExamplesPlugin.java

In version 5.3.1, the way to register the script with the plugin requires the script to be instantiated and it needs a handle to the Node.
Like:
@Override
public List getNativeScripts() {
return Arrays.asList(
new LookupScript.Factory(node, this.settings); <=== how to get node?
);
}

How do we get a handle to the current Node in the plugin?

Thank you!

Native scripts are deprecated in 5.x (next release 5.5.0). The documentation has been updated to explain how to create a ScriptEngine to get the same functionality. However, since 5.0, you are not able to do what that example is doing (get a node client). If you want to do that from a script engine (which you should not), you will have to create a client yourself.

Thank you! I need to rework the script to not have to rely on the node client, since we also ran into some deadlock issues when trying to execute a search from the script.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.