Class: Elasticsearch::Model::Multimodel
- Inherits:
-
Object
- Object
- Elasticsearch::Model::Multimodel
- Defined in:
- lib/elasticsearch/model/multimodel.rb
Overview
Wraps a collection of models when querying multiple indices
Instance Attribute Summary collapse
-
#models ⇒ Object
readonly
Returns the value of attribute models.
Instance Method Summary collapse
-
#client ⇒ Object
Get the client common for all models.
-
#index_name ⇒ Array
Get an Array of index names used for retrieving documents when doing a search across multiple models.
-
#initialize(*models) ⇒ Multimodel
constructor
A new instance of Multimodel.
Constructor Details
#initialize(*models) ⇒ Multimodel
Returns a new instance of Multimodel.
69 70 71 72 |
# File 'lib/elasticsearch/model/multimodel.rb', line 69 def initialize(*models) @models = models.flatten @models = Model::Registry.all if @models.empty? end |
Instance Attribute Details
#models ⇒ Object (readonly)
Returns the value of attribute models.
65 66 67 |
# File 'lib/elasticsearch/model/multimodel.rb', line 65 def models @models end |
Instance Method Details
#client ⇒ Object
Get the client common for all models
86 87 88 |
# File 'lib/elasticsearch/model/multimodel.rb', line 86 def client Elasticsearch::Model.client end |
#index_name ⇒ Array
Get an Array of index names used for retrieving documents when doing a search across multiple models
78 79 80 |
# File 'lib/elasticsearch/model/multimodel.rb', line 78 def index_name models.map { |m| m.index_name } end |