From c1b35280642fa11f6af4df53e9f86b77a472a68d Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Tue, 1 Oct 2024 12:16:22 +0200 Subject: [PATCH] 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. --- lib/MetaCPAN/Script/Latest.pm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/MetaCPAN/Script/Latest.pm b/lib/MetaCPAN/Script/Latest.pm index 73b78154a..5d7048766 100644 --- a/lib/MetaCPAN/Script/Latest.pm +++ b/lib/MetaCPAN/Script/Latest.pm @@ -139,9 +139,16 @@ sub run { 'Searching for ' . @$filter . ' of ' . $total . ' modules' } if @module_filters > 1; - my $scroll = $self->index->type('file')->query($query)->source( [ qw( - author date distribution download_url module.name release status - ) ] )->size(100)->raw->scroll; + my $scroll = $self->es->scroll_helper( { + index => $self->index->name, + type => 'file', + size => 100, + body => { + _source => [ + qw(author date distribution download_url module.name release status) + ], + }, + } ); $found_total += $scroll->total;