Update jsonString with UpdateRequest through new java client[8+ version]

Getting below error while trying to update json string through update request.

[x_content_parse_exception] [1:8] [UpdateRequest] doc doesn't support values of type: VALUE_STRING

Below is my code snnipt

client.update(getUpdateRequest(id, index, jsonString), String.class);
private UpdateRequest getUpdateRequest(String id, String index, String jsonString) {
        return UpdateRequest.of(indexRequest -> indexRequest
                .index(index)
                .id(id)
                .refresh(Refresh.WaitFor)
                .waitForActiveShards(activeShards -> activeShards.count(1))
                .docAsUpsert(Boolean.TRUE)
                .doc(jsonString));
    }

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.