Commit 1fd931d3 authored by mkollo's avatar mkollo
Browse files

Changed previous fix to avoid complications from cluster errors.

parent 4e9782a2
......@@ -684,11 +684,13 @@ class ES_Manager:
return response['count']
@staticmethod
def single_index_count(index_name: str) -> int:
try:
count = Search(using=Elasticsearch(es_url), index=index_name).count()
def single_index_count(index_name: str):
es = Elasticsearch(es_url)
status = es.cat.indices(index=index_name, h="status").strip()
if status == "open":
count = Search(using=es, index=index_name).count()
return count
except elasticsearch.RequestError as e:
else:
return None
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment