简体   繁体   中英

How to delete index in elasticsearch 5.6.3

I have recently update elasticsearch version in my project from 2.3.3 to 5.6.3 ,In 2.3.3 version i was using org.elasticsearch.plugin 2.0.0-rc1 for delete my index and i was working with following setting:-

      Client client = TransportClient.builder().addPlugin(DeleteByQueryPlugin.class).build().addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(host), port));

And my delete index code are:-

        DeleteByQueryResponse response = new DeleteByQueryRequestBuilder(client, DeleteByQueryAction.INSTANCE)
                .setIndices(index)
                .setTypes(indexType)
                .setSource(query.toString())
                .execute()
                .actionGet();

But in elasticsearch version 5.6.3 i have using following approach to delete index are:-

 BulkByScrollResponse response = DeleteByQueryAction.INSTANCE.newRequestBuilder(client)
                .source(index)
                .filter(QueryBuilders.queryStringQuery(query.toString()))
                .execute()
                .actionGet();

But when i ran my code i have got following exception:-

java.lang.NoSuchFieldError: V_5_1_1_UNRELEASED

Please suggest how can i delete index with elastic search 5.6.3 version

我会建议从Elastic 网站上推荐的选项

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM