Skip to content

Commit c1b3528

Browse files
committed
avoid ESXM for raw scroll in latest script
ElasticSearchX::Model can interfere with queries using sort => _doc, making them much slower than they should be. There is no need for ESXM for raw results, so switch to using Search::Elasticsearch directly.
1 parent 6a50825 commit c1b3528

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/MetaCPAN/Script/Latest.pm

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,16 @@ sub run {
139139
'Searching for ' . @$filter . ' of ' . $total . ' modules'
140140
}
141141
if @module_filters > 1;
142-
my $scroll = $self->index->type('file')->query($query)->source( [ qw(
143-
author date distribution download_url module.name release status
144-
) ] )->size(100)->raw->scroll;
142+
my $scroll = $self->es->scroll_helper( {
143+
index => $self->index->name,
144+
type => 'file',
145+
size => 100,
146+
body => {
147+
_source => [
148+
qw(author date distribution download_url module.name release status)
149+
],
150+
},
151+
} );
145152

146153
$found_total += $scroll->total;
147154

0 commit comments

Comments
 (0)