Skip to content

Commit

Permalink
MB-61716: Corrected Field Mapping for Path Logic (#2031)
Browse files Browse the repository at this point in the history
The previous logic here only checked fields one level deep which means
any nested fields were not being considered. I replaced these with
existing functions to get back the correct field mapping.
  • Loading branch information
Likith101 committed May 14, 2024
1 parent 1a19544 commit 327c1f3
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions mapping/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,24 +437,16 @@ func (im *IndexMappingImpl) FieldAnalyzer(field string) string {
func (im *IndexMappingImpl) FieldMappingForPath(path string) FieldMapping {
if im.TypeMapping != nil {
for _, v := range im.TypeMapping {
for field, property := range v.Properties {
for _, v1 := range property.Fields {
if field == path {
// Return field mapping if the name matches the path param.
return *v1
}
}
fm := v.fieldDescribedByPath(path)
if fm != nil {
return *fm
}
}
}

for field, property := range im.DefaultMapping.Properties {
for _, v1 := range property.Fields {
if field == path {
// Return field mapping if the name matches the path param.
return *v1
}
}
fm := im.DefaultMapping.fieldDescribedByPath(path)
if fm != nil {
return *fm
}

return FieldMapping{}
Expand Down

0 comments on commit 327c1f3

Please sign in to comment.