in compliance/indextemplate.go [104:129]
func (t *SimulatedIndexTemplate) FieldMapping(name string) (MappingProperty, error) {
if runtimeField, isRuntime := t.Mappings.Runtime[name]; isRuntime {
// TODO: Look for some solution to don't need to modify the properties.
runtimeField["runtime"] = true
return runtimeField, nil
}
parts := strings.Split(name, ".")
properties := t.Mappings.Properties
for i, part := range parts {
property, found := properties[part]
if !found {
return nil, fmt.Errorf("property %q not found in index template", name)
}
if i+1 == len(parts) {
return property, nil
}
nextProperties, err := property.Properties()
if err != nil {
return nil, fmt.Errorf("property %q not found in index template: %w", name, err)
}
properties = nextProperties
}
return nil, fmt.Errorf("property %q not found in index template", name)
}