Params should be added on the Script itself. It would look something like this:
new Script(ScriptType.INLINE, "painless", "ctx._source.NameArray += params.newobject", Collections.singletonMap("newobject", newObject))
Also, the actionGet() method is on the ActionFuture returned by execute(), not on the builder. But you can call get() directly on the builder. There is no need to get the future if you want a synchronous response.
Sorry, I was looking at the code for 6.0 (unreleased). The documentation you reference there is the place to look. But which constructor signature to look for depends on the version of elasticsearch you using.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.