How to update a single field using the Java API Client?

I'm currently using the deprecated Java High Level REST Client to partially update a document using something similar to the guide: Update API | Java REST Client [7.17] | Elastic

I'm trying to migrate to the latest Elasticsearch and switch over to using the non-deprecated Java API Client instead, but partial updates are not covered in: Using the Java API Client | Elasticsearch Java API Client [8.2] | Elastic

There's an UpdateRequest (java-client 8.2.2 API) class, but this appears to be parameterised by 2 types, TDocument and TPartialDocument, but it's not clear what needs to be implemented to just update a single field here.

Are there any simple examples available on how to do this? I'm not sure how new the Java API Client is, it might just be that the documentation hasn't caught up yet, and it's not recommended for general use yet.


This example update partial document:

    Foo foo = Foo.builder()
    return client.update(u -> u.index("your_index")
        .doc(foo), Foo.class);