Search in sources :

Example 1 with ElasticsearchNodesSniffer

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);
}
Also used : ElasticsearchNodesSniffer(org.graylog.shaded.elasticsearch7.org.elasticsearch.client.sniff.ElasticsearchNodesSniffer) NodesSniffer(org.graylog.shaded.elasticsearch7.org.elasticsearch.client.sniff.NodesSniffer) ElasticsearchNodesSniffer(org.graylog.shaded.elasticsearch7.org.elasticsearch.client.sniff.ElasticsearchNodesSniffer)

Aggregations

ElasticsearchNodesSniffer (org.graylog.shaded.elasticsearch7.org.elasticsearch.client.sniff.ElasticsearchNodesSniffer)1 NodesSniffer (org.graylog.shaded.elasticsearch7.org.elasticsearch.client.sniff.NodesSniffer)1