简体   繁体   English

弹性搜索可获取多个模型的所有记录

[英]Elastic search get all records for multiple models

I have two separate objects authors and publishers . 我有两个单独的对象authorspublishers How can I use elasticsearch to get all of both types? 如何使用elasticsearch来获得所有这两种类型?

I know I can do the following to search both: 我知道我可以执行以下两项搜索:

Elasticsearch::Model.search('foo', [Author, Publisher])

But how do I get that to return all records? 但是,如何获取所有记录呢?

Sorry, misread the question in my original answer. 抱歉,在我的原始答案中误读了问题。

To match all documents do: 要匹配所有文档,请执行以下操作:

response = Elasticsearch::Model.search('{ "query": { "match_all": {} } }', [Author, Publisher])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM