Set cluster name when creating connection | ES 8.2.3

How to set cluster name in new ES 8.2.3 java API ?

Earlier I was using:

private Client client = new PreBuiltTransportClient(Settings.builder().put("cluster.name", esClusterName).build()).addTransportAddress(new TransportAddress(InetAddress.getByName(elasticIp), elasticPort));

How it can be done now?
Till now reached:

    // Create the low-level client
    RestClient restClient = RestClient.builder(new HttpHost(elasticIp, elasticPort, "https")).build();

    // Create the transport with a Jackson mapper
    ElasticsearchTransport transport = new RestClientTransport(restClient, new JacksonJsonpMapper());

    // And create the API client
    client = new ElasticsearchClient(transport);

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.