def ping(allow_failure=False, hosts=None, profile=None):
    '''
    .. versionadded:: 2017.7.0

    Test connection to Elasticsearch instance. This method does not fail if not explicitly specified.

    allow_failure
        Throw exception if ping fails

    CLI example::

        salt myminion elasticsearch.ping allow_failure=True
        salt myminion elasticsearch.ping profile=elasticsearch-extra
    '''
    try:
        _get_instance(hosts, profile)
    except CommandExecutionError as e:
        if allow_failure:
            raise e
        return False
    return True
def ping ( allow_failure = False , hosts = None , profile = None ) : try : _get_instance ( hosts , profile ) except CommandExecutionError as e : if allow_failure : raise e return False return True
.. versionadded:: 2017.7.0

    Test connection to Elasticsearch instance. This method does not fail if not explicitly specified.

    allow_failure
        Throw exception if ping fails

    CLI example::

        salt myminion elasticsearch.ping allow_failure=True
        salt myminion elasticsearch.ping profile=elasticsearch-extra