Fix flaky elastic_rake_spec.rb
## Background
We've discovered a flaky test (`ee/spec/tasks/gitlab/elastic_rake_spec.rb`) while working on https://gitlab.com/gitlab-org/gitlab/-/merge_requests/132989#note_1586055778. It fails once in CI until we retry.
## Proposal
We should debug this flaky spec and fix it.
<!-- Use this section to explain the feature and how it will work. It can be helpful to add technical details, design proposals, and links to related epics or issues. -->
<!-- Please add a label for the type of maintenance as per https://about.gitlab.com/handbook/engineering/metrics/#work-type-classification -->
issue