我使用了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={}>如何通过此搜索方法访问我的记录?
发布于 2019-10-25 02:07:59
你应该使用你的
响应
records类似的例子
Foo.new().search('1234').response.records它将返回您的活动记录对象。
https://stackoverflow.com/questions/45465025
复制相似问题