本文整理了Java中org.elasticsearch.client.RestHighLevelClient.info
方法的一些代码示例,展示了RestHighLevelClient.info
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RestHighLevelClient.info
方法的具体详情如下:
包路径:org.elasticsearch.client.RestHighLevelClient
类名称:RestHighLevelClient
方法名:info
[英]Get the cluster info otherwise provided when sending an HTTP request to '/'
[中]获取向“/”发送HTTP请求时提供的群集信息
代码示例来源:origin: dadoonet/fscrawler
@Override
public ESVersion getVersion() throws IOException {
Version version = client.info(RequestOptions.DEFAULT).getVersion();
return ESVersion.fromString(version.toString());
}
代码示例来源:origin: dadoonet/fscrawler
@Override
public ESVersion getVersion() throws IOException {
Version version = client.info().getVersion();
return ESVersion.fromString(version.toString());
}
代码示例来源:origin: dadoonet/fscrawler
@Override
public ESVersion getVersion() throws IOException {
Version version = client.info(RequestOptions.DEFAULT).getVersion();
return ESVersion.fromString(version.toString());
}
代码示例来源:origin: dadoonet/fscrawler
public void createIndices() throws Exception {
String elasticsearchVersion;
Path jobMappingDir = config.resolve(settings.getName()).resolve("_mappings");
// Let's read the current version of elasticsearch cluster
Version version = client.info(RequestOptions.DEFAULT).getVersion();
logger.debug("FS crawler connected to an elasticsearch [{}] node.", version.toString());
elasticsearchVersion = Byte.toString(version.major);
// If needed, we create the new settings for this files index
if (!settings.getFs().isAddAsInnerObject() || (!settings.getFs().isJsonSupport() && !settings.getFs().isXmlSupport())) {
createIndex(jobMappingDir, elasticsearchVersion, INDEX_SETTINGS_FILE, settings.getElasticsearch().getIndex());
} else {
createIndex(settings.getElasticsearch().getIndex(), true, null);
}
// If needed, we create the new settings for this folder index
if (settings.getFs().isIndexFolders()) {
createIndex(jobMappingDir, elasticsearchVersion, INDEX_SETTINGS_FOLDER_FILE, settings.getElasticsearch().getIndexFolder());
} else {
createIndex(settings.getElasticsearch().getIndexFolder(), true, null);
}
}
代码示例来源:origin: dadoonet/fscrawler
public void createIndices() throws Exception {
String elasticsearchVersion;
Path jobMappingDir = config.resolve(settings.getName()).resolve("_mappings");
// Let's read the current version of elasticsearch cluster
Version version = client.info().getVersion();
logger.debug("FS crawler connected to an elasticsearch [{}] node.", version.toString());
elasticsearchVersion = Byte.toString(version.major);
// If needed, we create the new settings for this files index
if (!settings.getFs().isAddAsInnerObject() || (!settings.getFs().isJsonSupport() && !settings.getFs().isXmlSupport())) {
createIndex(jobMappingDir, elasticsearchVersion, INDEX_SETTINGS_FILE, settings.getElasticsearch().getIndex());
} else {
createIndex(settings.getElasticsearch().getIndex(), true, null);
}
// If needed, we create the new settings for this folder index
if (settings.getFs().isIndexFolders()) {
createIndex(jobMappingDir, elasticsearchVersion, INDEX_SETTINGS_FOLDER_FILE, settings.getElasticsearch().getIndexFolder());
} else {
createIndex(settings.getElasticsearch().getIndexFolder(), true, null);
}
}
代码示例来源:origin: dadoonet/fscrawler
public void createIndices() throws Exception {
String elasticsearchVersion;
Path jobMappingDir = config.resolve(settings.getName()).resolve("_mappings");
// Let's read the current version of elasticsearch cluster
Version version = client.info(RequestOptions.DEFAULT).getVersion();
logger.debug("FS crawler connected to an elasticsearch [{}] node.", version.toString());
elasticsearchVersion = Byte.toString(version.major);
// If needed, we create the new settings for this files index
if (!settings.getFs().isAddAsInnerObject() || (!settings.getFs().isJsonSupport() && !settings.getFs().isXmlSupport())) {
createIndex(jobMappingDir, elasticsearchVersion, INDEX_SETTINGS_FILE, settings.getElasticsearch().getIndex());
} else {
createIndex(settings.getElasticsearch().getIndex(), true, null);
}
// If needed, we create the new settings for this folder index
if (settings.getFs().isIndexFolders()) {
createIndex(jobMappingDir, elasticsearchVersion, INDEX_SETTINGS_FOLDER_FILE, settings.getElasticsearch().getIndexFolder());
} else {
createIndex(settings.getElasticsearch().getIndexFolder(), true, null);
}
}
代码示例来源:origin: couchbase/couchbase-elasticsearch-connector
private static MainResponse getServerInfo(RestHighLevelClient esClient) {
try {
return esClient.info();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: fr.pilato.elasticsearch.crawler/fscrawler-elasticsearch-client-v5
@Override
public ESVersion getVersion() throws IOException {
Version version = client.info().getVersion();
return ESVersion.fromString(version.toString());
}
代码示例来源:origin: couchbase/couchbase-elasticsearch-connector
public static Version waitForElasticsearchAndRequireVersion(RestHighLevelClient esClient, Version required, Version recommended) throws InterruptedException {
final Iterator<TimeValue> retryDelays = truncatedExponentialBackoff(
TimeValue.timeValueSeconds(1), TimeValue.timeValueMinutes(1)).iterator();
while (true) {
try {
org.elasticsearch.Version esVersion = esClient.info().getVersion();
final Version version = new Version(esVersion.major, esVersion.minor, esVersion.revision);
if (version.compareTo(required) < 0) {
throw new RuntimeException("Elasticsearch version " + required + " or later required; actual version is " + version);
}
if (version.compareTo(recommended) < 0) {
LOGGER.warn("Elasticsearch version " + version + " is lower than recommended version " + recommended + ".");
}
return version;
} catch (Exception e) {
final TimeValue delay = retryDelays.next();
LOGGER.warn("Failed to connect to Elasticsearch. Retrying in {}", delay, e);
if (ThrowableHelper.hasCause(e, ConnectionClosedException.class)) {
LOGGER.warn(" Troubleshooting tip: If the Elasticsearch connection failure persists," +
" and if Elasticsearch is configured to require TLS/SSL, then make sure the connector is also configured to use secure connections.");
}
MILLISECONDS.sleep(delay.millis());
}
}
}
代码示例来源:origin: org.apache.camel/camel-elasticsearch-rest
message.setBody(restHighLevelClient.ping(RequestOptions.DEFAULT));
} else if (operation == ElasticsearchOperation.Info) {
message.setBody(restHighLevelClient.info(RequestOptions.DEFAULT));
} else {
throw new IllegalArgumentException(ElasticsearchConstants.PARAM_OPERATION + " value '" + operation + "' is not supported");
代码示例来源:origin: fr.pilato.elasticsearch.crawler/fscrawler-elasticsearch-client-v5
public void createIndices() throws Exception {
String elasticsearchVersion;
Path jobMappingDir = config.resolve(settings.getName()).resolve("_mappings");
// Let's read the current version of elasticsearch cluster
Version version = client.info().getVersion();
logger.debug("FS crawler connected to an elasticsearch [{}] node.", version.toString());
elasticsearchVersion = Byte.toString(version.major);
// If needed, we create the new settings for this files index
if (!settings.getFs().isAddAsInnerObject() || (!settings.getFs().isJsonSupport() && !settings.getFs().isXmlSupport())) {
createIndex(jobMappingDir, elasticsearchVersion, INDEX_SETTINGS_FILE, settings.getElasticsearch().getIndex());
} else {
createIndex(settings.getElasticsearch().getIndex(), true, null);
}
// If needed, we create the new settings for this folder index
if (settings.getFs().isIndexFolders()) {
createIndex(jobMappingDir, elasticsearchVersion, INDEX_SETTINGS_FOLDER_FILE, settings.getElasticsearch().getIndexFolder());
} else {
createIndex(settings.getElasticsearch().getIndexFolder(), true, null);
}
}
内容来源于网络,如有侵权,请联系作者删除!