DCausse has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/333275 )
Change subject: Fix alias creation for the metastore index ...................................................................... Fix alias creation for the metastore index Some endpoints have changed, it causes issues to create the metastore. Change-Id: I3abced22ce24bd4bca9f24d614219630b844ea76 --- M includes/Maintenance/MetaStoreIndex.php M includes/Maintenance/Validators/IndexAllAliasValidator.php 2 files changed, 9 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch refs/changes/75/333275/1 diff --git a/includes/Maintenance/MetaStoreIndex.php b/includes/Maintenance/MetaStoreIndex.php index d39a469..689c7e8 100644 --- a/includes/Maintenance/MetaStoreIndex.php +++ b/includes/Maintenance/MetaStoreIndex.php @@ -303,7 +303,14 @@ * alias or null if the alias does not exist */ private function getAliasedIndexName() { - $resp = $this->client->request( '_aliases/' . self::INDEX_NAME, \Elastica\Request::GET, [] ); + // FIXME: Elastica seems to have trouble parsing the error reason + // for this endpoint. Running a simple HEAD first to check if it + // exists + $resp = $this->client->request( '_alias/' . self::INDEX_NAME, \Elastica\Request::HEAD, [] ); + if ( $resp->getStatus() === 404 ) { + return null; + } + $resp = $this->client->request( '_alias/' . self::INDEX_NAME, \Elastica\Request::GET, [] ); $indexName = null; foreach( $resp->getData() as $index => $aliases ) { if ( isset( $aliases['aliases'][self::INDEX_NAME] ) ) { diff --git a/includes/Maintenance/Validators/IndexAllAliasValidator.php b/includes/Maintenance/Validators/IndexAllAliasValidator.php index dd59b94..8c2fd44 100644 --- a/includes/Maintenance/Validators/IndexAllAliasValidator.php +++ b/includes/Maintenance/Validators/IndexAllAliasValidator.php @@ -39,7 +39,7 @@ // build the request to Elasticsearch ourselves. foreach ( $add as $indexName ) { - $data['action'][] = [ 'add' => [ 'index' => $indexName, 'alias' => $this->aliasName ] ]; + $data['actions'][] = [ 'add' => [ 'index' => $indexName, 'alias' => $this->aliasName ] ]; } foreach ( $remove as $indexName ) { -- To view, visit https://gerrit.wikimedia.org/r/333275 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3abced22ce24bd4bca9f24d614219630b844ea76 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CirrusSearch Gerrit-Branch: es5 Gerrit-Owner: DCausse <dcau...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits