private void delete(RestRequest request, RestChannel channel, Client esClient) { String river = request.param("river"); if (river == null || river.isEmpty()) { respondError(request, channel, "Parameter 'river' is required", RestStatus.BAD_REQUEST); return; } logger.info("Delete river: {}", river); if (esClient.admin().indices().prepareTypesExists(riverIndexName).setTypes(river).get().isExists()) { esClient.admin().indices().prepareDeleteMapping(riverIndexName).setType(river).get(); } respondSuccess(request, channel, RestStatus.OK); }
if (client.admin().indices().prepareDeleteMapping(index).setType(type).get().isAcknowledged()) { PutMappingResponse pmr = client.admin().indices().preparePutMapping(index).setType(type) .setSource(mapping.getSourceAsMap()).get();
public void close() { LOGGER.info("Closing Cassandra River"); getClient().admin().indices().prepareDeleteMapping("_river").setType("cassandra-river").execute(); cassandraFactory.shutdown(); LOGGER.info("Cassandra River Closed"); }
public static DeleteByQueryResponse clearIndex(Client client, String indexName){ DeleteByQueryResponse indexDeleteByQueryResponses = client.prepareDeleteByQuery(indexName).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet(); GetMappingsResponse getMappingsResponse = client.admin().indices().prepareGetMappings(indexName).execute().actionGet(); ArrayList<String> mappings = new ArrayList(); getMappingsResponse.getMappings().forEach(map -> { map.value.forEach(map2 -> mappings.add(map2.value.type())); }); if(mappings.size() > 0) { DeleteMappingResponse deleteMappingResponse = client.admin().indices().prepareDeleteMapping(indexName).setType(mappings.toArray(new String[mappings.size()])).execute().actionGet(); } return indexDeleteByQueryResponses; }
public static void delete(final Client client, final RiverName riverName) { DeleteMappingResponse deleteMappingResponse; try { deleteMappingResponse = client.admin().indices() .prepareDeleteMapping("_river").setType(riverName.name()) .execute().actionGet(); } catch (final ElasticsearchException e) { throw new EsUtilSystemException("Failed to delete " + riverName.name(), e); } if (!deleteMappingResponse.isAcknowledged()) { throw new EsUtilSystemException("Failed to delete " + riverName.name() + ". " + deleteMappingResponse.toString()); } }
try { logger.info("Deleting mapping index {}/{}...", dbName, fieldPath); getClient().admin().indices().prepareDeleteMapping(dbName).setType(type).execute().actionGet(initTimeout); } catch (Exception e) { logger.error("Failed to delete mapping index {}/{}", dbName, fieldPath, e);
try { logger.info("Deleting mapping index {}/{}...", dbName, fieldPath); getClient().admin().indices().prepareDeleteMapping(dbName).setType(type).execute().actionGet(initTimeout); } catch (Exception e) { logger.error("Failed to delete mapping index {}/{}", dbName, fieldPath, e);
client.admin().indices().prepareDeleteMapping("_river").setType(riverName.name()).execute();