Make search_exists consistent with other _exists APIs
Fixes #230 Thanks ncrocfer for the report!
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user