Merge pull request #41163 from onlyanegg/elasticsearch-pass_profile_to_index_exists

Elasticsearch - pass hosts and profile to index_exists()
This commit is contained in:
Mike Place 2017-05-12 12:18:05 -05:00 committed by GitHub
commit 5b10fc58ba

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: