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

    Obtain existing search template definition.

    id
        Template ID

    CLI example::

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

    try:
        return es.get_template(id=id)
    except elasticsearch.NotFoundError:
        return None
    except elasticsearch.TransportError as e:
        raise CommandExecutionError("Cannot obtain search template {0}, server returned code {1} with message {2}".format(id, e.status_code, e.error))