[英]how to delete index with deleteRequest API in elasticsearch(6.4.3)
I'd like to delete index in elasticsearch 6.4.3 by using DeleteRequest API我想使用 DeleteRequest API 删除 elasticsearch 6.4.3 中的索引
But elastic.co guide 3 arguments(index,document,id) ( https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/client\/java-rest\/6.4\/java-rest-high-document-delete.html<\/a> )但是 elastic.co 指南 3 个参数(索引、文档、id)( https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/client\/java-rest\/6.4\/java-rest-high-document-delete.html<\/a> )
I want use 2 arguments for deleting index (index,document)我想使用 2 个参数来删除索引(索引、文档)
So, Anybody help me about this?那么,有人帮我解决这个问题吗?
DeleteRequest deleteRequest = new DeleteRequest(index);
DeleteResponse response = mClient.delete(deleteRequest, RequestOptions.DEFAULT);
DeleteRequest request = new DeleteRequest(
"index",
"doc",
"id");
DeleteResponse deleteResponse = client.delete(request,RequestOptions.DEFAULT);
return deleteResponse.getResult().name();
where "index" is the index name and id is the document id. 其中“ index”是索引名称,id是文档ID。
As per https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.4/java-rest-high-document-delete.html documentation, you need to pass 3 arguments. 根据https://www.elastic.co/guide/zh-CN/elasticsearch/client/java-rest/6.4/java-rest-high-document-delete.html文档,您需要传递3个参数。 2 argument should be "doc". 2参数应为“ doc”。
If you want to delete an index in Elastic Search, you need to use the Delete Index API https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/client\/java-rest\/6.4\/java-rest-high-delete-index.html<\/a>如果要在 Elastic Search 中删除索引,则需要使用删除索引 API https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/client\/java-rest\/6.4\/java-rest-high-delete -index.html<\/a>
This is the basic example, using the synchronous execution:这是基本示例,使用同步执行:
DeleteIndexRequest request = new DeleteIndexRequest(*IndexName*);
DeleteIndexResponse deleteIndexResponse = client.indices().delete(request, RequestOptions.DEFAULT);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.