我将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
方法。谁能帮我解决这个问题?谢谢。