(self)
return version
Get the running version of elasticsearch.
Get the running version of elasticsearch.
Get the running version of elasticsearch .
def _get_es_version(self):
        """
        Get the running version of elasticsearch.
        """
        try:
            data = self._get_data(self._config.url, send_sc=False)
            raw_version = data['version']['number']

            self.set_metadata('version', raw_version)
            # pre-release versions of elasticearch are suffixed with -rcX etc..
            # peel that off so that the map below doesn't error out
            raw_version = raw_version.split('-')[0]
            version = [int(p) for p in raw_version.split('.')[0:3]]
            if data['version'].get('distribution', '') == 'opensearch':
                # Opensearch API is backwards compatible with ES 7.10.0
                # https://opensearch.org/faq
                self.log.debug('OpenSearch version %s detected', version)
                version = [7, 10, 0]
        except AuthenticationError:
            raise
        except Exception as e:
            self.warning("Error while trying to get Elasticsearch version from %s %s", self._config.url, e)
            version = [1, 0, 0]

        self.log.debug("Elasticsearch version is %s", version)
        return version
def _get_es_version ( self ) : try : data = self . _get_data ( self . _config . url , send_sc = False ) raw_version = data [ 'version' ] [ 'number' ] self . set_metadata ( 'version' , raw_version ) # pre-release versions of elasticearch are suffixed with -rcX etc.. # peel that off so that the map below doesn't error out raw_version = raw_version . split ( '-' ) [ 0 ] version = [ int ( p ) for p in raw_version . split ( '.' ) [ 0 : 3 ] ] if data [ 'version' ] . get ( 'distribution' , '' ) == 'opensearch' : # Opensearch API is backwards compatible with ES 7.10.0 # https://opensearch.org/faq self . log . debug ( 'OpenSearch version %s detected' , version ) version = [ 7 , 10 , 0 ] except AuthenticationError : raise except Exception as e : self . warning ( "Error while trying to get Elasticsearch version from %s %s" , self . _config . url , e ) version = [ 1 , 0 , 0 ] self . log . debug ( "Elasticsearch version is %s" , version ) return version