INNER CODE UNIT · Python
delete_indices
mistio/mist-ce · docker/elasticsearch-manage/scripts/delete_indices.py:24
def delete_indices(index):
"""DELETE Elasticsearch Indices."""
# Initialize ES client.
es = es_client()
hosts = []
for host in es.transport.hosts:
hosts.append(host['host'])
print('Connected to: %s' % ', '.join(hosts))
print('This operation will DELETE indices with index pattern: "%s"' % index)
while True:
answer = input('Continue[Y/n]:')
if answer == 'Y':
print('Deleting ...', end=' ')
break