Add Elasticsearch 9.x support#1009
Conversation
e9bc5d7 to
dbd4a3a
Compare
dbd4a3a to
210c1f9
Compare
c09dd71 to
98955eb
Compare
bbatsov
left a comment
There was a problem hiding this comment.
Thanks for tackling ES 9 support! We'll review this properly after #1008 and #1010 have been updated and merged, since this builds on top of both.
One thing I'd suggest splitting out now: the Sidekiq testing API changes (require 'sidekiq/testing' -> Sidekiq.testing!(:fake), Sidekiq::Testing.inline! -> Sidekiq.testing!(:inline)) are unrelated to ES 9 and would be easier to review and merge as a separate PR.
a4ee365 to
1fd450e
Compare
|
@mattmenefee I will take a look at this PR. Currently we need to upgrade to ES 8 so would be nice to test it myself when doing the migration. |
|
@AlfonsoUceda no problem and thanks so much! Let me know if any changes need to be made. |
1fd450e to
3e2a303
Compare
3e2a303 to
e926d1a
Compare
5f4a7be to
f6d8602
Compare
f6d8602 to
82074ba
Compare
| matrix: | ||
| ruby: [ '3.2', '3.3', '3.4', '4.0' ] | ||
| gemfile: [rails.7.2.activerecord, rails.8.0.activerecord, rails.8.1.activerecord] | ||
| name: ${{ matrix.ruby }}-${{ matrix.gemfile }} |
There was a problem hiding this comment.
@AlfonsoUceda Would it be better / cleaner to use something like appraisal to test against both Elasticsearch v8 and v9?
2dbb94e to
7a4ff81
Compare
|
@AlfonsoUceda I've been rebasing this onto I've mainly been doing this because I'm running this branch in Production, and picking up the new changes/improvements on |
796ff44 to
7fd180a
Compare
7fd180a to
aaf3615
Compare
Elasticsearch 9.x introduced breaking changes to the elasticsearch-ruby
client gem that prevent Chewy from working with ES 9 clusters:
1. The scroll API now requires scroll_id nested under a body: key
({scroll: '1m', body: {scroll_id: '...'}}) rather than as a
top-level parameter. Without this, scroll requests raise an
ArgumentError in elasticsearch-ruby 9.x.
2. API responses are now wrapped in Elasticsearch::API::Response objects
instead of returning raw hashes/arrays. Code that calls .map or
other Enumerable methods directly on responses (e.g. cat.indices)
must now call .body first to access the underlying data.
3. The elasticsearch Ruby gem at version 9.x sends a compatible-with=9
header that ES 8.x servers reject. CI matrix entries that test
against ES 8.x must pin the gem to ~> 8.14.
Changes:
- Widen elasticsearch gem dependency from < 9.0 to < 10.0
- Restructure perform_scroll to nest scroll_id under body:, which is
compatible with both elasticsearch-ruby 8.x and 9.x
- Access .body on cat.indices response in the drop_indices test helper
- Add elasticsearch version matrix to CI: 9.4.3 default with three
8.19.3 spot-check entries (Ruby 3.3/3.4/4.0), using dynamic service
container images
- Pin elasticsearch gem to ~> 8.14 in CI for ES 8.x matrix entries
- Add scroll body format assertion in scrolling specs
- Add a Chewy 8->9 migration guide section with code examples, gem
pinning guidance, and breaking-change notes
- Add Chewy 9.0.x (ES 8.x + 9.x) row to the README compatibility table
aaf3615 to
d19eb78
Compare
Summary
elasticsearchgem dependency from< 9.0to< 10.0to support ES 9.x clustersscroll_idunderbody:, matching the elasticsearch-ruby 9.x client interface.bodyaccessor oncat.indicesresponse for ES 9.x gem compatibilityelasticsearchgem to~> 8.14in CI for ES 8.x matrix entries (the 9.x gem sends acompatible-with=9header that ES 8.x rejects)Breaking changes
search_query.chewynotification payload for scroll requests now nestsscroll_idunderbody:(i.e.{scroll: '1m', body: {scroll_id: '...'}}instead of{scroll: '1m', scroll_id: '...'}). Update any application code that subscribes to scroll notification payloads.Test plan
search_query.chewynotification payload matches new format