def absent(name):

    ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}

    index_exists = __salt__['elasticsearch.index_exists'](index=name)
    if index_exists:
        if __opts__['test']:
            ret['comment'] = 'Index {0} will be removed'.format(name)
            ret['result'] = None
        else:
            ret['result'] = __salt__['elasticsearch.index_delete'](index=name)

            if ret['result']:
                ret['comment'] = 'Removed index {0} successfully'.format(name)
                # TODO show pending changes (body)
            else:
                ret['comment'] = 'Failed to remove index {0}'.format(name)  # TODO error handling
    elif not index_exists:
        ret['comment'] = 'Index {0} is already absent'.format(name)
    else:
        ret['comment'] = 'Failed to determine whether index {0} is absent, see Minion log for more information'.format(name)
        ret['result'] = False

    return ret
Ensure that the named index is absent
dataset/ETHPy150Open saltstack/salt/salt/states/elasticsearch_index.py/absent