Skip to content

Commit 4c082b0

Browse files
committed
latest: ES syntax update for newer versions
1 parent a47c72e commit 4c082b0

File tree

1 file changed

+26
-36
lines changed

1 file changed

+26
-36
lines changed

bin/latest.pl

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ ()
8888
# 'file' type records where the module.name matches the
8989
# distribution name and which are released &
9090
# indexed (the 'leading' module)
91-
my $q_body = _body_filtered_query($filter);
91+
my $q_body = _body_query($filter);
9292

9393
my $scroll = $es->scroll(
9494
body => $q_body,
@@ -219,31 +219,26 @@ ($filter)
219219
return \@module_filters;
220220
}
221221

222-
sub _body_filtered_query ($filter) {
222+
sub _body_query ($filter) {
223223
return +{
224224
query => {
225-
filtered => {
226-
query => { match_all => {} },
227-
filter => {
228-
bool => {
229-
must => [
230-
{
231-
nested => {
232-
path => 'module',
233-
query => { bool => { must => $filter } }
234-
}
235-
},
236-
{ term => { 'maturity' => 'released' } },
237-
],
238-
must_not => [
239-
{ term => { status => 'backpan' } },
240-
{ term => { distribution => 'perl' } }
241-
]
242-
}
243-
},
244-
},
245-
}
246-
};
225+
bool => {
226+
must => [
227+
{
228+
nested => {
229+
path => 'module',
230+
query => { bool => { must => $filter } }
231+
}
232+
},
233+
{ term => { 'maturity' => 'released' } },
234+
],
235+
must_not => [
236+
{ term => { status => 'backpan' } },
237+
{ term => { distribution => 'perl' } }
238+
]
239+
}
240+
},
241+
},
247242
}
248243

249244
sub _queue_latest ( $dist = $distribution ) {
@@ -326,19 +321,14 @@ ( $bulk, $source, $status )
326321
my $scroll = $es_file->scroll(
327322
body => {
328323
query => {
329-
filtered => {
330-
query => { match_all => {} },
331-
filter => {
332-
bool => {
333-
must => [
334-
{
335-
term =>
336-
{ 'release' => $source->{release} }
337-
},
338-
{ term => { 'author' => $source->{author} } },
339-
],
324+
bool => {
325+
must => [
326+
{
327+
term =>
328+
{ 'release' => $source->{release} }
340329
},
341-
},
330+
{ term => { 'author' => $source->{author} } },
331+
],
342332
},
343333
},
344334
fields => [qw< name >],

0 commit comments

Comments
 (0)