module Elasticsearch::Model::Extensions::BatchUpdating::Association::Extension
Public Instance Methods
update_index_for_ids_from(from, to:, index: nil, type: nil, batch_size: DEFAULT_BATCH_SIZE)
click to toggle source
# File lib/elasticsearch/model/extensions/batch_updating.rb, line 78 def update_index_for_ids_from(from, to:, index: nil, type: nil, batch_size: DEFAULT_BATCH_SIZE) record_id = arel_table[:id] conditions = record_id.gteq(from).and(record_id.lteq(to)) where(conditions).update_index_in_batches(batch_size: batch_size, index: index, type: type) end
update_index_for_ids_in_range(range, index: nil, type: nil, batch_size: DEFAULT_BATCH_SIZE)
click to toggle source
# File lib/elasticsearch/model/extensions/batch_updating.rb, line 86 def update_index_for_ids_in_range(range, index: nil, type: nil, batch_size: DEFAULT_BATCH_SIZE) update_index_for_ids_from(range.first, to: range.last, type: type, index: index, batch_size: batch_size) end
update_index_in_batches(batch_size: DEFAULT_BATCH_SIZE, index: nil, type: nil)
click to toggle source
# File lib/elasticsearch/model/extensions/batch_updating.rb, line 90 def update_index_in_batches(batch_size: DEFAULT_BATCH_SIZE, index: nil, type: nil) find_in_batches(batch_size: batch_size) do |records| __batch_updater__.update_index_in_batch(records, index: index, type: type) end end
update_index_in_chunks(num, index: index) { |-> { update_index_for_ids_in_range(r, index: index)| ... }
click to toggle source
# File lib/elasticsearch/model/extensions/batch_updating.rb, line 68 def update_index_in_chunks(num, index: index) klass.split_ids_into(num).map do |r| if block_given? yield -> { update_index_for_ids_in_range(r, index: index) } else update_index_for_ids_in_range(r, index: index) end end end