public function updateByQuery($query, AbstractScript $script, array $options = [])
    {
        $query = Query::create($query)->getQuery();

        $endpoint = new UpdateByQuery();
        $body = ['query' => \is_array($query)
            ? $query
            : $query->toArray(), ];

        $body['script'] = $script->toArray()['script'];
        $endpoint->setBody($body);
        $endpoint->setParams($options);

        return $this->requestEndpoint($endpoint);
    }