Bug 29234: Further clean Z3950 Tests
[srvgit] / misc / search_tools / rebuild_elasticsearch.pl
index 19839ff..337ac19 100755 (executable)
@@ -112,7 +112,7 @@ Full documentation.
 =cut
 
 use autodie;
-use Getopt::Long;
+use Getopt::Long qw( GetOptions );
 use Koha::Script;
 use C4::Context;
 use Koha::MetadataRecord::Authority;
@@ -120,10 +120,9 @@ use Koha::BiblioUtils;
 use Koha::SearchEngine::Elasticsearch;
 use Koha::SearchEngine::Elasticsearch::Indexer;
 use MARC::Field;
-use MARC::Record;
 use Modern::Perl;
-use Pod::Usage;
-use Try::Tiny;
+use Pod::Usage qw( pod2usage );
+use Try::Tiny qw( catch try );
 
 my $verbose = 0;
 my $commit = 5000;
@@ -309,10 +308,8 @@ sub _do_reindex {
                 _handle_response($response);
                 _log( 1, "Commit complete\n" );
             } catch {
-                if( ref $_ eq 'Koha::Exceptions::Elasticsearch::BadResponse'){
-                    _log(1,$_->{error});
-                    _log(2,$_->{details});
-                }
+                _log(1,"Elasticsearch exception thrown: ".$_->type."\n");
+                _log(2,"Details: ".$_->details."\n");
             };
             $commit_count  = $commit;
             @id_buffer     = ();