jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/399374 )

Change subject: Fix metastore dump
......................................................................


Fix metastore dump

Change-Id: Icb5af4c9957bc17476cd779b091a610fa2682a5a
---
M maintenance/metastore.php
1 file changed, 20 insertions(+), 20 deletions(-)

Approvals:
  Smalyshev: Looks good to me, approved
  Cindy-the-browser-test-bot: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/maintenance/metastore.php b/maintenance/metastore.php
index ecee102..8b64d4a 100644
--- a/maintenance/metastore.php
+++ b/maintenance/metastore.php
@@ -4,7 +4,6 @@
 
 use CirrusSearch\SearchConfig;
 use Elastica\JSON;
-use MWElasticUtils;
 
 /**
  * Update and check the CirrusSearch metastore index.
@@ -140,25 +139,26 @@
                if ( !$index->exists() ) {
                        $this->fatalError( "Cannot dump metastore: index does 
not exists. Please run --upgrade first" );
                }
-               $scrollOptions = [
-                       'search_type' => 'query_then_fetch',
-                       'scroll' => "15m",
-                       'size' => 100
-               ];
-               $result = $index->search( new \Elastica\Query(), $scrollOptions 
);
-               MWElasticUtils::iterateOverScroll( $index, 
$result->getResponse()->getScrollId(), '15m',
-                       function ( $results ) {
-                               foreach ( $results as $result ) {
-                                       $indexOp = [
-                                               'index' => [
-                                                       '_type' => 
$result->getType(),
-                                                       '_id' => 
$result->getId(),
-                                               ]
-                                       ];
-                                       fwrite( STDOUT, JSON::stringify( 
$indexOp ) . "\n" );
-                                       fwrite( STDOUT, JSON::stringify( 
$result->getSource() ) . "\n" );
-                               }
-                       }, 0, 5 );
+
+               $query = new \Elastica\Query();
+               $query->setQuery( new \Elastica\Query\MatchAll() );
+               $query->setSize( 100 );
+               $query->setSource( true );
+               $query->setSort( [ '_doc' ] );
+               $search = $index->createSearch( $query );
+               $scroll = new \Elastica\Scroll( $search, '15m' );
+               foreach ( $scroll as $results ) {
+                       foreach ( $results as $result ) {
+                               $indexOp = [
+                                       'index' => [
+                                               '_type' => $result->getType(),
+                                               '_id' => $result->getId(),
+                                       ]
+                               ];
+                               fwrite( STDOUT, JSON::stringify( $indexOp ) . 
"\n" );
+                               fwrite( STDOUT, JSON::stringify( 
$result->getSource() ) . "\n" );
+                       }
+               }
        }
 }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/399374
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icb5af4c9957bc17476cd779b091a610fa2682a5a
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: DCausse <[email protected]>
Gerrit-Reviewer: Cindy-the-browser-test-bot <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Gehel <[email protected]>
Gerrit-Reviewer: Smalyshev <[email protected]>
Gerrit-Reviewer: Tjones <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to