ankane / searchkick

Intelligent search made easy
MIT License
6.54k stars 757 forks source link

400 - Invalid Query Error for Production Index #1363

Closed rorycoconnor closed 4 years ago

rorycoconnor commented 4 years ago

Hello,

I have recently taken over a project that has searchkick implemented to sift through "Questionnaire" objects. However, when I enter a search term, I receive a 500 from nginx. Looking closer into Puma logs, I find the following:

Searchkick::InvalidQueryError ([400] {"error":{"root_cause":[{"type":"query_shard_exception","reason":"[match] analyzer [searchkick_search] not found","index_uuid":"Vtd4-LgVQiqmA-W0uiDSzw","index":"questionnaires_production"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"questionnaires_production","node":"Oto8Jh7CQt6Qtsmz9jU6AA","reason":{"type":"query_shard_exception","reason":"[match] analyzer [searchkick_search] not found","index_uuid":"Vtd4-LgVQiqmA-W0uiDSzw","index":"questionnaires_production"}}]},"status":400}):
  app/controllers/questionnaires_controller.rb:30:in `index'

I have tried rake searchkick:reindex:all, rake searchkick:reindex CLASS=Questionnaire, and Questionnaire.reindex in the rails console. Running the first two commands results in the "reindex complete" message.

The tool successfully indexes the content in the database "compliance_reports_development", but not the data in "compliance_reports_production". Is there some configuration I might be missing that would cause this?

Below is my Gemfile:


gem 'acts-as-taggable-on', '~> 5.0'
# Devise authentication
gem 'devise'
# Devise SAML authentication
gem 'devise_saml_authenticatable'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '>= 5.0.0.rc2', '< 5.1'
# PostgreSQL database
gem 'pg', '0.18.4'
# Official Sass port of Bootstrap
gem 'bootstrap-sass', '3.3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '~> 3.0.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Generate PDF files, including creation of watermark
gem 'prawn', '~> 2.1.0'
# Merge PDF documents
gem 'combine_pdf', '~> 0.2.18'
# Box official Ruby API
gem 'boxr'
# Solution for rails file upload functionality
gem 'carrierwave', '~> 0.9'
# HTTP server capable of handling a large number of incoming requests
gem 'puma', '3.12.0'
# PDF Toolkit - To encrypt PDFs after watermarked
gem 'pdf-forms', '~> 1.1', '>= 1.1'
# Pagination method
gem 'will_paginate', '3.1.0'
# Configures will_paginate to use Bootstrap pagination styles
gem 'bootstrap-will_paginate', '0.0.10'
# Elastic search functionality
gem 'searchkick','4.2.0'```

Thank you. 
rorycoconnor commented 4 years ago

Nevermind, resolved this. Needed to run Questionnaire.reindex in rails console production.