Question about node sniffing in the Java Client

The documentation at https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/transport-client.html just briefly mentions the option to make the Client find other nodes automatically via the option "client.transport.sniff".

I am not sure about a few things

  • Is this node-discovery only done upon initial connection or periodically, i.e. does it find newly added nodes as well?
  • From some discussion on Elasticsearch 1.1.x it was mentioned that you still would configure multiple nodes manually to have enough nodes for discovery, because sniffed nodes are not used for further discovery of nodes, is this still the case?
  • Any other known downsides of using sniffing (besides problems with inaccessible publish/bind-addresses like Amazon EC2 instances accessed from the outside)?

Thanks... Dominik.

  • it's periodically, it finds newly added nodes
  • sniffed nodes are added like the nodes that are added from the start. But you have to configure multiple nodes manually in the case you want failover from the beginning, because a single node to connect does not suffice, it may be no longer be up
  • failures in sniff mode are prone to unbounded connection retries, and I assume that can produce many stale threads and sockets, if the network connection is not healthy

Thanks for the thorough and quick reply, so we'll need to test some more if it works well in our environment!

Adding to @jprante's answer that by default sampling is done every 5 seconds.

See https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/transport-client.html and client.transport.nodes_sampler_interval setting.