public static EsMajorVersion discoverEsVersion(Settings settings, Log log) { String version = settings.getProperty(InternalConfigurationOptions.INTERNAL_ES_VERSION); if (StringUtils.hasText(version)) { if (log.isDebugEnabled()) { log.debug(String.format("Elasticsearch version [%s] already present in configuration; skipping discovery", version)); } return EsMajorVersion.parse(version); } RestClient bootstrap = new RestClient(settings); // first get ES version try { EsMajorVersion esVersion = bootstrap.remoteEsVersion(); if (log.isDebugEnabled()) { log.debug(String.format("Discovered Elasticsearch version [%s]", esVersion)); } settings.setInternalVersion(esVersion); return esVersion; } catch (EsHadoopException ex) { throw new EsHadoopIllegalArgumentException(String.format("Cannot detect ES version - " + "typically this happens if the network/Elasticsearch cluster is not accessible or when targeting " + "a WAN/Cloud instance without the proper setting '%s'", ConfigurationOptions.ES_NODES_WAN_ONLY), ex); } finally { bootstrap.close(); } }
public static EsMajorVersion getEsVersion() { return new RestClient(new TestSettings()).remoteEsVersion(); }
public static EsMajorVersion discoverEsVersion(Settings settings, Log log) { String version = settings.getProperty(InternalConfigurationOptions.INTERNAL_ES_VERSION); if (StringUtils.hasText(version)) { if (log.isDebugEnabled()) { log.debug(String.format("Elasticsearch version [%s] already present in configuration; skipping discovery", version)); } return EsMajorVersion.parse(version); } RestClient bootstrap = new RestClient(settings); // first get ES version try { EsMajorVersion esVersion = bootstrap.remoteEsVersion(); if (log.isDebugEnabled()) { log.debug(String.format("Discovered Elasticsearch version [%s]", esVersion)); } settings.setInternalVersion(esVersion); return esVersion; } catch (EsHadoopException ex) { throw new EsHadoopIllegalArgumentException(String.format("Cannot detect ES version - " + "typically this happens if the network/Elasticsearch cluster is not accessible or when targeting " + "a WAN/Cloud instance without the proper setting '%s'", ConfigurationOptions.ES_NODES_WAN_ONLY), ex); } finally { bootstrap.close(); } }
public static EsMajorVersion discoverEsVersion(Settings settings, Log log) { String version = settings.getProperty(InternalConfigurationOptions.INTERNAL_ES_VERSION); if (StringUtils.hasText(version)) { if (log.isDebugEnabled()) { log.debug(String.format("Elasticsearch version [%s] already present in configuration; skipping discovery", version)); } return EsMajorVersion.parse(version); } RestClient bootstrap = new RestClient(settings); // first get ES version try { EsMajorVersion esVersion = bootstrap.remoteEsVersion(); if (log.isDebugEnabled()) { log.debug(String.format("Discovered Elasticsearch version [%s]", esVersion)); } settings.setInternalVersion(esVersion); return esVersion; } catch (EsHadoopException ex) { throw new EsHadoopIllegalArgumentException(String.format("Cannot detect ES version - " + "typically this happens if the network/Elasticsearch cluster is not accessible or when targeting " + "a WAN/Cloud instance without the proper setting '%s'", ConfigurationOptions.ES_NODES_WAN_ONLY), ex); } finally { bootstrap.close(); } }
public static EsMajorVersion discoverEsVersion(Settings settings, Log log) { String version = settings.getProperty(InternalConfigurationOptions.INTERNAL_ES_VERSION); if (StringUtils.hasText(version)) { if (log.isDebugEnabled()) { log.debug(String.format("Elasticsearch version [%s] already present in configuration; skipping discovery", version)); } return EsMajorVersion.parse(version); } RestClient bootstrap = new RestClient(settings); // first get ES version try { EsMajorVersion esVersion = bootstrap.remoteEsVersion(); if (log.isDebugEnabled()) { log.debug(String.format("Discovered Elasticsearch version [%s]", esVersion)); } settings.setInternalVersion(esVersion); return esVersion; } catch (EsHadoopException ex) { throw new EsHadoopIllegalArgumentException(String.format("Cannot detect ES version - " + "typically this happens if the network/Elasticsearch cluster is not accessible or when targeting " + "a WAN/Cloud instance without the proper setting '%s'", ConfigurationOptions.ES_NODES_WAN_ONLY), ex); } finally { bootstrap.close(); } }