From aae46d05dd66f6a34a0f582fdde1fd84e43790c4 Mon Sep 17 00:00:00 2001 From: james-stead <54695247+james-stead@users.noreply.github.com> Date: Mon, 4 Apr 2022 21:43:22 -0500 Subject: [PATCH] Fix missing docs.count Our Elastic cluster has a number of indexes that don't return this value. The indexes do appear to be empty as well from looking at the indexes in elastic. This is the for example is what is in item: {'health': 'green', 'status': 'open', 'index': '', 'uuid': 't_w0eDA9SXS8CGYhYtXhfg', 'pri': '1', 'rep': '1', 'docs.count': None, 'docs.deleted': None, 'store.size': None, 'pri.store.size': None} --- es/elastic/api.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/es/elastic/api.py b/es/elastic/api.py index 40c100f..9044818 100644 --- a/es/elastic/api.py +++ b/es/elastic/api.py @@ -120,9 +120,13 @@ def get_valid_table_view_names(self, type_filter: str) -> "Cursor": for item in response: # First column is TABLE_NAME if item["index"] == self._get_value_for_col_name(result, "name"): - if int(item["docs.count"]) == 0: - is_empty = True - break + try: + if int(item["docs.count"]) == 0: + is_empty = True + break + except Exception as ex: + is_empty = True + break if ( not is_empty and self._get_value_for_col_name(result, "type") == type_filter