.. versionadded:: 2017.7.0

    Delete existing search template definition.

    id
        Template ID

    CLI example::

        salt myminion elasticsearch.search_template_delete mytemplate

def search_template_delete(id, hosts=None, profile=None):
    '''
    .. versionadded:: 2017.7.0

    Delete existing search template definition.

    id
        Template ID

    CLI example::

        salt myminion elasticsearch.search_template_delete mytemplate
    '''
    es = _get_instance(hosts, profile)

    try:
        result = es.delete_template(id=id)

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