Update with Partial Document (string/json format)

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
OpenSearch Java Client version (1.0.0) (Limited because higher versions required jdk 11)

Describe the issue:
I need to do a partial document update with OpenSearch Java Client API.

Something like this:

POST xx/_update/123
{
  "doc": {
  	"dateLastModified":1682281110874,
  	"FR":"sss",
  	"someOtherId":12,
  	"EN":"sss"
  }
}

Here is the Code to execute it:

    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

What version of opensearch server are you running?

The server is ElasticSearch 7.4.
We plan to transition in the future to the newer version with OpenSearch.

You might want to try using the elasticsearch client from that version for now, at least to see if that addresses the issue.

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