I'm not a Java dev but looking at the high level Java REST client docs for Updating, they say:
The Update API allows to update an existing document by using a script or by passing a partial document.
That's because the client matches Elasticsearch's own Update API:
Enables you to script document updates. The script can update, delete, or skip modifying the document. The update API also supports passing a partial document, which is merged into the existing document. To fully replace an existing document, use the index API.
OK, as per the last sentence, to replace a doc (i.e.
PUT /your_index/_doc/yourdocID) you need to use the high-level REST client's Index API instead of Update.
You might think of indexing as only creating docs, but it's also replacing them. You can even control this via an optional argument. Look for
request.opType. But you don't need to change this. The default value allows creating or replacing a doc which works for you.