How to set cluster in ES 6.0 using rest client


(Sunder Thangaraj) #1

Hi ,

  I have been using Transport client to set and using cluster for the past. I want to set cluster and minimum nodes in ES by using latest Rest client like how i used to create cluster with Transport client . Is there any way to do that ? .

(David Pilato) #2

No. And it does not make sense for the rest client.


(Sunder Thangaraj) #3

Okay . So How do i set cluster or create new cluster without using Transport client programmatically ? . My intention is that i dont want to use Transport client


(David Pilato) #4

A client is a client. It does not start a server if this is what you meant by "starting a new cluster". It just connects to a running cluster.


(Sunder Thangaraj) #5

agreed . I would like to achieve the below cluster settings feature by using rest client in elastic search 6.0 version (eg. setting cluster name and node) .this can be done using transport client. I understand that i can connect it by using rest client .but i want to update the cluster settings similar to what transport settings does or how can i do the cluster settings with latest rest client ?

  TransportClientFactoryBean factory = new TransportClientFactoryBean();
    factory.setClusterNodes("");
    factory.setClusterName(""); 

Thanks.


(David Pilato) #6
factory.setClusterName(""); 

Is not needed.

factory.setClusterNodes("");

It's well documented here I think: https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-low-usage-initialization.html


(Sunder Thangaraj) #7

okay . so how can I update the cluster name . is there any api available ? . There is one (/_cluster/settings). but that is also throwing exception as below . If its cant be , then how do I achieve this ? because in my existing application i use this transport factory to update cluster name when i am connecting it .

setting [cluster.name], not dynamically updateable" .

Thanks


(David Pilato) #8

I don't understand.

In the Transport Client, you can set the cluster name or you can ignore whatever cluster name the cluster has.

Everything is documented here: https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/transport-client.html

But to answer your question, you can not update live the cluster name of a running cluster. Cluster name is set in elasticsearch.yml file.


(system) #9

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