Class: IndexDsl

Inherits:
EsMigrationDsl show all
Defined in:
lib/wukong-migrate/elasticsearch_migration.rb

Instance Method Summary collapse

Methods inherited from EsMigrationDsl

#operation_list, template

Methods included from EsHttpOperation::Helpers

#alias_index_op, #create_index_op, #delete_index_op, #update_mapping_op, #update_settings_op

Methods inherited from Wukong::Migration::Dsl

define, perform

Methods included from Gorillib::Builder

#getset, #getset_collection_item

Instance Method Details

#index_settingsObject



103
104
105
# File 'lib/wukong-migrate/elasticsearch_migration.rb', line 103

def index_settings
  { number_of_replicas: number_of_replicas }.compact_blank
end

#receive_alias_to(attrs, &block) ⇒ Object



95
96
97
# File 'lib/wukong-migrate/elasticsearch_migration.rb', line 95

def receive_alias_to(attrs, &block)
  operation_list << alias_index_op(:add, self.name, attrs[:name], attrs[:filter])
end

#receive_create_mapping(attrs, &block) ⇒ Object



77
78
79
80
81
# File 'lib/wukong-migrate/elasticsearch_migration.rb', line 77

def receive_create_mapping(attrs, &block)
  obj = ObjectDsl.receive(attrs, &block)
  operation_list << update_mapping_op(self.name, obj.name, obj.to_mapping)
  obj
end

#receive_delete_mapping(attrs, &block) ⇒ Object



89
90
91
92
93
# File 'lib/wukong-migrate/elasticsearch_migration.rb', line 89

def receive_delete_mapping(attrs, &block)
  obj = ObjectDsl.receive(attrs, &block)
  operation_list.unshift update_mapping_op(self.name, obj.name, obj.to_mapping)
  obj
end

#receive_remove_alias(attrs, &block) ⇒ Object



99
100
101
# File 'lib/wukong-migrate/elasticsearch_migration.rb', line 99

def receive_remove_alias(attrs, &block)
  operation_list << alias_index_op(:remove, self.name, attrs[:name], attrs[:filter])
end

#receive_update_mapping(attrs, &block) ⇒ Object



83
84
85
86
87
# File 'lib/wukong-migrate/elasticsearch_migration.rb', line 83

def receive_update_mapping(attrs, &block)
  obj = ObjectDsl.receive(attrs, &block)
  operation_list << update_mapping_op(self.name, obj.name, obj.to_mapping)
  obj
end