[英]How to delete index in elasticsearch 5.6.3
我最近將項目中的elasticsearch版本從2.3.3更新到5.6.3,在2.3.3版本中,我正在使用org.elasticsearch.plugin 2.0.0-rc1刪除索引,並且正在使用以下設置:
Client client = TransportClient.builder().addPlugin(DeleteByQueryPlugin.class).build().addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(host), port));
我的刪除索引代碼是:
DeleteByQueryResponse response = new DeleteByQueryRequestBuilder(client, DeleteByQueryAction.INSTANCE)
.setIndices(index)
.setTypes(indexType)
.setSource(query.toString())
.execute()
.actionGet();
但是在elasticsearch 5.6.3版本中,我使用以下方法刪除索引:
BulkByScrollResponse response = DeleteByQueryAction.INSTANCE.newRequestBuilder(client)
.source(index)
.filter(QueryBuilders.queryStringQuery(query.toString()))
.execute()
.actionGet();
但是當我運行我的代碼時,出現以下異常:-
java.lang.NoSuchFieldError:V_5_1_1_UNRELEASED
請建議如何使用彈性搜索5.6.3版本刪除索引
我會建議從Elastic 網站上推薦的選項
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.