I failed to show the code:
Reader r = new StringReader(node.toJSONString());
try {
IndexRequest<JsonData> request =
IndexRequest.of(b -> b
.id(id)
.index(index)
.withJson(r));
IndexResponse indexResponse = client.index(request);
result.setResultObject(indexResponse.result().toString());
} catch (Exception e) {
where node is a JSONObject - we grab its JSON string value, pass that to a reader, then into the IndexRequest