Module: Elastics::Model::HelperMethods::ClassMethods
- Defined in:
- lib/elastics/model/helper_methods.rb
Instance Method Summary collapse
- #bulk_elastics(params = {}, &block) ⇒ Object
- #elastics_params ⇒ Object
- #index_batch_elastics(batch) ⇒ Object
- #refresh_elastics ⇒ Object
- #reindex_elastics(options = {}) ⇒ Object
- #request_elastics(params) ⇒ Object
Instance Method Details
#bulk_elastics(params = {}, &block) ⇒ Object
28 29 30 |
# File 'lib/elastics/model/helper_methods.rb', line 28 def bulk_elastics(params = {}, &block) elastics.bulk(elastics_params.merge!(params), &block) end |
#elastics_params ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/elastics/model/helper_methods.rb', line 16 def elastics_params { index: elastics_index_name, type: elastics_type_name, model: self, } end |
#index_batch_elastics(batch) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/elastics/model/helper_methods.rb', line 36 def index_batch_elastics(batch) bulk_elastics do |bulk| batch.each do |record| bulk.index record.id, record.to_elastics end end end |
#refresh_elastics ⇒ Object
32 33 34 |
# File 'lib/elastics/model/helper_methods.rb', line 32 def refresh_elastics request_elastics(method: :post, type: nil, id: :_refresh) end |
#reindex_elastics(options = {}) ⇒ Object
44 45 46 |
# File 'lib/elastics/model/helper_methods.rb', line 44 def reindex_elastics( = {}) raise 'Not implemented' end |
#request_elastics(params) ⇒ Object
24 25 26 |
# File 'lib/elastics/model/helper_methods.rb', line 24 def request_elastics(params) elastics.request(elastics_params.merge!(params)) end |