diff --git a/bin/check.pl b/bin/check.pl index 2e4fb82..e805fcd 100644 --- a/bin/check.pl +++ b/bin/check.pl @@ -42,13 +42,14 @@ fields => [ qw< name release author distribution version authorized indexed maturity date > ], - query => { match_all => {} }, - filter => { - and => [ - { term => { 'module.name' => $pkg } }, - { term => { authorized => 'true' } }, - { term => { maturity => 'released' } }, - ], + query => { + bool => { + must => [ + { term => { 'module.name' => $pkg } }, + { term => { authorized => 'true' } }, + { term => { maturity => 'released' } }, + ], + }, }, ); my @files = @{ $results->{hits}{hits} }; @@ -58,12 +59,13 @@ my $release_results = $es_release->search( size => 1, fields => [qw< name status authorized version id date >], - query => { match_all => {} }, - filter => { - and => [ - { term => { name => $file->{fields}{release} } }, - { term => { status => 'latest' } }, - ], + query => { + bool => { + must => [ + { term => { name => $file->{fields}{release} } }, + { term => { status => 'latest' } }, + ], + }, }, ); @@ -79,11 +81,12 @@ size => 1, fields => [qw< name status authorized version id date >], - query => { match_all => {} }, - filter => { - and => [ { - term => { name => $file->{fields}{release} } - } ] + query => { + bool => { + must => [ + { term => { name => $file->{fields}{release} } }, + ], + }, }, ); diff --git a/bin/latest.pl b/bin/latest.pl index 3368d95..d161a93 100644 --- a/bin/latest.pl +++ b/bin/latest.pl @@ -88,7 +88,7 @@ () # 'file' type records where the module.name matches the # distribution name and which are released & # indexed (the 'leading' module) - my $q_body = _body_filtered_query($filter); + my $q_body = _body_query($filter); my $scroll = $es->scroll( body => $q_body, @@ -219,31 +219,26 @@ ($filter) return \@module_filters; } -sub _body_filtered_query ($filter) { +sub _body_query ($filter) { return +{ query => { - filtered => { - query => { match_all => {} }, - filter => { - bool => { - must => [ - { - nested => { - path => 'module', - query => { bool => { must => $filter } } - } - }, - { term => { 'maturity' => 'released' } }, - ], - must_not => [ - { term => { status => 'backpan' } }, - { term => { distribution => 'perl' } } - ] - } - }, - }, - } - }; + bool => { + must => [ + { + nested => { + path => 'module', + query => { bool => { must => $filter } } + } + }, + { term => { 'maturity' => 'released' } }, + ], + must_not => [ + { term => { status => 'backpan' } }, + { term => { distribution => 'perl' } } + ] + } + }, + }, } sub _queue_latest ( $dist = $distribution ) { @@ -326,19 +321,14 @@ ( $bulk, $source, $status ) my $scroll = $es_file->scroll( body => { query => { - filtered => { - query => { match_all => {} }, - filter => { - bool => { - must => [ - { - term => - { 'release' => $source->{release} } - }, - { term => { 'author' => $source->{author} } }, - ], + bool => { + must => [ + { + term => + { 'release' => $source->{release} } }, - }, + { term => { 'author' => $source->{author} } }, + ], }, }, fields => [qw< name >], diff --git a/bin/release.pl b/bin/release.pl index c6173b9..4be1776 100644 --- a/bin/release.pl +++ b/bin/release.pl @@ -426,17 +426,18 @@ ($document) my $count = $es->search( search_type => 'count', body => { - query => { match_all => {} }, - filter => { - and => [ - { term => { distribution => $document->{distribution} } }, - { - range => { - version_numified => + query => { + bool => { + must => [ + { term => { distribution => $document->{distribution} } }, + { + range => { + version_numified => { 'lt' => $document->{version_numified} } + }, }, - } - ], + ], + }, }, }, )->{hits}{total}; diff --git a/bin/tickets.pl b/bin/tickets.pl index 48f1d3b..8542ba1 100644 --- a/bin/tickets.pl +++ b/bin/tickets.pl @@ -124,26 +124,30 @@ () my $scroll_release = $es_release->scroll( body => { query => { - and => [ - { term => { status => 'latest' } }, - { - or => [ - { - prefix => { - "resources.bugtracker.web" => - 'http://github.com/' - } + bool => { + must => [ + { term => { status => 'latest' } }, + { + bool => { + should => [ + { + prefix => { + "resources.bugtracker.web" => + 'http://github.com/' + }, + }, + { + prefix => { + "resources.bugtracker.web" => + 'https://github.com/' + }, + }, + ], }, - { - prefix => { - "resources.bugtracker.web" => - 'https://github.com/' - } - }, - ], - } - ], - } + }, + ], + }, + }, }, ); diff --git a/bin/watcher.pl b/bin/watcher.pl index 49628ac..14c023a 100644 --- a/bin/watcher.pl +++ b/bin/watcher.pl @@ -98,16 +98,13 @@ () fields => [qw< author archive >], body => { query => { - filtered => { - query => { match_all => {} }, - filter => { - not => { - filter => { term => { status => 'backpan' } } - } - } - } - } - } + bool => { + must_not => [ + { term => { status => 'backpan' } } + ], + }, + }, + }, ); my @changes; @@ -168,14 +165,15 @@ ($info) my $scroll_release = $es_release->scroll( scroll => '1m', body => { - query => { match_all => {} }, - filter => { - and => [ - { term => { author => $info->cpanid } }, - { term => { archive => $info->filename } }, - ] + query => { + bool => { + must => [ + { term => { author => $info->cpanid } }, + { term => { archive => $info->filename } }, + ], + }, }, - } + }, ); return $scroll_release->next; @@ -193,25 +191,22 @@ ($release) fields => [qw< _parent _source >], body => { query => { - filtered => { - query => { match_all => {} }, - filter => { - and => [ - { - term => { - release => $release->{_source}{name} - } - }, - { - term => { - author => $release->{_source}{author} - } - }, - ] - } - } - } - } + bool => { + must => [ + { + term => { + release => $release->{_source}{name} + } + }, + { + term => { + author => $release->{_source}{author} + } + }, + ], + }, + }, + }, } ); return if $dry_run;