diff --git a/lib/job/arUpdatePublicationStatusJob.class.php b/lib/job/arUpdatePublicationStatusJob.class.php index f3f524b4cc..fc13012741 100644 --- a/lib/job/arUpdatePublicationStatusJob.class.php +++ b/lib/job/arUpdatePublicationStatusJob.class.php @@ -78,7 +78,7 @@ public function runJob($parameters) $queryScript = \Elastica\Script\AbstractScript::create([ 'script' => [ - 'inline' => 'ctx._source.publicationStatusId = '.$publicationStatus->id, + 'source' => 'ctx._source.publicationStatusId = '.$publicationStatus->id, 'lang' => 'painless', ], ]); diff --git a/lib/task/tools/updatePublicationStatusTask.class.php b/lib/task/tools/updatePublicationStatusTask.class.php index eee2a902eb..0c343826bc 100644 --- a/lib/task/tools/updatePublicationStatusTask.class.php +++ b/lib/task/tools/updatePublicationStatusTask.class.php @@ -166,7 +166,7 @@ protected function updatePublicationStatusDescendants($resource, $publicationSta $queryScript = \Elastica\Script\AbstractScript::create([ 'script' => [ - 'inline' => 'ctx._source.publicationStatusId = '.$publicationStatus->id, + 'source' => 'ctx._source.publicationStatusId = '.$publicationStatus->id, 'lang' => 'painless', ], ]); diff --git a/plugins/arElasticSearchPlugin/lib/arElasticSearchIndexDecorator.class.php b/plugins/arElasticSearchPlugin/lib/arElasticSearchIndexDecorator.class.php deleted file mode 100644 index 02a45ec56e..0000000000 --- a/plugins/arElasticSearchPlugin/lib/arElasticSearchIndexDecorator.class.php +++ /dev/null @@ -1,83 +0,0 @@ -. - */ - -use Elastica\Query; -use Elastica\Response; -use Elastica\Script\AbstractScript; -use Elasticsearch\Endpoints\UpdateByQuery; - -/** - * arElasticSearchIndexDecorator can be removed when Elastica >= 6.x. It is present to - * provide Elastica/Index::updateByQuery(). - * - * @author sbreker - */ -class arElasticSearchIndexDecorator -{ - protected $_instance; - - public function __construct(Elastica\Index $instance) - { - $this->_instance = $instance; - } - - public function __call($method, $args) - { - return call_user_func_array([$this->_instance, $method], $args); - } - - public function __get($key) - { - return $this->_instance->{$key}; - } - - public function __set($key, $val) - { - return $this->_instance->{$key} = $val; - } - - public function getInstance() - { - return $this->_instance; - } - - /** - * Update entries in the db based on a query. - * - * @param AbstractQuery|array|Collapse|Query|string|Suggest $query Query object or array - * @param AbstractScript $script Script - * @param array $options Optional params - * - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html - */ - public function updateByQuery($query, AbstractScript $script, array $options = []): Response - { - $endpoint = new UpdateByQuery(); - $q = Query::create($query)->getQuery(); - $body = [ - 'query' => \is_array($q) ? $q : $q->toArray(), - 'script' => $script->toArray()['script'], - ]; - - $endpoint->setBody($body); - $endpoint->setParams($options); - - return $this->requestEndpoint($endpoint); - } -} diff --git a/plugins/arElasticSearchPlugin/lib/arElasticSearchPlugin.class.php b/plugins/arElasticSearchPlugin/lib/arElasticSearchPlugin.class.php index 07e9179900..2b804c2203 100644 --- a/plugins/arElasticSearchPlugin/lib/arElasticSearchPlugin.class.php +++ b/plugins/arElasticSearchPlugin/lib/arElasticSearchPlugin.class.php @@ -92,7 +92,7 @@ public function __construct(array $options = []) // TODO: arElasticSearchIndexDecorator can be removed when Elastica >= 6.x. It is present to // provide Elastica/Index::updateByQuery(). - $this->index = new arElasticSearchIndexDecorator($this->client->getIndex($this->config['index']['name'])); + $this->index = $this->client->getIndex($this->config['index']['name']); // Load batch mode configuration $this->batchMode = true === $this->config['batch_mode'];