Elasticsearch Jest update a whole document Elasticsearch Jest update a whole document elasticsearch elasticsearch

Elasticsearch Jest update a whole document


Already answered this in the github issue you also opened but again:

You should use the second way you linked (Whole document update) and there is no special API for it, it's just a regular index request. So you can do it simply by sending your Index request against the id of the document you want to update.

For example assuming you have below document already indexed in Elasticsearch within index people, type food, id 9:

{"user": "kramer", "fav_food": "jello"}

Then you would do:

String source = "{\"user\": \"kramer\", \"fav_food\": \"pizza\"}";JestResult result = client.execute(            new Index.Builder(source)                    .index("people")                    .type("food")                    .id(9)                    .build()    );