ElasticSearch partial update request merge Map<>

I have a complex ES document with multiple fields:

public class SomeDocument {
  @JsonProperty("id")
  private final String id;
  ...
  @JsonProperty("hits")
  private final Map<String, Double> hits = new HashMap<>();
}

hits stored in the schema as

 "template": {
    "mappings": {
      "properties": {
        "id": {
          "type": "keyword"
        },
        "hits": {
          "type": "flattened"
        }
}

I'm using elasticsearch-java-8.10.4 client and Partial update to update the document (it contains many fields and I'm interested in updating only some).

    // Create the update request
    Map<String, Object> partialDoc = new HashMap<>();
    partialDoc.put("hits", Map.of("testHit", 1.0));
    UpdateRequest<SomeDocument, Map<String, Object>> updateRequest =
        UpdateRequest.of(u -> u.index(indexName).id(documentId).doc(partialDoc));

    // Execute the update
      UpdateResponse<SomeDocument> updateResponse =
          esClient.update(updateRequest, SomeDocument.class);
  }

But after the update instead of overriding the Hit field with only new values ES merge them into an aggregated Map with previous Map values and new Map entry.
SO the result of the partial update returned hits in document:

hits={"oldHit"=1.0, "testHit"=1.0}

At the same time with other fields that under the hood use Set or List collections - all updates override old data from collections.
Probably someone faced similar behaviour with the partial update of the Maps? and know how to mediate this issue (with continued of use the partial update and ideally without script use)

From Elastic Search to Elasticsearch

Added language-clients