首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >按elasticsearch-model搜索不返回记录

按elasticsearch-model搜索不返回记录
EN

Stack Overflow用户
提问于 2017-08-02 23:28:28
回答 1查看 580关注 0票数 3

我使用了elasticsearch-model,我使用了关注方法,这是我的搜索方法。我尝试过使用curl查询,它返回了5个条目,但是当我使用这个方法时

代码语言:javascript
复制
def search_index(*args)
      self.__elasticsearch__.search(*args)
end

它返回给我一个类

代码语言:javascript
复制
(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={}>

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

EN

回答 1

Stack Overflow用户

发布于 2019-10-25 02:07:59

你应该使用你的

响应

代码语言:javascript
复制
records

类似的例子

代码语言:javascript
复制
Foo.new().search('1234').response.records

它将返回您的活动记录对象。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45465025

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档