code: 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 Truf 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
docs: .. 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