From 3c516fa64c229a559880a3512a0072916cffba21 Mon Sep 17 00:00:00 2001 From: Abhinav Dangeti Date: Tue, 8 Aug 2023 17:50:15 -0600 Subject: [PATCH] MB-57394: Replace iterative lookup for properties within documentMappingForPath --- mapping/document.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mapping/document.go b/mapping/document.go index 7215e5b92..76bfdbad8 100644 --- a/mapping/document.go +++ b/mapping/document.go @@ -149,12 +149,11 @@ func (dm *DocumentMapping) documentMappingForPath(path string) ( current := dm OUTER: for i, pathElement := range pathElements { - for name, subDocMapping := range current.Properties { - if name == pathElement { - current = subDocMapping - continue OUTER - } + if subDocMapping, exists := current.Properties[pathElement]; exists { + current = subDocMapping + continue OUTER } + // no subDocMapping matches this pathElement // only if this is the last element check for field name if i == len(pathElements)-1 {