我在我的应用程序中使用ES-2.4.0,我有一个在单个查询中删除多个文档的用例。我正在尝试使用 按查询插件删除 ,但面临以下异常
Caused by: java.lang.IllegalStateException: failed to find action org.elasticsearch.action.deletebyquery.DeleteByQueryAction@7c1ed3a2] to execute
at org.elasticsearch.client.node.NodeClient.doExecute(NodeClient.java:56)
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:359)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:86)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:56)
at org.elasticsearch.action.deletebyquery.DeleteByQueryRequestBuilder.execute(DeleteByQueryRequestBuilder.java:172)
以下是我的实施
if (StringUtils.isEmpty(clusterNodes)) {
// embedded mode
Settings.Builder settings = Settings.settingsBuilder().put("path.home", "./");
if(embeddedTcpPort!=null){
settings.put("transport.tcp.port", embeddedTcpPort);
}
if(Boolean.valueOf(httpEnable)){
settings.put("http.enabled", true);
if(embeddedHttpPort!=null){
settings.put("http.port", embeddedHttpPort);
}
}
Node node = nodeBuilder()
.local(true)
.settings(settings.put("plugin.types","org.elasticsearch.plugin.deletebyquery.DeleteByQueryPlugin").build()) //added delete plugin
.node();
node.start();
this.client = node.client();
} else {
// cluster mode
String[] clients = StringUtils.split(clusterNodes, ",");
Settings settings = Settings.settingsBuilder().put("cluster.name",
clusterName).build();
TransportClient tClient = TransportClient.builder().settings(settings).addPlugin(DeleteByQueryPlugin.class).build();
for (String val : clients) {
String[] pair = val.split(":");
if (pair.length != 2) {
throw new IllegalArgumentException(
Messages.ES_CLIENT_NODE_ERROR);
} else {
try {
tClient.addTransportAddress(new InetSocketTransportAddress(
InetAddress.getByName(pair[0]), Integer.parseInt(pair[1])));
} catch (UnknownHostException ex) {
throw new IllegalStateException("Could not set up ElasticSearch connection", ex);
}
}
}
this.client = tClient;
}
我的maven依赖
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>delete-by-query</artifactId>
<version>2.4.0</version>
</dependency>
请帮帮我。我该怎么办?我犯错误的地方?在ES2.4.0中是否可以通过查询插件 删除 ?感谢
答案 0 :(得分:0)
您必须在设置中添加插件类型:
log_destination=csvlog
你安装了插件吗?
https://www.elastic.co/guide/en/elasticsearch/plugins/2.4/plugins-delete-by-query.html