Skip to content

Commit

Permalink
Add comment inline
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied committed Aug 6, 2024
1 parent a341fd6 commit 12c3a28
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,15 @@ def get_all_index_details(cluster: Cluster, index_prefix_ignore_list=None, **kwa
all_index_details = execute_api_call(cluster=cluster, path="/_cat/indices?format=json", **kwargs).json()
index_dict = {}
for index_details in all_index_details:
# While cat/indices returns a doc count metric, the underlying implementation bleeds through details, only
# capture the index name and make a separate api call for the doc count
index_name = index_details['index']
valid_index = not index_matches_ignored_index(index_name,
index_prefix_ignore_list=index_prefix_ignore_list)
if index_prefix_ignore_list is None or valid_index:
# "To get an accurate count of Elasticsearch documents, use the cat count or count APIs."
# See https://www.elastic.co/guide/en/elasticsearch/reference/7.10/cat-indices.html

count_response = execute_api_call(cluster=cluster, path=f"/{index_name}/_count?format=json", **kwargs)
index_dict[index_name] = count_response.json()
return index_dict
Expand Down

0 comments on commit 12c3a28

Please sign in to comment.