Thanks for the feedback @ndtreviv. The update API requires an additional Class
parameter.
The reason for this is the source
parameter that allows retrieving the modified document. In your case you're not requesting it, so we can use the Void
class.
Assuming the class of document
is SomeDoc
:
client.update(new UpdateRequest.Builder<Void, SomeDoc>()
.index(index)
.id(id)
.doc(document)
.build(),
Void.class // <-- additional parameter
);
You can also write it in a more compact form as:
client.update(b -> b
.index(index)
.id(id)
.doc(appData),
Void.class
);
and similarly for the script update:
client.update(u -> u
.index(index)
.id(id)
.lang("painless")
.script(s -> s
.inline(i -> i
.source("ctx._source.status = '"+ status +"'")
)
),
Void.class
);
Hope this helps. We're currently improving the docs, a section on the update request will be added there.