Handle closed indices in search stats endpoint query#23824
Open
margaretpearce wants to merge 2 commits into
Open
Handle closed indices in search stats endpoint query#23824margaretpearce wants to merge 2 commits into
margaretpearce wants to merge 2 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
7ebb5b9 to
bb7e71d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Motivation
Elasticsearch 7.3+ returns an error on
/_stats/searchif there are closed indices in the cluster: elastic/elasticsearch#88752.Elasticsearch can have closed indices that are hidden, such as
.ds-ilm-history-*and.internal.alerts-observability. These indices are system-managed. However, because these indices can exist and can be closed, they trigger error responses from the query in_get_index_search_stats:These errors end up being surfaced in the Datadog integration as an AuthenticationError, which is not accurate: https://github.com/DataDog/integrations-core/blob/master/elastic/datadog_checks/elastic/elastic.py#L341
To resolve this problem, I considered two options:
forbid_closed_indices=false(https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-stats#operation-indices-stats-forbid_closed_indices)ignore_unavailable=trueI opted to pursue the first option because although the second option worked for me, it is not documented on https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-stats.
This is my first contribution to this repository. Apologies for any mistakes or omissions.
Review checklist (to be filled by reviewers)
qa/requiredif this PR needs QA validation, orqa/skip-qaif it does not. Exactly one of the two is required.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged