Module: Elasticsearch::Model::Adapter::ActiveRecord::Importing
- Defined in:
- lib/elasticsearch/model/adapters/active_record.rb
Instance Method Summary collapse
-
#__find_in_batches(options = {}, &block) ⇒ Object
Fetch batches of records from the database.
- #__transform ⇒ Object
Instance Method Details
#__find_in_batches(options = {}, &block) ⇒ Object
Fetch batches of records from the database
85 86 87 88 89 90 91 92 93 |
# File 'lib/elasticsearch/model/adapters/active_record.rb', line 85 def __find_in_batches(={}, &block) named_scope = .delete(:scope) scope = named_scope ? self.__send__(named_scope) : self scope.find_in_batches() do |batch| yield batch end end |
#__transform ⇒ Object
95 96 97 |
# File 'lib/elasticsearch/model/adapters/active_record.rb', line 95 def __transform lambda { |model| { index: { _id: model.id, data: model.__elasticsearch__.as_indexed_json } } } end |