diff --git a/ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/remote/ConnectorUtils.java b/ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/remote/ConnectorUtils.java index deb0f8c45d..ab4ed7fd6c 100644 --- a/ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/remote/ConnectorUtils.java +++ b/ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/remote/ConnectorUtils.java @@ -95,6 +95,8 @@ private static RemoteInferenceInputDataSet processTextDocsInput(TextDocsInputDat for (String doc : inputDataSet.getDocs()) { if (doc != null) { String gsonString = gson.toJson(doc); + // in 2.9, user will add " before and after string + // gson.toString(string) will add extra " before after string, so need to remove docs.add(gsonString.substring(1, gsonString.length() - 1)); } else { docs.add(null);