9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/flex/class_proxy/active_model.rb', line 9
def default_mapping
props = { }
context.attributes.each do |name, attr|
options = attr.send(:options)
props[name] = case
when options.has_key?(:properties)
Utils.keyfy(:to_s, attr.send(:options)[:properties])
when options.has_key?(:not_analyzed) && options[:not_analyzed] ||
options.has_key?(:analyzed) && !options[:analyzed]
{ 'type' => 'string', 'index' => 'not_analyzed' }
when options[:type] == DateTime
{ 'type' => 'date', 'format' => 'dateOptionalTime' }
else
next
end
end
props.empty? ? super : super.deep_merge(index => {'mappings' => {type => {'properties' => props}}})
end
|