From f9bd821cf10c7ad88ae8d0ca71d9051bf5612eb6 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 8 Jul 2020 14:24:37 +0000 Subject: [PATCH] Bug 25955: Fix getting index_name To test: 1 - Have a site running ES 2 - perl misc/maintenance/compare_es_to_db.pl 3 - Lots of output, all bad 4 - Apply patch 5 - Repeate 6 - Whew, looks correct Signed-off-by: Didier Gautheron Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart (cherry picked from commit 005219ea6fc53a52a41169e96024244abb394ee1) Signed-off-by: Lucas Gass --- misc/maintenance/compare_es_to_db.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/maintenance/compare_es_to_db.pl b/misc/maintenance/compare_es_to_db.pl index 057ec30ae6..6eaea29799 100644 --- a/misc/maintenance/compare_es_to_db.pl +++ b/misc/maintenance/compare_es_to_db.pl @@ -46,14 +46,14 @@ foreach my $index ( ('biblios','authorities') ){ my $searcher = Koha::SearchEngine::Elasticsearch->new({ index => $index }); my $es = $searcher->get_elasticsearch(); - my $count = $es->indices->stats( index => $searcher->get_elasticsearch_params->{index_name} ) + my $count = $es->indices->stats( index => $searcher->index_name ) ->{_all}{primaries}{docs}{count}; print "Count in db for $index is " . scalar @db_records . ", count in Elasticsearch is $count\n"; # Now we get all the ids from Elasticsearch # The scroll lets us iterate through, it fetches chunks of 'size' as we move through my $scroll = $es->scroll_helper( - index => $searcher->get_elasticsearch_params->{index_name}, + index => $searcher->index_name, size => 5000, body => { query => { @@ -79,7 +79,7 @@ foreach my $index ( ('biblios','authorities') ){ # Fetch values for providing record links my $es_params = $searcher->get_elasticsearch_params; - my $es_base = "$es_params->{nodes}[0]/$es_params->{index_name}"; + my $es_base = "$es_params->{nodes}[0]/".$searcher->index_name; my $opac_base = C4::Context->preference('OPACBaseURL'); print "\nComparing arrays, this may take a while\n"; -- 2.39.5