// docs/update-by-query.asciidoc:537

[source, php]
----
$params = [
    'index' => 'twitter',
    'body' => [
        'slice' => [
            'id' => 0,
            'max' => 2,
        ],
        'script' => [
            'source' => 'ctx._source[\'extra\'] = \'test\'',
        ],
    ],
];
$response = $client->updateByQuery($params);
$params = [
    'index' => 'twitter',
    'body' => [
        'slice' => [
            'id' => 1,
            'max' => 2,
        ],
        'script' => [
            'source' => 'ctx._source[\'extra\'] = \'test\'',
        ],
    ],
];
$response = $client->updateByQuery($params);
----
