def document_exists(index, id, doc_type='_all', hosts=None, profile=None):
 es = _get_instance(hosts, profile)
 try:
  if es.exists(index=index, id=id, doc_type=doc_type):
   return True
  else:
   return False
 except elasticsearch.exceptions.NotFoundError:
  return None
 except elasticsearch.exceptions.ConnectionError:
  return None
 return None

def document_exists ( index , id , doc_type = '_all' , hosts = None , profile = None ) : es = _get_instance ( hosts , profile ) try : if es . exists ( index = index , id = id , doc_type = doc_type ) : return True else : return False except elasticsearch . exceptions . NotFoundError : return None except elasticsearch . exceptions . ConnectionError : return None return None
return a boolean indicating whether given document exists cli example:: salt myminion elasticsearch .