Java API update document

I need help to do update document with java api. I'm trying to build update with setScriptParams. Update fails with exception:

org.elasticsearch.action.ActionRequestValidationException: Validation Failed: 1: script or doc is missing;

But with line setScript (commented setScriptParams) this works well.
I need to execute as name - value.


this is my code

String newTitle = "new title value";

HashMap<String, Object> scriptParams = new HashMap<String, Object>();
scriptParams.put("title", "new title");
scriptParams.put("description", "new description");

response = client.prepareUpdate().setIndex(ItemConstant.INDEX_ITEMS)
//.setScript("ctx._source.title="" + newTitle + """)

Found the below code on this link, this might help

Example showing how to update a title field:
Node node = nodeBuilder().client(true).node();
Client client = node.client();
String index = "my_index";
String type= "my_type";
String id = "1";
String newTitle = "my new title";
client.prepareUpdate(index, type, id)
.setScript("ctx._source.title="" + newTitle + """)