Class: ObjectDsl
Instance Method Summary
collapse
#operation_list, template
#alias_index_op, #create_index_op, #delete_index_op, #update_mapping_op, #update_settings_op
define, perform
#getset, #getset_collection_item
Instance Method Details
#mapping_rules ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/wukong-migrate/elasticsearch_migration.rb', line 43
def mapping_rules
{}.tap do |rules|
rules[:dynamic] = dynamic if attribute_set?(:dynamic)
rules[:_all] = { enabled: all } if attribute_set?(:all)
rules[:_source] = { enabled: source } if attribute_set?(:source)
rules[:_ttl] = { enabled: true, default: ttl } if attribute_set?(:ttl)
rules[:_timestamp] = { enabled: timestamp } if attribute_set?(:timestamp)
rules[:_analyzer] = { path: analyzer_field } if attribute_set?(:analyzer_field)
rules[:_boost] = { name: boost_field } if attribute_set?(:boost_field)
rules[:_parent] = { type: parent } if attribute_set?(:parent)
rules[:_routing] = { path: routing } if attribute_set?(:routing)
end
end
|
#model_mapping ⇒ Object
57
58
59
|
# File 'lib/wukong-migrate/elasticsearch_migration.rb', line 57
def model_mapping
name.to_s.camelize.constantize.to_mapping
end
|
#to_mapping ⇒ Object
61
62
63
|
# File 'lib/wukong-migrate/elasticsearch_migration.rb', line 61
def to_mapping
model_mapping.merge(mapping_rules)
end
|