You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by "jkevan (via GitHub)" <gi...@apache.org> on 2023/03/27 13:53:15 UTC

[GitHub] [unomi] jkevan commented on a diff in pull request #599: UNOMI-709: avoid updating property type mapping in case a mapping alr…

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


##########
persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java:
##########
@@ -1621,16 +1626,31 @@ private String convertValueTypeToESType(String valueTypeId) {
                 return "date";
             case "string":
             case "id":
+            case "email": // TODO Consider supporting email mapping in ES, right now will be map to text to avoid warning in logs
                 return "text";
             default:
                 return null;
         }
     }
 
-    private void putMapping(final String source, final String indexName) throws IOException {
-        PutMappingRequest putMappingRequest = new PutMappingRequest(indexName);
-        putMappingRequest.source(source, XContentType.JSON);
-        client.indices().putMapping(putMappingRequest, RequestOptions.DEFAULT);
+    private boolean putMapping(final String source, final String indexName) throws IOException {

Review Comment:
   Ideally the return result should be used to decide either to continue with the next steps, it was not the case before and I didn't want to introduce breaking changes on the behavior of profile property type save/updates.
   Still I found this returned results useful in some case.
   So to answer more specifically, no it's not necessary, but I think it's a nice to have.
   Mapping save/update can be rejected by ES with error, and being able to know if something was wrong is better, even if we are not doing it for the moment.



-- 
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: dev-unsubscribe@unomi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org