Hisoka-X commented on code in PR #8412:
URL: https://github.com/apache/seatunnel/pull/8412#discussion_r1900608093
##########
seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/client/EsRestClient.java:
##########
@@ -695,4 +695,75 @@ private static Map<String, BasicTypeDefine<EsType>>
getFieldTypeMappingFromPrope
return fieldType;
}));
}
+
+ /**
+ * Add a new field to an existing index
+ *
+ * @param index index name
+ * @param fieldTypeDefine field type definition
+ */
+ public void addField(String index, BasicTypeDefine<EsType>
fieldTypeDefine) {
+ String endpoint = String.format("/%s/_mapping", index);
+ Request request = new Request("PUT", endpoint);
+
+ // Build mapping JSON for the new field
+ ObjectMapper mapper = new ObjectMapper();
Review Comment:
Please reuse ObjectMapper, it's thread safe.
--
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]