Bug 25955: Fix getting index_name
authorNick Clemens <nick@bywatersolutions.com>
Wed, 8 Jul 2020 14:24:37 +0000 (14:24 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 22 Jul 2020 08:17:53 +0000 (10:17 +0200)
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 <didier.gautheron@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

misc/maintenance/compare_es_to_db.pl

index 057ec30..6eaea29 100644 (file)
@@ -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";