Pass hosts and profile to index_exists() method

This commit is contained in:
coutotyler 2017-05-09 18:11:12 -07:00
parent 88e93b7fe5
commit 7f512c701b

View File

@ -201,7 +201,7 @@ def document_delete(index, doc_type, id, hosts=None, profile=None):
'''
es = _get_instance(hosts, profile)
try:
if not index_exists(index=index):
if not index_exists(index=index, hosts=hosts, profile=profile):
return True
else:
result = es.delete(index=index, doc_type=doc_type, id=id)
@ -263,7 +263,7 @@ def index_create(index, body=None, hosts=None, profile=None):
'''
es = _get_instance(hosts, profile)
try:
if index_exists(index):
if index_exists(index, hosts=hosts, profile=profile):
return True
else:
result = es.indices.create(index=index, body=body) # TODO error handling
@ -283,7 +283,7 @@ def index_delete(index, hosts=None, profile=None):
'''
es = _get_instance(hosts, profile)
try:
if not index_exists(index=index):
if not index_exists(index=index, hosts=hosts, profile=profile):
return True
else:
result = es.indices.delete(index=index)
@ -330,7 +330,7 @@ def index_get(index, hosts=None, profile=None):
es = _get_instance(hosts, profile)
try:
if index_exists(index):
if index_exists(index, hosts=hosts, profile=profile):
ret = es.indices.get(index=index) # TODO error handling
return ret
except elasticsearch.exceptions.NotFoundError: