elasticsearch-model搜索未返回记录

问题描述 投票:3回答:1

我正在使用elasticsearch-model,并且使用了关注方法,这是我的搜索方法。我已经尝试通过curl进行查询,它向我返回了5个条目,但是当我使用此方法时

def search_index(*args)
      self.__elasticsearch__.search(*args)
end

它返回我一个班级

(byebug) Entry.search_index('test').records
#<Elasticsearch::Model::Response::Records:0x007f8eb85ca280 @klass=[PROXY] Entry(id: integer, created_at: datetime, updated_at: datetime, source_id: integer, data: text, uuid: string, source_entry_id: string, bytesize: integer), @response=#<Elasticsearch::Model::Response::Response:0x007f8eb85ca370 @klass=[PROXY] Entry(id: integer, created_at: datetime, updated_at: datetime, source_id: integer, data: text, uuid: string, source_entry_id: string, bytesize: integer), @search=#<Elasticsearch::Model::Searching::SearchRequest:0x007f8eb85ca438 @klass=[PROXY] Entry(id: integer, created_at: datetime, updated_at: datetime, source_id: integer, data: text, uuid: string, source_entry_id: string, bytesize: integer), @options={}, @definition={:index=>"self_driving_entries", :type=>"entry", :q=>"test"}>, @records=#<Elasticsearch::Model::Response::Records:0x007f8eb85ca280 ...>>, @options={}>

如何通过这种搜索方法访问我的记录?

ruby-on-rails ruby elasticsearch-model
1个回答
0
投票

您应该使用您的

© www.soinside.com 2019 - 2024. All rights reserved.