diff --git a/CopyIndexes.mkdn b/CopyIndexes.mkdn index 0e6df84..a41f712 100644 --- a/CopyIndexes.mkdn +++ b/CopyIndexes.mkdn @@ -4,7 +4,7 @@ es-copy-index.pl - Copy an index from one cluster to another # VERSION -version 7.9.2 +version 8.0 # SYNOPSIS diff --git a/Maintenance.mkdn b/Maintenance.mkdn index 1666bea..e520cfc 100644 --- a/Maintenance.mkdn +++ b/Maintenance.mkdn @@ -4,7 +4,7 @@ es-daily-index-maintenance.pl - Run to prune old indexes and optimize existing # VERSION -version 7.9.2 +version 8.0 # SYNOPSIS diff --git a/README.mkdn b/README.mkdn index 1c572bf..4cecf79 100644 --- a/README.mkdn +++ b/README.mkdn @@ -4,7 +4,7 @@ App::ElasticSearch::Utilities - Utilities for Monitoring ElasticSearch # VERSION -version 7.9.2 +version 8.0 # SYNOPSIS diff --git a/Searching.mkdn b/Searching.mkdn index dfa3a7a..145465b 100644 --- a/Searching.mkdn +++ b/Searching.mkdn @@ -4,7 +4,7 @@ es-search.pl - Provides a CLI for quick searches of data in ElasticSearch daily # VERSION -version 7.9.2 +version 8.0 # SYNOPSIS diff --git a/lib/App/ElasticSearch/Utilities.pm b/lib/App/ElasticSearch/Utilities.pm index af342a9..58e5fe7 100644 --- a/lib/App/ElasticSearch/Utilities.pm +++ b/lib/App/ElasticSearch/Utilities.pm @@ -513,13 +513,22 @@ sub _get_es_version { my $conn = es_connect(); my $resp = $conn->ua->get( sprintf "%s://%s:%d", $conn->proto, $conn->host, $conn->port ); if( $resp->is_success ) { + my $ver; eval { - $CURRENT_VERSION = join('.', (split /\./,$resp->content->{version}{number})[0,1]); + $ver = $resp->content->{version}; + }; + if( $ver ) { + if( $ver->{distribution} and $ver->{distribution} eq 'opensearch' ) { + $CURRENT_VERSION = '7.10'; + } + else { + $CURRENT_VERSION = join('.', (split /\./,$ver->{number})[0,1]); + } } }; if( !defined $CURRENT_VERSION || $CURRENT_VERSION <= 0 ) { output({color=>'red',stderr=>1}, sprintf "[%d] Unable to determine Elasticsearch version, something has gone terribly wrong: aborting.", $resp->code); - output({color=>'red',stderr=>1}, $resp->content) if $resp->content; + output({color=>'red',stderr=>1}, ref $resp->content ? YAML::Dump($resp->content) : $resp->content) if $resp->content; exit 1; } debug({color=>'magenta'}, "FOUND VERISON '$CURRENT_VERSION'");