use of org.elasticsearch.client.sniff.NodesSniffer in project hibernate-search by hibernate.
the class ElasticsearchClientFactoryImpl method createSniffer.
private Sniffer createSniffer(ConfigurationPropertySource propertySource, RestClient client, ServerUris hosts) {
boolean discoveryEnabled = DISCOVERY_ENABLED.get(propertySource);
if (discoveryEnabled) {
SnifferBuilder builder = Sniffer.builder(client).setSniffIntervalMillis(DISCOVERY_REFRESH_INTERVAL.get(propertySource) * // The configured value is in seconds
1_000);
// https discovery support
if (hosts.isSslEnabled()) {
NodesSniffer hostsSniffer = new ElasticsearchNodesSniffer(client, // 1sec
ElasticsearchNodesSniffer.DEFAULT_SNIFF_REQUEST_TIMEOUT, ElasticsearchNodesSniffer.Scheme.HTTPS);
builder.setNodesSniffer(hostsSniffer);
}
return builder.build();
} else {
return null;
}
}
Aggregations