Module: Elasticsearch::Model::Adapter::ActiveRecord::Importing

Defined in:
lib/elasticsearch/model/adapters/active_record.rb

Instance Method Summary collapse

Instance Method Details

#__find_in_batches(options = {}, &block) ⇒ Object

Fetch batches of records from the database



85
86
87
88
89
90
# File 'lib/elasticsearch/model/adapters/active_record.rb', line 85

def __find_in_batches(options={}, &block)
  find_in_batches(options) do |batch|
    batch_for_bulk = batch.map { |a| { index: { _id: a.id, data: a.__elasticsearch__.as_indexed_json } } }
    yield batch_for_bulk
  end
end