diff --git a/CHANGELOG.md b/CHANGELOG.md index caa581afe..e25f077e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Changes * [#1011](https://github.com/toptal/chewy/pull/1011): Replace deprecated `Sidekiq::Testing` API with new `Sidekiq 8.1+` testing API and silence Sidekiq logger during spec runs. ([@mattmenefee][], [@mjankowski][]) +* [#1013](https://github.com/toptal/chewy/pull/1013): Fix `drop_indices` test helper to use `format: 'json'` for ES version portability. If you define a custom `drop_indices` helper in your test suite, update it to use `Chewy.client.cat.indices(format: 'json')` instead of parsing the text-format response. ([@mattmenefee][]) * [#1014](https://github.com/toptal/chewy/pull/1014): Improve contributing documentation with development setup instructions, PR workflow, and grammar fixes. ([@mattmenefee][]) ## 8.0.1 (2026-03-12) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8a79f6a49..ac8d86f62 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -48,10 +48,14 @@ # } # ) -# Low-level substitute for now-obsolete drop_indices +# Low-level substitute for now-obsolete drop_indices. +# Uses format: 'json' for version-portable parsing. +# System indices (prefixed with '.') are excluded to avoid deleting +# ES-internal indices like .security or .kibana. def drop_indices - response = Chewy.client.cat.indices - indices = response.body.lines.map { |line| line.split[2] } + indices = Chewy.client.cat.indices(format: 'json') + .map { |entry| entry['index'] } + .reject { |name| name.start_with?('.') } return if indices.blank? Chewy.client.indices.delete(index: indices)