Delete an index

    index
        Index name

    CLI example::

        salt myminion elasticsearch.index_delete testindex

def index_delete(index, hosts=None, profile=None):
    '''
    Delete an index

    index
        Index name

    CLI example::

        salt myminion elasticsearch.index_delete testindex
    '''
    es = _get_instance(hosts, profile)

    try:
        result = es.indices.delete(index=index)

        return result.get('acknowledged', False)
    except elasticsearch.exceptions.NotFoundError:
        return True
    except elasticsearch.TransportError as e:
        raise CommandExecutionError("Cannot delete index {0}, server returned code {1} with message {2}".format(index, e.status_code, e.error))