Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Elasticsearch::Transport::Transport::Errors::BadRequest错误_Ruby On Rails_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Heroku - Fatal编程技术网 elasticsearch,heroku,Ruby On Rails,elasticsearch,Heroku" /> elasticsearch,heroku,Ruby On Rails,elasticsearch,Heroku" />

Ruby on rails Elasticsearch::Transport::Transport::Errors::BadRequest错误

Ruby on rails Elasticsearch::Transport::Transport::Errors::BadRequest错误,ruby-on-rails,elasticsearch,heroku,Ruby On Rails,elasticsearch,Heroku,我有一个rails应用程序,它有一个基于elasticsearch的搜索系统,我使用bonsai插件将它推到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

我有一个rails应用程序,它有一个基于elasticsearch的搜索系统,我使用bonsai插件将它推到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
class SearchController

请帮忙

这里有盆景支架。盆景集群目前正在Elasticsearch 5.x上设置,从Elasticsearch 5.0开始,
过滤的
查询已被删除。尝试在5.x中使用
筛选的
查询会导致您看到的错误消息

根据您的分享,我想说最有可能的问题是客户机使用的查询DSL版本已弃用。这可能意味着一个不兼容的gem版本

通过从命令行运行以下命令,可以检查Elasticsearch gems的版本:

bundle show | grep elasticsearch

如果它们不是5.x.x,请在您的文件中更新它们:

gem "elasticsearch", "~> 5"
gem "elasticsearch-rails", "~> 5"
然后运行
捆绑更新elasticsearch elasticsearch rails
。将更改推送到Heroku,然后再次尝试搜索


如果这没用,发一封电子邮件给support@bonsai.io我们将帮助您解决问题。

这里提供盆景支持。盆景集群目前正在Elasticsearch 5.x上设置,从Elasticsearch 5.0开始,
过滤的
查询已被删除。尝试在5.x中使用
筛选的
查询会导致您看到的错误消息

根据您的分享,我想说最有可能的问题是客户机使用的查询DSL版本已弃用。这可能意味着一个不兼容的gem版本

通过从命令行运行以下命令,可以检查Elasticsearch gems的版本:

bundle show | grep elasticsearch

如果它们不是5.x.x,请在您的文件中更新它们:

gem "elasticsearch", "~> 5"
gem "elasticsearch-rails", "~> 5"
然后运行
捆绑更新elasticsearch elasticsearch rails
。将更改推送到Heroku,然后再次尝试搜索


如果这没用,发一封电子邮件给support@bonsai.io我们将帮助您解决问题。

我已经更新了gemfile@Rob Sears,但问题仍然是samei已经更新了gemfile@Rob Sears,但问题仍然是一样的