7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/elasticsearch/model/mongoid_extensions/fields.rb', line 7
def to_fields
mapping_hash = to_hash[@type.to_sym]
l = lambda do |h, parent = nil|
res = []
h.each do |field_name, props|
key_type = Elasticsearch::Model::Indexing::Mappings::TYPES_WITH_EMBEDDED_PROPERTIES.include?(props[:type].to_s) ? :properties : :fields
path = [parent, field_name].compact.join('.')
res << path
res += l.call(props[key_type], path) if props[key_type].present?
end
res.compact
end
l.call(mapping_hash[:properties]).map(&:to_s)
end
|