Hi,
I am working on a plugin that needs access to Elasticsearch to potentially run a query against another index. I have found a way, but it feels hacky. Does someone know a better way?
Thanks!
public class UseQueryPlugin extends Plugin implements ScriptPlugin {
private UseQueryScriptEngine engine;
@Override
public ScriptEngine getScriptEngine(Settings settings, Collection<ScriptContext<?>> contexts) {
this.engine = new UseQueryScriptEngine();
return this.engine;
}
@Override
public Collection<Object> createComponents(Client client,
ClusterService clusterService,
ThreadPool threadPool,
ResourceWatcherService resourceWatcherService,
ScriptService scriptService,
NamedXContentRegistry xContentRegistry,
Environment environment,
NodeEnvironment nodeEnvironment,
NamedWriteableRegistry namedWriteableRegistry) {
this.engine.setClient(client);
return asList();
}
}