use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.sniff.ElasticsearchNodesSniffer in project graylog2-server by Graylog2.
the class FilteredElasticsearchNodesSniffer method create.
static FilteredElasticsearchNodesSniffer create(RestClient restClient, long sniffRequestTimeoutMillis, ElasticsearchNodesSniffer.Scheme scheme, String filter) {
final String attribute;
final String value;
if (!Strings.isNullOrEmpty(filter)) {
final String[] conditions = filter.split(":");
if (conditions.length < 2) {
throw new IllegalArgumentException("Invalid filter specified for ES node discovery: " + filter);
}
attribute = conditions[0].trim();
value = conditions[1].trim();
} else {
attribute = null;
value = null;
}
final NodesSniffer nodesSniffer = new ElasticsearchNodesSniffer(restClient, sniffRequestTimeoutMillis, scheme);
return new FilteredElasticsearchNodesSniffer(nodesSniffer, attribute, value);
}
Aggregations