elasticsearch - How to use DeleteByQuery plugin with embedded ES 2.3.3 -


i have run es 2.3.3 in embedded fashion i'm unable invoke deletebyquery action due described exception. added deletebyquery plugin classpath , set plugin.types settings not still not working.

my maven dependencies: <dependency> <groupid>org.elasticsearch</groupid> <artifactid>elasticsearch</artifactid> <version>2.3.3</version> </dependency> <dependency> <groupid>org.elasticsearch.plugin</groupid> <artifactid>delete-by-query</artifactid> <version>2.3.3</version> </dependency>

my es setup:

settings elasticsearchsettings = settings.settingsbuilder() .put("threadpool.index.queue_size", -1) .put("path.home", options.getdirectory()) .put("plugin.types", deletebyqueryplugin.class.getname()) .build();  nodebuilder builder = nodebuilder.nodebuilder(); node = builder.local(true).settings(elasticsearchsettings).node(); 

invocation of action used truncate index.

deletebyqueryrequestbuilder builder = new deletebyqueryrequestbuilder(node.client(), deletebyqueryaction.instance);             builder.setindices(indexname).setquery(querybuilders.matchallquery()).execute().addlistener(new actionlistener<deletebyqueryresponse>() {                 public void onresponse(deletebyqueryresponse response) {                     if (log.isdebugenabled()) {                         log.debug("deleted index {" + indexname + "}. duration " + (system.currenttimemillis() - start) + "[ms]");                     }                     sub.oncompleted();                 };                  @override                 public void onfailure(throwable e) {                     log.error("deleting index {" + indexname + "} failed. duration " + (system.currenttimemillis() - start) + "[ms]", e);                     sub.onerror(e);                 }             }); 

exception i'm seeing:

caused by: java.lang.illegalstateexception: failed find action [org.elasticsearch.action.deletebyquery.deletebyqueryaction@7c1ed3a2] execute     @ org.elasticsearch.client.node.nodeclient.doexecute(nodeclient.java:56) ~[elasticsearch-2.3.3.jar:2.3.3]     @ org.elasticsearch.client.support.abstractclient.execute(abstractclient.java:359) ~[elasticsearch-2.3.3.jar:2.3.3] 

i noticed node builder invokes node constructor empty plugin list. extended node class in order invoke (protected) constructor.

public class esnode extends node {      protected esnode(settings settings, collection<class<? extends plugin>> plugins) {         super(internalsettingspreparer.prepareenvironment(settings, null), version.current, plugins);     } } 

using esnode needed plugin loaded.

    set<class<? extends plugin>> classpathplugins = new hashset<>();     classpathplugins.add(deletebyqueryplugin.class);     node = new esnode(settings, classpathplugins).start(); 

this may not ideal far working fine.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -