From 140ebd022f2262262601fad0782dae91275b2875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Wed, 7 Oct 2015 17:36:12 +0200 Subject: [PATCH] Have search_exists only return boolean like other exists APIs Fixes #272 --- elasticsearch/client/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/elasticsearch/client/__init__.py b/elasticsearch/client/__init__.py index 6e4a85b7..9f0ee6d7 100644 --- a/elasticsearch/client/__init__.py +++ b/elasticsearch/client/__init__.py @@ -1302,9 +1302,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')