use of org.elasticsearch.client.sniff.SnifferBuilder in project quarkus by quarkusio.
the class RestClientBuilderHelper method createSniffer.
public static Sniffer createSniffer(RestClient client, ElasticsearchConfig config) {
SnifferBuilder builder = Sniffer.builder(client).setSniffIntervalMillis((int) config.discovery.refreshInterval.toMillis());
// https discovery support
if ("https".equalsIgnoreCase(config.protocol)) {
NodesSniffer hostsSniffer = new ElasticsearchNodesSniffer(client, // 1sec
ElasticsearchNodesSniffer.DEFAULT_SNIFF_REQUEST_TIMEOUT, ElasticsearchNodesSniffer.Scheme.HTTPS);
builder.setNodesSniffer(hostsSniffer);
}
return builder.build();
}
use of org.elasticsearch.client.sniff.SnifferBuilder 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