diff --git a/elasticsearch/client/__init__.py b/elasticsearch/client/__init__.py index 772303bb..625dbf7f 100644 --- a/elasticsearch/client/__init__.py +++ b/elasticsearch/client/__init__.py @@ -1244,9 +1244,12 @@ class Elasticsearch(object): :arg q: Query in the Lucene query string syntax :arg routing: Specific routing value """ - _, data = self.transport.perform_request('POST', _make_path(index, - doc_type, '_search', 'exists'), params=params, body=body) - return data + try: + self.transport.perform_request('POST', _make_path(index, + doc_type, '_search', 'exists'), params=params, body=body) + except NotFoundError: + return False + return True @query_params('allow_no_indices', 'expand_wildcards', 'fields', 'ignore_unavailable', 'level') diff --git a/elasticsearch/transport.py b/elasticsearch/transport.py index 6f82eb66..9f553200 100644 --- a/elasticsearch/transport.py +++ b/elasticsearch/transport.py @@ -273,7 +273,7 @@ class Transport(object): body = self.serializer.dumps(body) # some clients or environments don't support sending GET with body - if method == 'GET' and self.send_get_body_as != 'GET': + if method in ('HEAD', 'GET') and self.send_get_body_as != 'GET': # send it as post instead if self.send_get_body_as == 'POST': method = 'POST'