Java API for inserting nested documents

Hi,

I'm trying to use the Java API to do insert/updates for nested documents. I have a collection with products and the nested documents are offers. Doing this via a json request works fine:
{
"script" : "ctx._source.offer=offer",
"params" : {
"offer": {"price": 20}
}
}

However using the java API is not that trivial, i tried the example in:


but can't get it to work. There is a setScript() method but not a setScriptParameter() method.

So what i have now is:
UpdateRequestBuilder br = client.prepareUpdate(INDEXNAME, DOCUMENT_TYPE, PRODUCT_ID);
build a json string
br.setScript(new Script("ctx._source.offer = offer"));
but i can't add the json string anywhere and the documentation seems void of an example.

I use elasticsearch 2.0.0, java 8, windows 7

Hope someone has an idea on how to do this with the Java API.

Thanks,
Maarten