Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions elastic/changelog.d/23824.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Handle closed indices in search stats endpoint query
4 changes: 3 additions & 1 deletion elastic/datadog_checks/elastic/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@ def _get_index_search_stats(self, admin_forwarder, base_tags):
# This endpoint can return more data, all of what the /_cat/indices endpoint returns except index health.
# The health we can get from /_cluster/health if we pass level=indices query param. Reference:
# https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html#cluster-health-api-query-params # noqa: E501
indices = self._get_data(self._join_url('/_stats/search', admin_forwarder))['indices']
indices = self._get_data(self._join_url('/_stats/search?forbid_closed_indices=false', admin_forwarder))[
'indices'
]
for (idx_name, data), (m_name, path) in product(indices.items(), INDEX_SEARCH_STATS):
tags = base_tags + ['index_name:' + idx_name]
self._process_metric(data, m_name, 'gauge', path, tags=tags)
Expand Down
Loading