Skip to content

Commit 97fee03

Browse files
committed
watcher: ES syntax update for newer version
1 parent 42fa500 commit 97fee03

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

bin/watcher.pl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use MetaCPAN::Ingest qw<
1515
cpan_dir
1616
read_recent_segment
17+
true
1718
>;
1819

1920
# args
@@ -93,9 +94,7 @@ ()
9394

9495
sub backpan_changes () {
9596
my $scroll_release = $es_release->scroll(
96-
size => 1000,
9797
scroll => '1m',
98-
fields => [qw< author archive >],
9998
body => {
10099
query => {
101100
bool => {
@@ -104,12 +103,14 @@ ()
104103
],
105104
},
106105
},
106+
size => 1000,
107+
_source => [qw< author archive >],
107108
},
108109
);
109110

110111
my @changes;
111112
while ( my $release = $scroll_release->next ) {
112-
my $data = $release->{fields};
113+
my $data = $release->{_source};
113114
my $path
114115
= $cpan->child( 'authors',
115116
MetaCPAN::Util::author_dir( $data->{author} ),
@@ -187,8 +188,6 @@ ($release)
187188

188189
my $scroll_file = $es_file->scroll( {
189190
scroll => '1m',
190-
size => 1000,
191-
fields => [qw< _parent _source >],
192191
body => {
193192
query => {
194193
bool => {
@@ -206,6 +205,9 @@ ($release)
206205
],
207206
},
208207
},
208+
size => 1000,
209+
_source => true,
210+
sort => '_doc',
209211
},
210212
} );
211213
return if $dry_run;
@@ -218,9 +220,6 @@ ($release)
218220
$bulk_file->index( {
219221
id => $row->{_id},
220222
source => {
221-
$row->{fields}{_parent}
222-
? ( parent => $row->{fields}{_parent} )
223-
: (),
224223
%$source,
225224
status => 'backpan',
226225
}
@@ -230,7 +229,8 @@ ($release)
230229
$bulk_release->index( {
231230
id => $release->{_id},
232231
source => {
233-
%{ $release->{_source} }, status => 'backpan',
232+
%{ $release->{_source} },
233+
status => 'backpan',
234234
}
235235
} );
236236

0 commit comments

Comments
 (0)