星探TalentScout扩展了Elasticsearch::Model以搜索多个索引。用法如下:

response = TalentScout.search([Video, Music, Book], { query: { query_string: { query: 'Adventure', default_operator: 'AND' } } })

这假设您的模型中已经有代码来处理基本的Elasticsearch::Model功能;例如:


include Elasticsearch::Model::Callbacks

index_name \"#{self.table_name}_#{Rails.env}\"