我有一個Rails應用程序,它具有依賴於elasticsearch的搜索系統,我使用盆栽插件將它推到了heroku上,但是每當我嘗試搜索在我的應用程序,它給我在日誌中的這個錯誤。Elasticsearch :: Transport :: Transport :: Errors :: BadRequest error Heroku
2017-07-16T04:04:44.083489+00:00 app[web.1]: Completed 500 Internal Server Error in 18ms (ActiveRecord: 1.9ms)
2017-07-16T04:04:44.084229+00:00 app[web.1]: app/controllers/search_controller.rb:7:in `show'
2017-07-16T04:04:44.084222+00:00 app[web.1]: Elasticsearch::Transport::Transport::Errors::BadRequest ([400] {"error":{"root_cause":[{"type":"parsing_exception","reason":"no [query] registered for [filtered]","line":1,"col":22}],"type":"parsing_exception","reason":"no [query] registered for [filtered]","line":1,"col":22},"status":400}):
我Elasticsearch控制器
class SearchController < ApplicationController
before_action :beautify_url
layout "simple"
def show
@post_records = Post.search(query_term).paginate(page: params[:page]).records
@posts = @post_records.to_a.select { |post| post.published? }
@users = User.search(query_term).records.to_a
@tags = Tag.search(query_term).records
end
def users
@users = User.search(query_term).records.to_a
end
private
def beautify_url
if params[:search].present?
case params[:action]
when "show"
redirect_to search_url(q: params[:search][:q])
when "users"
redirect_to search_users_url(q: params[:search][:q])
end
end
end
def query_term
params[:q] || ''
end
end
請幫助!
我已經更新了我的gemfile @Rob Sears,但問題依舊 –