Skip to content

Commit 893aa9b

Browse files
committed
backup: ES syntax update for newer version
1 parent a5d5abe commit 893aa9b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

bin/backup.pl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Try::Tiny qw< catch try >;
1313

1414
use MetaCPAN::ES;
15-
use MetaCPAN::Ingest qw< home >;
15+
use MetaCPAN::Ingest qw< home true >;
1616

1717
# config
1818

@@ -82,7 +82,7 @@ ()
8282
$bulk_store{$key} ||= $es->bulk( max_count => $batch_size );
8383
my $bulk = $bulk_store{$key};
8484

85-
my $parent = $raw->{fields}{_parent};
85+
my $parent = $raw->{_parent};
8686

8787
if ( $raw->{_type} eq 'author' ) {
8888

@@ -169,9 +169,12 @@ sub run_backup {
169169
( $type ? ( type => $type ) : () )
170170
);
171171
my $scroll = $es->scroll(
172-
size => $size,
173-
fields => [qw< _parent _source >],
174172
scroll => '1m',
173+
body => {
174+
_source => true,
175+
size => $size,
176+
sort => '_doc',
177+
},
175178
);
176179

177180
log_info { 'Backing up ', $scroll->total, ' documents' };

0 commit comments

Comments
 (0)