简体   繁体   English

Elasticsearch ::运输::运输::错误:: BadRequest错误heroku

[英]Elasticsearch::Transport::Transport::Errors::BadRequest error heroku

I have a rails app which has search system which depends on elasticsearch, i have pushed it on heroku using the bonsai addon, but whenever i try to search something on my app it give me this error in the log. 我有一个Rails应用程序,它的搜索系统取决于elasticsearch,我已经使用盆景插件将其推到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}):

My Elasticsearch Controller 我的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

Please help!! 请帮忙!!

Bonsai support here. 盆景支持在这里。 Bonsai clusters are currently being provisioned on Elasticsearch 5.x, and as of Elasticsearch 5.0, the filtered query has been removed. 当前在Elasticsearch 5.x上配置了盆景集群,并且从Elasticsearch 5.0开始,已filtered查询已被删除。 Attempting to use a filtered query in 5.x results in that error message you're seeing. 尝试在5.x中使用filtered查询会导致您看到该错误消息。

From what you've shared, I would say the most likely issue is that the client is using a deprecated version of the Query DSL. 从您共享的内容来看,我想说的最可能的问题是客户端正在使用不建议使用的Query DSL版本。 That would suggest an incompatible gem version. 那将暗示一个不兼容的gem版本。

You can check what version your Elasticsearch gems are by running this from a command line: 您可以通过在命令行中运行它来检查Elasticsearch gems的版本:

bundle show | grep elasticsearch

If they are not 5.xx, update them in your Gemfile: 如果它们不是5.xx,请在您的Gemfile中更新它们:

gem "elasticsearch", "~> 5"
gem "elasticsearch-rails", "~> 5"

And run bundle update elasticsearch elasticsearch-rails . 并运行bundle update elasticsearch elasticsearch-rails Push the change to Heroku and try your search again. 将更改推送到Heroku,然后再次尝试搜索。

If that doesn't help, shoot an email to support@bonsai.io and we'll help you sort it out. 如果仍然不能解决问题,请发送电子邮件至support@bonsai.io,我们将帮助您解决问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Elasticsearch::Transport::Transport::Errors::BadRequest [400] 创建索引时 - Elasticsearch::Transport::Transport::Errors::BadRequest [400] while creating index 搜索#search中的Rails:Elasticsearch :: Transport :: Transport :: Errors :: BadRequest - Rails: Elasticsearch::Transport::Transport::Errors::BadRequest in Search#search 使用ActiveAdmin,SearchKick和SearchBox在Heroku上出现Elasticsearch :: Transport :: Transport :: Errors - Elasticsearch::Transport::Transport::Errors on Heroku with ActiveAdmin, SearchKick and SearchBox Elasticsearch :: Transport :: Transport :: Errors :: NotFound:[404] - Elasticsearch::Transport::Transport::Errors::NotFound: [404] Elasticsearch::Transport::Transport::Errors::Forbidden: [403] 发送超过 1200 个字符的文本字段时出错 - Elasticsearch::Transport::Transport::Errors::Forbidden: [403] error when sending text fields with more than 1200 characters Elasticsearch :: Transport :: Transport :: Errors :: NotAcceptable:[406] {“错误”:“不支持Content-Type标头[]”,“状态”:406} - Elasticsearch::Transport::Transport::Errors::NotAcceptable: [406] {“error”:“Content-Type header [] is not supported”,“status”:406} Elasticsearch :: Transport :: Transport :: Errors :: NotFound([404] {“错误”:{“ root_cause”:[{“类型”:“ index_not_found_exception” - Elasticsearch::Transport::Transport::Errors::NotFound ([404] {“error”:{“root_cause”:[{“type”:“index_not_found_exception” Activeadmin破坏记录,并在管理中出现Elasticsearch :: Transport :: Transport :: Errors :: NotFound异常[404] - Activeadmin Destroy Record with Exception Elasticsearch::Transport::Transport::Errors::NotFound in Admin [404] Rails-Twitter :: Error :: BadRequest(错误身份验证数据)-部署到Heroku之后 - Rails - Twitter::Error::BadRequest (Bad Authentication data) - After Deploying to Heroku 如何在rspec / capybara中停止App Transport Security错误 - How to stop App Transport Security error in rspec/capybara
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM