jkevan commented on code in PR #469:
URL: https://github.com/apache/unomi/pull/469#discussion_r935474565


##########
persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java:
##########
@@ -1444,7 +1444,10 @@ public void setPropertyMapping(final PropertyType 
property, final String itemTyp
             }
             Map<String, Object> subMappings = 
mappings.computeIfAbsent("properties", k -> new HashMap<>());
             Map<String, Object> subSubMappings = (Map<String, Object>) 
subMappings.computeIfAbsent("properties", k -> new HashMap<>());
-            mergePropertiesMapping(subSubMappings, 
createPropertyMapping(property));
+            Map<String, Object> propertyMapping = 
createPropertyMapping(property);
+            if (propertyMapping != null) {
+                mergePropertiesMapping(subSubMappings, propertyMapping);
+            }

Review Comment:
   I think we should simplify this function, if `Map<String, Object> 
propertyMapping = createPropertyMapping(property);` is null we can simply abort 
this function by `return;`
   
   Also for better perf, we can do this in the first line to avoid calculating 
the existing mapping in case createPropertyMapping return null.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to