Here is a custom api to delete an index using a transport client and the import statement using admin and it is working fine.
I am writing the same using Java High Level Rest Client, but not able to find the appropriate import statement there. According to what I have read admin not to be used for Java High Level Rest Client as it seems to be deprecated.
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
public IndexResponse deleteIndex(String index){
DeleteIndexResponse response = client.admin().indices().prepareDelete(index).get();
}
There are new imports which should be used when working with High Level Rest Client. I am able to create index with this but can't find the same import for Delete Request or Response.
import org.elasticsearch.client.indices.CreateIndexRequest;
public IndexResponse createIndexWithCustomMappings(String indexName, String fieldsMapping){
CreateIndexResponse createIndexResponse = client.indices().create(request, RequestOptions.DEFAULT);}
import org.elasticsearch.client.indices.CreateIndexRequest is the one that is recommended.
I have gone through this documentation https://www.elastic.co/guide/en/elasticsearch/client/java-rest/master/java-rest-high-delete-index.html# , but couldn't find anything related to this.
Is this not available with High Level Rest Client. These two imports seem to be confusing. Does someone know what is concrete difference between both these?