Page MenuHomePhabricator

PHP fatal error while searching index: Declaration of Elasticsearch\Endpoints\Indices\Exists::getParamWhitelist() must be compatible with Elasticsearch\Endpoints\AbstractEndpoint::getParamWhitelist():
Open, MediumPublic

Description

While performing this command: php extensions/CirrusSearch/maintenance/updateSearchIndexConfig.php
The following error pops out:
PHP Fatal error: Declaration of Elasticsearch\Endpoints\Indices\Exists::getParamWhitelist() must be compatible with Elasticsearch\Endpoints\AbstractEndpoint::getParamWhitelist(): array in /var/www/html/mwtest/extensions/Elastica/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Exists.php on line 60

Observed on:
Mediawiki 1.31.10
Elasticsearch 5.6.16
Ubuntu 18
PhP 7.2.24

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Gehel triaged this task as High priority.Nov 9 2020, 4:37 PM
Gehel moved this task from needs triage to Current work on the Discovery-Search board.
Gehel edited projects, added Discovery-Search (Current work); removed Discovery-Search.

This loks like a version incomplatability between the high level elasticsearch client (ruflin/elastica) and the elasticsearch-php low level client. I would verify composer installed appropriate versions of each.

Gehel claimed this task.
Gehel subscribed.

Without more information, there isn't much to do / investigate on our side. Feel free to re-open if you need more help to fix the issue!

Svrl reopened this task as Open.EditedNov 17 2020, 6:18 PM

Sorry for innactivity.
When I looked to Mediawiki installations the versions it shown these: for the Elastica: 1.3.0.0 (cfec7fc) 24. 7. 2020, 19:21, and for the CirrusSearch: 0.2 (ad9a0d9) 17. 4. 2018, 20:24, which are versions downloaded for Mediawiki 1.3.1.
And the version by the composer.json:
"ruflin/elastica": "5.3.6",
And thank you for the tip about version mismatch of composer validation.

CBogen lowered the priority of this task from High to Medium.Nov 23 2020, 6:19 PM
CBogen moved this task from needs triage to making others happy on the Discovery-Search board.

This error might occur on 1.35, see T276854 for more details

I reproduce this on REL1_35 - latest version of the Elastica extension, with a fresh composer update :

root@fba5a3abd51b:/var/www/html/extensions/Elastica# php /var/www/html/extensions/CirrusSearch/maintenance/UpdateSearchIndexConfig.php
indexing namespaces...
[22-Oct-2021 16:39:55 UTC] PHP Fatal error: Declaration of Elasticsearch\Endpoints\Indices\Exists::getParamWhitelist() must be compatible with Elasticsearch\Endpoints\AbstractEndpoint::getParamWhitelist(): array in /var/www/html/extensions/Elastica/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Exists.php on line 62
root@fba5a3abd51b:/var/www/html/extensions/Elastica#

Here are the versions I have on the setup:

Elastica 6.1.3 (545651c) 8/10/2021 à 18:06
elasticsearch/elasticsearch 6.8.2
ruflin/elastica 6.2.0

Is there a known working version set for MW 1.35 ?

I'd be happy to help debugging this if needed.

I had it working with REL1_35 using elasticsearch/elasticsaerch 6.7.*. Semantic MediaWiki wanted 6.8 but seemed to work fine when I specified the 6.7 limit in my composer.local.json. I didn't restrict elastica but it installed 6.1 (currently on 6.1.3 with REL1_36).

[22-Oct-2021 16:39:55 UTC] PHP Fatal error: Declaration of Elasticsearch\Endpoints\Indices\Exists::getParamWhitelist() must be compatible with Elasticsearch\Endpoints\AbstractEndpoint::getParamWhitelist(): array in /var/www/html/extensions/Elastica/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Exists.php on line 62

https://github.com/elastic/elasticsearch-php/blob/6.8.x/src/Elasticsearch/Endpoints/AbstractEndpoint.php#L60
https://github.com/elastic/elasticsearch-php/blob/6.8.x/src/Elasticsearch/Endpoints/Indices/Exists.php#L44

https://github.com/elastic/elasticsearch-php/blob/v6.8.2/src/Elasticsearch/Endpoints/AbstractEndpoint.php#L60
https://github.com/elastic/elasticsearch-php/blob/v6.8.2/src/Elasticsearch/Endpoints/Indices/Exists.php#L44

In the 6.8.x branch and the 6.8.2 release, the lines both are compatible...

In fact, on https://github.com/elastic/elasticsearch-php/blob/6.8.x/src/Elasticsearch/Endpoints/Indices/Exists.php there is no line 62....

Something doesn't look quite right with whatever you have on disk.

Hello @Reedy - I was not complete enough in my description - elasticsearch-php was indeed on 6.7.2. It's elasticsearch/elasticsearch that was on 6.8.2 - which apparently is not compatible.

@Justin_C_Lloyd was correct - adding elasticsearch/elasticsearch:6.7.x in composer.local.json fixes the problem. Apparently SMW requires a version that is a bit too recent. I've opened a bug on their side ! https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/5114

For info, it is fixed on the master branch of SemanticMediawiki (dev-master on packagist).

Gehel removed Gehel as the assignee of this task.Mar 2 2023, 8:05 AM