Ejemplo n.º 1
0
 private void removeIndices(IndicesAdminClient indices) {
   DeleteIndexRequestBuilder chatsDeleteBuilder =
       new DeleteIndexRequestBuilder(indices, DeleteIndexAction.INSTANCE, "chats");
   DeleteIndexRequestBuilder channelsDeleteBuilder =
       new DeleteIndexRequestBuilder(indices, DeleteIndexAction.INSTANCE, "channels");
   indices.delete(chatsDeleteBuilder.request());
   indices.delete(channelsDeleteBuilder.request());
 }
 @Override
 public BulkNodeClient deleteIndex(String index) {
   if (closed) {
     throw new ElasticsearchIllegalStateException("client is closed");
   }
   if (client == null) {
     logger.warn("no client");
     return this;
   }
   if (index == null) {
     logger.warn("no index name given to delete index");
     return this;
   }
   DeleteIndexRequestBuilder deleteIndexRequestBuilder =
       new DeleteIndexRequestBuilder(client.admin().indices(), index);
   deleteIndexRequestBuilder.execute().actionGet();
   return this;
 }