Rebuild search index fails - NoMethodError: undefined method `lookup’ for NilClass:Class

Copy/paste of Rebuild search index fails - NoMethodError: undefined method `lookup' for NilClass:Class since it has been automatically closed and I have a similar issue. Not sure it’s the right way to do, I hope it will not be considered spam; I would have preferred adding a comment, still, the ticket has been closed, I can’t. Let me know if you prefer I edit the original question.


  • Used Zammad version: 3.6.0
  • Used Zammad installation source: APT Package
  • Operating system: Ubuntu 18.04
  • Database: MySQL

I installed a fresh copy of Zammad 3.6.0 via APT, following the guide here:
https://docs.zammad.org/en/latest/install/ubuntu.html

Also setup Elasticsearch using this guide here:
https://docs.zammad.org/en/latest/install/elasticsearch.html
This installed the latest version of ES 7.10.1

I was able to access Zammad normally, but said that ES was not setup.

So I ran the following:
zammad run rails r “Setting.set(‘es_url’, ‘http://localhost:9200’)”
zammad run rake searchindex:rebuild

This led to the error
NoMethodError: undefined method `lookup’ for NilClass:Class

This is the complete output for zammad run rake searchindex:rebuild

drop indexes...done
delete pipeline (pipeline)... done
create indexes...done
create pipeline (pipeline)... done
reload data...
 reload Ticket
  - started at 2021-02-18 04:17:47 UTC
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/mysql/database_statements.rb:34: warning: BigDecimal.new is deprecated; use BigDecimal() method instead.
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/mysql/database_statements.rb:34: warning: BigDecimal.new is deprecated; use BigDecimal() method instead.
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/mysql/database_statements.rb:34: warning: BigDecimal.new is deprecated; use BigDecimal() method instead.
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/mysql/database_statements.rb:34: warning: BigDecimal.new is deprecated; use BigDecimal() method instead.
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/mysql/database_statements.rb:34: warning: BigDecimal.new is deprecated; use BigDecimal() method instead.
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/mysql/database_statements.rb:34: warning: BigDecimal.new is deprecated; use BigDecimal() method instead.
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.4.5/lib/active_record/connection_adapters/mysql/database_statements.rb:34: warning: BigDecimal.new is deprecated; use BigDecimal() method instead.
  - took 4764 seconds
 reload Chat::Session
  - started at 2021-02-18 05:37:11 UTC
  - took 3 seconds
 reload StatsStore
  - started at 2021-02-18 05:37:15 UTC
rake aborted!
Unable to send StatsStore.find(430).search_index_update_backend backend: #<NoMethodError: undefined method `lookup' for NilClass:Class>
/opt/zammad/app/models/concerns/has_search_index_backend.rb:252:in `rescue in block in search_index_reload'
/opt/zammad/app/models/concerns/has_search_index_backend.rb:246:in `block in search_index_reload'
/opt/zammad/app/models/concerns/has_search_index_backend.rb:241:in `each'
/opt/zammad/app/models/concerns/has_search_index_backend.rb:241:in `search_index_reload'
/opt/zammad/lib/tasks/search_index_es.rake:162:in `block (3 levels) in <main>'
/opt/zammad/lib/tasks/search_index_es.rake:158:in `each'
/opt/zammad/lib/tasks/search_index_es.rake:158:in `block (2 levels) in <main>'
/opt/zammad/lib/tasks/search_index_es.rake:178:in `block (2 levels) in <main>'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `load'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `kernel_load'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:28:in `run'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:463:in `exec'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:27:in `dispatch'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:18:in `start'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/exe/bundle:30:in `block in <top (required)>'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/exe/bundle:22:in `<top (required)>'
/opt/zammad/bin/bundle:3:in `load'
/opt/zammad/bin/bundle:3:in `<main>'

Caused by:
NoMethodError: undefined method `lookup' for NilClass:Class
/opt/zammad/app/models/application_model/can_lookup_search_index_attributes.rb:74:in `search_index_value_by_attribute'
/opt/zammad/app/models/application_model/can_lookup_search_index_attributes.rb:44:in `block in search_index_attribute_lookup'
/opt/zammad/app/models/application_model/can_lookup_search_index_attributes.rb:21:in `each'
/opt/zammad/app/models/application_model/can_lookup_search_index_attributes.rb:21:in `search_index_attribute_lookup'
/opt/zammad/app/models/stats_store/search_index.rb:5:in `search_index_attribute_lookup'
/opt/zammad/app/models/concerns/has_search_index_backend.rb:169:in `search_index_update_backend'
/opt/zammad/app/models/concerns/has_search_index_backend.rb:247:in `block in search_index_reload'
/opt/zammad/app/models/concerns/has_search_index_backend.rb:241:in `each'
/opt/zammad/app/models/concerns/has_search_index_backend.rb:241:in `search_index_reload'
/opt/zammad/lib/tasks/search_index_es.rake:162:in `block (3 levels) in <main>'
/opt/zammad/lib/tasks/search_index_es.rake:158:in `each'
/opt/zammad/lib/tasks/search_index_es.rake:158:in `block (2 levels) in <main>'
/opt/zammad/lib/tasks/search_index_es.rake:178:in `block (2 levels) in <main>'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `load'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `kernel_load'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:28:in `run'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:463:in `exec'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:27:in `dispatch'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:18:in `start'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/exe/bundle:30:in `block in <top (required)>'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/exe/bundle:22:in `<top (required)>'
/opt/zammad/bin/bundle:3:in `load'
/opt/zammad/bin/bundle:3:in `<main>'
Tasks: TOP => searchindex:rebuild

I have just experienced the same issue.

Sorry but Zammad 3.6 is terribly out dated and prune to security issues.
Please consider upgrading via 4.1 to 5.x instead and try again.

The ES version you’re using is not officially supported by 3.6 as well:
https://docs.zammad.org/en/latest/prerequisites/software.html#elasticsearch-optional


During upgrade the issue may self heal itself.

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