Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade elasticsearch for Ruby 3 compatibility #3311

Closed

Conversation

deivid-rodriguez
Copy link
Member

I was getting the following error when running the following command from CONTRIBUTING.md docs:

$ bundle exec rake environment elasticsearch:import:all DIR=app/models FORCE=y --trace                                         
** Invoke environment (first_time)
** Execute environment
** Invoke elasticsearch:import:all (first_time)
** Execute elasticsearch:import:all
[IMPORT] Loading models from: app/models
[IMPORT] Processing model: Rubygem...
** Invoke elasticsearch:import:model (first_time)
** Execute elasticsearch:import:model
rails aborted!
ArgumentError: wrong number of arguments (given 1, expected 0)
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/activerecord-7.0.4/lib/active_record/relation/batches.rb:128:in `find_in_batches'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/activerecord-7.0.4/lib/active_record/querying.rb:22:in `find_in_batches'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/elasticsearch-model-7.1.1/lib/elasticsearch/model/proxy.rb:121:in `method_missing'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/elasticsearch-model-7.1.1/lib/elasticsearch/model/adapters/active_record.rb:105:in `__find_in_batches'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/elasticsearch-model-7.1.1/lib/elasticsearch/model/importing.rb:161:in `import'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/elasticsearch-rails-7.2.1/lib/elasticsearch/rails/tasks/import.rb:80:in `block (3 levels) in <main>'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/elasticsearch-rails-7.2.1/lib/elasticsearch/rails/tasks/import.rb:121:in `block (4 levels) in <main>'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/elasticsearch-rails-7.2.1/lib/elasticsearch/rails/tasks/import.rb:104:in `each'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/elasticsearch-rails-7.2.1/lib/elasticsearch/rails/tasks/import.rb:104:in `block (3 levels) in <main>'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in `with_application'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command.rb:51:in `invoke'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<main>'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/deivid/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => elasticsearch:import:model

Turns out this is fixed upstream by this PR by @indirect: elastic/elasticsearch-rails#992.

This PR is just a less ambitious version of #3299, just to get past this error.

@codecov
Copy link

codecov bot commented Dec 26, 2022

Codecov Report

Merging #3311 (56a6175) into master (8387ff6) will decrease coverage by 0.41%.
The diff coverage is n/a.

❗ Current head 56a6175 differs from pull request most recent head 9a871e5. Consider uploading reports for the commit 9a871e5 to get more accurate results

@@            Coverage Diff             @@
##           master    #3311      +/-   ##
==========================================
- Coverage   98.52%   98.11%   -0.42%     
==========================================
  Files         113      113              
  Lines        3390     3390              
==========================================
- Hits         3340     3326      -14     
- Misses         50       64      +14     
Impacted Files Coverage Δ
app/controllers/searches_controller.rb 80.00% <0.00%> (-20.00%) ⬇️
app/models/deletion.rb 86.27% <0.00%> (-13.73%) ⬇️
app/mailers/mailer.rb 84.12% <0.00%> (-6.35%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Co-authored-by: Martin <martin.emde@gmail.com>
@deivid-rodriguez deivid-rodriguez force-pushed the update-elasticsearch-for-ruby-3-compatibility branch from 56a6175 to 9a871e5 Compare December 26, 2022 11:26
@deivid-rodriguez
Copy link
Member Author

It wasn't as easy, which explains why #3299 bumps all the gems it currently bumps.

@deivid-rodriguez deivid-rodriguez deleted the update-elasticsearch-for-ruby-3-compatibility branch December 26, 2022 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant