版本升级的时候遇到个重建索引的错,现象是现在网站无法搜索,有没有什么好方法处理一下,谢谢
在网站上搜索直接报错,后台 Exception 如下
Method: GET
URL: /search?q=a
Controller: search#index
RequestId: 8fcba3f8-9bee-4f9c-9d98-83558936d663
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36
Remote IP: 172.19.0.8
Language: en,zh-CN;q=0.9,zh;q=0.8
Server: 83a0e57b3091
Process: 11
--------------------------------------------------
#<ActionView::Template::Error: [404] {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"pages","index_uuid":"_na_","index":"pages"}],"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"pages","index_uuid":"_na_","index":"pages"},"status":404}>
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/transport/base.rb:202:in `__raise_transport_error'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/transport/base.rb:319:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/client.rb:131:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-api-5.0.5/lib/elasticsearch/api/actions/search.rb:183:in `search'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-model-5.0.2/lib/elasticsearch/model/searching.rb:51:in `execute!'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-model-5.0.2/lib/elasticsearch/model/response.rb:31:in `response'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-model-5.0.2/lib/elasticsearch/model/response/base.rb:33:in `total'
/home/app/homeland/app/views/search/index.html.erb:5:in `_app_views_search_index_html_erb__2909668803154264808_70059658455800'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionview-5.2.2.1/lib/action_view/template.rb:159:in `block in render'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/notifications.rb:170:in `instrument'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionview-5.2.2.1/lib/action_view/template.rb:354:in `instrument_render_template'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionview-5.2.2.1/lib/action_view/template.rb:157:in `render'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionview-5.2.2.1/lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionview-5.2.2.1/lib/action_view/renderer/abstract_renderer.rb:44:in `block in instrument'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/notifications.rb:168:in `block in instrument'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/notifications.rb:168:in `instrument'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionview-5.2.2.1/lib/action_view/renderer/abstract_renderer.rb:43:in `instrument'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionview-5.2.2.1/lib/action_view/renderer/template_renderer.rb:53:in `block in render_template'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionview-5.2.2.1/lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionview-5.2.2.1/lib/action_view/renderer/template_renderer.rb:52:in `render_template'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionview-5.2.2.1/lib/action_view/renderer/template_renderer.rb:16:in `render'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionview-5.2.2.1/lib/action_view/renderer/renderer.rb:44:in `render_template'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionview-5.2.2.1/lib/action_view/renderer/renderer.rb:25:in `render'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionview-5.2.2.1/lib/action_view/rendering.rb:103:in `_render_template'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/streaming.rb:219:in `_render_template'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionview-5.2.2.1/lib/action_view/rendering.rb:84:in `render_to_body'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/rendering.rb:52:in `render_to_body'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/renderers.rb:142:in `render_to_body'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/abstract_controller/rendering.rb:25:in `render'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/rendering.rb:36:in `render'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/instrumentation.rb:46:in `block (2 levels) in render'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/core_ext/benchmark.rb:14:in `block in ms'
/usr/local/lib/ruby/2.6.0/benchmark.rb:308:in `realtime'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/core_ext/benchmark.rb:14:in `ms'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/instrumentation.rb:46:in `block in render'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/railties/controller_runtime.rb:31:in `cleanup_view_runtime'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/instrumentation.rb:45:in `render'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/implicit_render.rb:35:in `default_render'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `block in send_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `tap'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/abstract_controller/base.rb:194:in `process_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/callbacks.rb:132:in `run_callbacks'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/notifications.rb:168:in `block in instrument'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/notifications.rb:168:in `instrument'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/railties/controller_runtime.rb:24:in `process_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/abstract_controller/base.rb:134:in `process'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionview-5.2.2.1/lib/action_view/rendering.rb:32:in `process'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal.rb:191:in `dispatch'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal.rb:252:in `dispatch'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/routing/route_set.rb:34:in `serve'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/journey/router.rb:52:in `block in serve'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/journey/router.rb:35:in `each'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/journey/router.rb:35:in `serve'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/routing/route_set.rb:840:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/omniauth-1.8.1/lib/omniauth/strategy.rb:190:in `call!'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/omniauth-1.8.1/lib/omniauth/strategy.rb:168:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/http_accept_language-2.1.1/lib/http_accept_language/middleware.rb:14:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-attack-5.4.2/lib/rack/attack.rb:182:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/exception_notification-4.3.0/lib/exception_notification/rack.rb:41:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/warden-1.2.8/lib/warden/manager.rb:36:in `block in call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/warden-1.2.8/lib/warden/manager.rb:34:in `catch'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/warden-1.2.8/lib/warden/manager.rb:34:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/tempfile_reaper.rb:15:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/etag.rb:25:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/conditional_get.rb:25:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/head.rb:12:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/session/abstract/id.rb:232:in `context'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/session/abstract/id.rb:226:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/cookies.rb:670:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/callbacks.rb:98:in `run_callbacks'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/railties-5.2.2.1/lib/rails/rack/logger.rb:38:in `call_app'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/railties-5.2.2.1/lib/rails/rack/logger.rb:26:in `block in call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/tagged_logging.rb:71:in `block in tagged'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/tagged_logging.rb:28:in `tagged'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/tagged_logging.rb:71:in `tagged'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/railties-5.2.2.1/lib/rails/rack/logger.rb:26:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/request_id.rb:27:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/method_override.rb:22:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/runtime.rb:22:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/sendfile.rb:111:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/ssl.rb:74:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-cors-1.0.2/lib/rack/cors.rb:97:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-utf8_sanitizer-1.6.0/lib/rack/utf8_sanitizer.rb:22:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/railties-5.2.2.1/lib/rails/engine.rb:524:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/puma-3.12.0/lib/puma/configuration.rb:225:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/puma-3.12.0/lib/puma/server.rb:658:in `handle_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/puma-3.12.0/lib/puma/server.rb:472:in `process_client'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/puma-3.12.0/lib/puma/server.rb:332:in `block in run'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/puma-3.12.0/lib/puma/thread_pool.rb:133:in `block in spawn_thread'
去机器上执行sudo make reindex
,报错如下
$ sudo make reindex
Reindex ElasticSearch...
Starting homeland_redis ...
Starting homeland_redis ... done
Starting homeland_elasticsearch ... done
rake aborted!
NoMethodError: undefined method `bytesize' for nil:NilClass
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:87:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:43:in `block in call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:92:in `with_net_http_connection'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:38:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/rack_builder.rb:143:in `build_response'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/faraday-0.15.4/lib/faraday/connection.rb:387:in `run_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:23:in `block in perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/transport/base.rb:262:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-transport-5.0.5/lib/elasticsearch/transport/client.rb:131:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-api-5.0.5/lib/elasticsearch/api/actions/bulk.rb:95:in `bulk'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-model-5.0.2/lib/elasticsearch/model/importing.rb:123:in `block in import'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-model-5.0.2/lib/elasticsearch/model/adapters/active_record.rb:106:in `block in __find_in_batches'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/relation/batches.rb:136:in `block in find_in_batches'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/relation/batches.rb:238:in `block in in_batches'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/relation/batches.rb:222:in `loop'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/relation/batches.rb:222:in `in_batches'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/relation/batches.rb:135:in `find_in_batches'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/querying.rb:11:in `find_in_batches'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-model-5.0.2/lib/elasticsearch/model/proxy.rb:96:in `method_missing'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-model-5.0.2/lib/elasticsearch/model/adapters/active_record.rb:105:in `__find_in_batches'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-model-5.0.2/lib/elasticsearch/model/importing.rb:122:in `import'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/elasticsearch-rails-5.0.2/lib/elasticsearch/rails/tasks/import.rb:63:in `block (3 levels) in <main>'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/usr/local/bundle/bin/bundle:23:in `load'
/usr/local/bundle/bin/bundle:23:in `<main>'
Tasks: TOP => elasticsearch:import:model
(See full trace by running task with --trace)
make: *** [reindex] Error 1