Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing docs.count #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions es/elastic/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too broad exception, replace it by TypeError. Also it seems less clear what can be expected from the ES index.

what do you think about:

if item["docs.count"] is None or item["docs.count"] in (0, "0")

is_empty = True
break
if (
not is_empty
and self._get_value_for_col_name(result, "type") == type_filter
Expand Down