class EsMigration
Public Instance Methods
combined_operations()
click to toggle source
# File lib/wukong-migrate/elasticsearch_migration.rb, line 136 def combined_operations operation_list + nested_operations end
nested_operations()
click to toggle source
# File lib/wukong-migrate/elasticsearch_migration.rb, line 132 def nested_operations (creations.to_a + updates.to_a).map{ |idx| idx.operation_list }.flatten end
perform(options = {})
click to toggle source
# File lib/wukong-migrate/elasticsearch_migration.rb, line 140 def perform(options = {}) combined_operations.each do |op| op.configure_with options log.info op.info log.debug op.raw_curl_string response = op.execute log.debug [response.code, response.parsed_response].join(' ') if response.code == 200 log.info 'Operation complete' else log.error response.parsed_response break unless options[:force] end end end
receive_create_index(attrs, &block)
click to toggle source
# File lib/wukong-migrate/elasticsearch_migration.rb, line 114 def receive_create_index(attrs, &block) idx = IndexDsl.receive(attrs, &block) operation_list << create_index_op(idx.name, idx.index_settings) idx end
receive_delete_index(attrs, &block)
click to toggle source
# File lib/wukong-migrate/elasticsearch_migration.rb, line 126 def receive_delete_index(attrs, &block) idx = IndexDsl.receive(attrs, &block) operation_list.unshift delete_index_op(idx.name) idx end
receive_update_index(attrs, &block)
click to toggle source
# File lib/wukong-migrate/elasticsearch_migration.rb, line 120 def receive_update_index(attrs, &block) idx = IndexDsl.receive(attrs, &block) operation_list << update_settings_op(idx.name, idx.index_settings) idx end