Elasticsearch Persistence查询未采用搜索方法

时间:2019-07-15 12:03:30

标签: ruby-on-rails elasticsearch ruby-on-rails-5 elasticsearch-rails

我将Rails从4升级到5.2,还将Elasticsearch从2.4升级到6.8。

以下是我遇到的错误:

super: no superclass method `search' for Reporting::Credit:Class

这是发生错误的地方:

module Reporting
  class Credit
    include Elasticsearch::Persistence::Repository
    include Elasticsearch::Persistence::Repository::DSL

    def self.search(query, options = {})
      ActiveSupport::Notifications.instrument "search.elasticsearch", name: 'Search', klass: self, search: query do
        super # HERE
      end
    end
  end
end

这是我运行搜索的方式:

def run_search
  search_class.search(request.params)
end

我期望它采用Elasticsearch search方法的方式是通过include Elasticsearch::Persistence::Repository语句。但是,它没有选择search方法。谁能帮我解决这个问题?谢谢。

0 个答案:

没有答案