module Elasticsearch::Model::Extensions::BatchUpdating::ClassMethods
Public Instance Methods
__batch_updater__()
click to toggle source
# File lib/elasticsearch/model/extensions/batch_updating.rb, line 31 def __batch_updater__ @__batch_updater__ ||= ::Elasticsearch::Model::Extensions::BatchUpdating::BatchUpdater.new(self) end
for_batch_indexing()
click to toggle source
# File lib/elasticsearch/model/extensions/batch_updating.rb, line 50 def for_batch_indexing with_indexed_tables_included.extending(::Elasticsearch::Model::Extensions::BatchUpdating::Association::Extension) end
for_indexing()
click to toggle source
# File lib/elasticsearch/model/extensions/batch_updating.rb, line 46 def for_indexing for_batch_indexing end
update_index_in_batches(batch_size: DEFAULT_BATCH_SIZE, where: nil, index: nil, type: nil)
click to toggle source
@param [Fixnum] batch_size
# File lib/elasticsearch/model/extensions/batch_updating.rb, line 55 def update_index_in_batches(batch_size: DEFAULT_BATCH_SIZE, where: nil, index: nil, type: nil) records_in_scope = if where.nil? for_batch_indexing else for_batch_indexing.where(where) end records_in_scope.update_index_in_batches(batch_size: batch_size, index: index, type: type) end
update_index_in_parallel(parallelism:, index: nil, type: nil, min: nil, max: nil, batch_size:DEFAULT_BATCH_SIZE)
click to toggle source
# File lib/elasticsearch/model/extensions/batch_updating.rb, line 35 def update_index_in_parallel(parallelism:, index: nil, type: nil, min: nil, max: nil, batch_size:DEFAULT_BATCH_SIZE) klass = self Parallel.each(__batch_updater__.split_ids_into(parallelism, min: min, max: max), in_processes: parallelism) do |id_range| __batch_updater__.reconnect! klass.for_indexing.update_index_for_ids_in_range id_range, index: index, type: type, batch_size: batch_size end klass.connection.reconnect! end