Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlfonsoUceda/918d737cf5e4b6242ea4f848ae6a3485 to your computer and use it in GitHub Desktop.
Save AlfonsoUceda/918d737cf5e4b6242ea4f848ae6a3485 to your computer and use it in GitHub Desktop.
partial_reindex
require 'progressbar'
schedulings = Company.find_by_name("SPT").schedulings.preloads_for_indexing
@progress = ProgressBar.new('Processing schedulings', schedulings.count)
start_now = Time.now
puts "Started at: #{start_now}"
schedulings.find_each do |scheduling|
Scheduling.__elasticsearch__.client.update(
index: Scheduling.index_name,
type: "scheduling",
id: scheduling.id,
body: {
"doc" => {
"metadata" => scheduling.serialized_metadata
}
}
)
@progress.inc
end
@progress.finish
finish_now = Time.now
puts "Finished at: #{finish_now}"
result = finish_now - start_now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment