Elastica: ruflin/elastica 6.x is not compatible with elasticsearch/elasticsearch-php 6.8.0
Downstream task: https://phabricator.wikimedia.org/T276320
6.x of ruflin/elastica as per https://github.com/ruflin/Elastica/blob/6.x/composer.json#L17 supports "elasticsearch/elasticsearch": "^6.0"
However, trying to use 6.x of ruflin/elastica with 6.8 of elasticsearch/elasticsearch causes errors due to https://github.com/ruflin/Elastica/blob/6.x/lib/Elastica/Index.php#L451
[3e8bfb9228c410ca976223cf] [no req] Error from line 451 of /var/www/html/vendor/ruflin/elastica/lib/Elastica/Index.php: Class 'Elasticsearch\Endpoints\Indices\Aliases\Update' not found
Backtrace:
#0 /var/www/html/extensions/CirrusSearch/includes/Maintenance/Validators/SpecificAliasValidator.php(137): Elastica\Index->addAlias(string, boolean)
#1 /var/www/html/extensions/CirrusSearch/includes/Maintenance/Validators/SpecificAliasValidator.php(79): CirrusSearch\Maintenance\Validators\SpecificAliasValidator->updateFreeIndices(array)
#2 /var/www/html/extensions/CirrusSearch/includes/Maintenance/Validators/IndexAliasValidator.php(98): CirrusSearch\Maintenance\Validators\SpecificAliasValidator->updateIndices(array, array)
#3 /var/www/html/extensions/CirrusSearch/maintenance/UpdateOneSearchIndexConfig.php(458): CirrusSearch\Maintenance\Validators\IndexAliasValidator->validate()
#4 /var/www/html/extensions/CirrusSearch/maintenance/UpdateOneSearchIndexConfig.php(411): CirrusSearch\Maintenance\UpdateOneSearchIndexConfig->validateSpecificAlias()
#5 /var/www/html/extensions/CirrusSearch/maintenance/UpdateOneSearchIndexConfig.php(269): CirrusSearch\Maintenance\UpdateOneSearchIndexConfig->validateAlias()
#6 /var/www/html/extensions/CirrusSearch/maintenance/UpdateSearchIndexConfig.php(61): CirrusSearch\Maintenance\UpdateOneSearchIndexConfig->execute()
#7 /var/www/html/maintenance/doMaintenance.php(107): CirrusSearch\Maintenance\UpdateSearchIndexConfig->execute()
#8 /var/www/html/extensions/CirrusSearch/maintenance/UpdateSearchIndexConfig.php(70): require_once(string)
#9 {main}
If we look at https://github.com/elastic/elasticsearch-php/blob/6.7.x/src/Elasticsearch/Endpoints/Indices/Aliases/Update.php it still exists in 6.7, but in https://github.com/elastic/elasticsearch-php/blob/6.8.x/src/Elasticsearch/Endpoints/Indices/Aliases/Update.php it does not.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (8 by maintainers)
Commits related to this issue
- Added code generator + updated endpoints with ES 6.8.14 — committed to elastic/elasticsearch-php by ezimuel 3 years ago
- Explicitly set elasticsearch/elasticsearch dependency elasticsearch/elasticsearch 6.8.0 was released missing some class aliases, so currently breaks expected semver compatibility. Therefore explicit... — committed to wikimedia/mediawiki-extensions-Elastica by toban 3 years ago
- Update git submodules * Update Elastica from branch 'REL1_35' to c101a4c17fff7e8711b0199cc9f7c342699e1221 - Explicitly set elasticsearch/elasticsearch dependency elasticsearch/elasticsea... — committed to wikimedia/mediawiki-extensions by toban 3 years ago
- Explicitly set elasticsearch/elasticsearch dependency elasticsearch/elasticsearch 6.8.0 was released missing some class aliases, so currently breaks expected semver compatibility. Therefore explicit... — committed to wikimedia/mediawiki-extensions-Elastica by toban 3 years ago
- Update git submodules * Update Elastica from branch 'master' to f86b3eb3bbf06b12262be75fce23c876bfbb211e - Explicitly set elasticsearch/elasticsearch dependency elasticsearch/elasticsear... — committed to wikimedia/mediawiki-extensions by toban 3 years ago
I just sent this PR to fix the issue https://github.com/elastic/elasticsearch-php/pull/1114.
@ruflin I released
elasticsearch-php 6.8.0including the support of PHP 8 and all the XPack endpoints. In order to accomplish this I used the new code generator used in7.xbranch.elasticsarch-php<6.8contained some endpoints that do not exist in Elasticsearch 6. Moreover, the naming were not aligned with the API specification.To resolve these issues, I used an alias approach with
src/autoload.phpto prevent BC breaks. Evidently, some alias was missed.Here a list of issues provided by @reedy (https://github.com/elastic/elasticsearch-php/commit/2da5f9337a269113954a84fe8e79ea6843f0e7c3#commitcomment-47975845):
src/Elasticsearch/Endpoints/Cluster/Nodes/AbstractNodesEndpoint.phpThis class has been removed since the new code generator did not use it.src/Elasticsearch/Endpoints/CountPercolate.phpThis endpoint does not exist in Elasticsearch 6. It was present in the PHP client <= 6.7 but it was a typo. This happened because the endpoints was manually maintained in the 6.x branch.src/Elasticsearch/Endpoints/Indices/Aliases/Update.phpThis is a missing alias.src/Elasticsearch/Endpoints/Indices/Exists/Types.phpThis is a missing alias. Actually, there is an alias ‘\Elasticsearch\Endpoints\Indices\Type\Exists’.src/Elasticsearch/Endpoints/Indices/Field/Get.phpThis is a missing alias. The Elaticsearch 6 endpoint is namedindices.get_field_mappingso the endpoint in 6.8.0 issrc/Elasticsearch/Endpoints/Indices/GetFieldMapping.php.src/Elasticsearch/Endpoints/Indices/Mapping/Delete.phpThis endpoint does not exist in Elasticsearch 6. It was present in the PHP client <= 6.7 but it was a typo. This happened because the endpoints was manually maintained in the 6.x branch.src/Elasticsearch/Endpoints/Indices/Mapping/Put.phpThis endpoint is already insrc/autoload.php.src/Elasticsearch/Endpoints/MPercolate.phpThis endpoint does not exist in Elasticsearch 6. It was present in the PHP client <= 6.7 but it was a typo. This happened because the endpoints was manually maintained in the 6.x branch.src/Elasticsearch/Endpoints/Percolate.phpThis endpoint does not exist in Elasticsearch 6. It was present in the PHP client <= 6.7 but it was a typo. This happened because the endpoints was manually maintained in the 6.x branch.To summarize, the missing aliases are:
Elasticsearch\Endpoints\Indices\Aliases\UpdateElasticsearch\Endpoints\Indices\Exists\TypesElasticsearch\Endpoints\Indices\Field\GetI can fix this and release
6.8.1soon. Let me know if there are other issues that I didn’t count. Thanks!