Skip to content

Commit

Permalink
Treat dot as nested field in field_map for inference processor
Browse files Browse the repository at this point in the history
Signed-off-by: Sanjana679 <[email protected]>
  • Loading branch information
Sanjana679 committed Nov 9, 2023
1 parent cda2f82 commit 7006c97
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ Map<String, Object> buildMapWithProcessorKeyAndOriginalValue(IngestDocument inge
for (Map.Entry<String, Object> fieldMapEntry : fieldMap.entrySet()) {
String originalKey = fieldMapEntry.getKey();
Object targetKey = fieldMapEntry.getValue();

int nestedDotIndex = originalKey.indexOf('.');
if (nestedDotIndex != -1) {
Map<String, Object> temp = new LinkedHashMap<>();
temp.put(originalKey.substring(nestedDotIndex + 1), targetKey);
targetKey = temp;

originalKey = originalKey.substring(0, nestedDotIndex);
}

if (targetKey instanceof Map) {
Map<String, Object> treeRes = new LinkedHashMap<>();
buildMapWithProcessorKeyAndOriginalValueForMapType(originalKey, targetKey, sourceAndMetadataMap, treeRes);
Expand Down

0 comments on commit 7006c97

Please sign in to comment.