Skip to content

Commit 140ebd0

Browse files
committed
Have search_exists only return boolean like other exists APIs
Fixes #272
1 parent 3400179 commit 140ebd0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

elasticsearch/client/__init__.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -1302,9 +1302,12 @@ def search_exists(self, index=None, doc_type=None, body=None, params=None):
13021302
:arg q: Query in the Lucene query string syntax
13031303
:arg routing: Specific routing value
13041304
"""
1305-
_, data = self.transport.perform_request('POST', _make_path(index,
1306-
doc_type, '_search', 'exists'), params=params, body=body)
1307-
return data
1305+
try:
1306+
self.transport.perform_request('POST', _make_path(index,
1307+
doc_type, '_search', 'exists'), params=params, body=body)
1308+
except NotFoundError:
1309+
return False
1310+
return True
13081311

13091312
@query_params('allow_no_indices', 'expand_wildcards', 'fields',
13101313
'ignore_unavailable', 'level')

0 commit comments

Comments
 (0)