How to load native script with 2.1?


(Matt Chambers) #1

Hi everyone,

I'm upgrading from Elastic 1.7.3 to 2.1.1 and I think this is the final thing I need to fix. In 1.7 when I needed to load a native script I'd put it in my config like so:

script.native.nameOfScript.type=fully qualified class name

That doesn't see to be working anymore. I simply get a script not found.


(Nik Everett) #2

The simplest way to load a native script is with a plugin. You can look at jvm-example in the source for a basic example. You make a plugin with the onModule(ScriptModule module) method and use the module reference to register your NativeScriptFactory.

I'm sorry for the loss of the old way. I think it was a casualty of classpath isolation for plugins but it was before I was paying close attention to that.


(Matt Chambers) #3

Dang, this is from an app with an embedded elastic client, so the plugins are already in the jar. Not sure that makes a difference. I'm just trying to run unit tests now.

I made a plugin, but onModule(ScriptModule module) never seems to get called.


(Matt Chambers) #4

So there is no way to load a plugin class manually? Can I get a reference to this scriptModule reference somehow and call onModule manually?


(system) #5