I am upgrading some legacy code to utilize OpenSearch Java Api Client v1.0.0. I am limited on version because of jdk 11 required.
I would like to do something similar:
POST xx/_update/123
{
"doc": {
"dateLastModified":1682281110874,
"FR":"sss",
"someOtherId":12,
"EN":"sss"
}
}
Here is the code I believed should of worked but I believe I am not allowed to use String
public void updateAsync(@NotNull PK id, @NotNull String document) throws IOException {
openSearchAsyncClient.update(new UpdateRequest.Builder<T, String>()
.index(index)
.id(convertId(id))
.doc(document)
.build(), targetType);
}
I cannot seem to pass to it any other types of document than the Data Class. To make it work with old code, I need to be able to provide it a string.
I cannot find any documentations on Update.
I get a OpenSearchException with this detailed message:
Request failed: [x_content_parse_exception] [1:8] [UpdateRequest] doc doesn’t support values of type: VALUE_STRING