Java API update index

HI everyone, I want to add a new field to a document already indexed.
I find this in the documentation:

curl -X POST "localhost:9200/home2/_update/Y_vIvoEB3cv_8tuHzt7j?pretty" -H 'Content-Type: application/json' -d'
{
  "doc": {
    "new field: "test"
  }
}
'

But i really don't know how to apply this to the java api.
If someone can show me how to do it that would be great !

2 Likes

I'm also interested in learning how to apply this in the Java API.

The update method accepts Class<TDocument> as an argument. Given that requirement, how can we execute an update request when our document data consists of arbitrary properties (e.g. Map<String, Object>)?

2 Likes

Also struggling to find any example code using the new Java API for updates. We store our documents as dynamic json data in Elastic currently, with fields that don't always map out to a specific Java class.

What would the most generic case be for getting data back in a similar format to the one we are used to in the 7.17 high level rest client API?

2 Likes

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