Search error: undefined method `fetch' for Integer

On commit c5751f8377ed966381445a4a5871711ef565c3ea of glitch-soc, typing @ and two characters produces this error log:

method=GET path=/api/v1/accounts/search format=html controller=Api::V1::Accounts::SearchController action=show status=500 error='NoMethodError: undefined method `fetch' for 0:Integer' duration=18.77 view=0.00 db=1.03

NoMethodError (undefined method `fetch' for 0:Integer):

app/services/account_search_service.rb:91:in `from_elasticsearch'
app/services/account_search_service.rb:49:in `search_results'
app/services/account_search_service.rb:22:in `search_service_results'
app/services/account_search_service.rb:14:in `call'
app/controllers/api/v1/accounts/search_controller.rb:15:in `account_search'
app/controllers/api/v1/accounts/search_controller.rb:8:in `show'

And searching for anything produces this log:

method=GET path=/api/v2/search format=html controller=Api::V2::SearchController action=index status=500 error='NoMethodError: undefined method `fetch' for 195:Integer' duration=41.20 view=0.00 db=7.30

NoMethodError (undefined method `fetch' for 195:Integer):

app/services/account_search_service.rb:91:in `from_elasticsearch'
app/services/account_search_service.rb:49:in `search_results'
app/services/account_search_service.rb:22:in `search_service_results'
app/services/account_search_service.rb:14:in `call'
app/services/search_service.rb:31:in `perform_accounts_search!'
app/services/search_service.rb:21:in `block in call'
app/services/search_service.rb:15:in `call'
app/controllers/api/v2/search_controller.rb:19:in `search_results'
app/controllers/api/v2/search_controller.rb:12:in `index'

What should I do?

Fixed by upgrading ElasticSearch to 7.x. I did this just by swapping out the repo from https://artifacts.elastic.co/packages/6.x/ to https://artifacts.elastic.co/packages/7.x/ and running apt update && apt upgrade.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.