elasticsearch create TransportConnection timeout

2019-07-05 13:05发布

问题:

I am creating a Elasticsearch Connection with Java API. I am using TransportConnection and I need to set the timeout for the connection.

I haven't configured any property and the connect takes three minutes to give me a timeout.

Anybody know if any property exists to set the value of timeout?

Thaks.

回答1:

Settings settings = ImmutableSettings.settingsBuilder()
            .put("cluster.name", cluster_name).put("client.transport.ping_timeout", "30s").build();

    TransportClient transport = new TransportClient(settings);

See also the following from ES documentation page:

Fault Detection