DCausse has uploaded a new change for review. (
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(+), 19 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch
refs/changes/74/399374/1
diff --git a/maintenance/metastore.php b/maintenance/metastore.php
index ecee102..3b0293d 100644
--- a/maintenance/metastore.php
+++ b/maintenance/metastore.php
@@ -140,25 +140,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: newchange
Gerrit-Change-Id: Icb5af4c9957bc17476cd779b091a610fa2682a5a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: DCausse <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits