How use complex params in java


I'm using painless to do some complex json replacement. In REST call, I can use params like below

"params": {
    "doc": [{"b": "value3", "b1": "value33"}, {"d": "value44", "array1": ["abc", "123"]}],
    "total": 2

but I can't find how to set the params Map it in java api with Script class?

Script inline =
          new Script(ScriptType.INLINE, "painless", scriptbody, paramsMap);

very appreciate if anyone can give a hand.