remote_transport_exception:使用脚本部分更新elasticsearch文档时

I am partially updating the document using the following structure

$params = [
                'index' => self::$currentIndex[self::INDEX_TYPE_SEARCH],
                'type'  => self::TYPE_PRODUCT,
                'id'    => $product_id,
                'body'  => [
                    'script' => 'ctx._source.coupons += coupon',
                    'params' => ['coupon' => array($product_body)],
                ]
            ];

However I am getting the following error:

remote_transport_exception: [Gee][127.0.0.1:9300][indices:data/write/update[s]]

Any idea if the structure is incorrect?

If you wan't to add values to an array than you can do this,

$params['id'] = $product_id;
$params['body'] = array(
            'script' => array(
                "inline" => "ctx._source.coupons.add(params.coupon)",
                "lang" => "painless",
                "params" => ['coupon' => array($product_body)]
            )
        );

This thould work as it worked for me.