# How to set cluster in ES 6.0 using rest client

**URL:** <https://discuss.elastic.co/t/how-to-set-cluster-in-es-6-0-using-rest-client/113440>\
**Category:** Elasticsearch\
**Created:** [December 28, 2017, 11:02am UTC](https://discuss.elastic.co/t/how-to-set-cluster-in-es-6-0-using-rest-client/113440 "2017-12-28T11:02:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunder\_thangaraj](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@sunder\_thangaraj](https://discuss.elastic.co/u/sunder_thangaraj)\
**Post date:** [December 28, 2017, 11:02am UTC](https://discuss.elastic.co/t/how-to-set-cluster-in-es-6-0-using-rest-client/113440/1 "2017-12-28T11:02:59Z")

</div>

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 ? .
```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 28, 2017, 6:22pm UTC](https://discuss.elastic.co/t/how-to-set-cluster-in-es-6-0-using-rest-client/113440/2 "2017-12-28T18:22:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sunder\_thangaraj](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@sunder\_thangaraj](https://discuss.elastic.co/u/sunder_thangaraj)\
**Post date:** [December 28, 2017, 11:52pm UTC](https://discuss.elastic.co/t/how-to-set-cluster-in-es-6-0-using-rest-client/113440/3 "2017-12-28T23:52:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 29, 2017, 2:49am UTC](https://discuss.elastic.co/t/how-to-set-cluster-in-es-6-0-using-rest-client/113440/4 "2017-12-29T02:49:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sunder\_thangaraj](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@sunder\_thangaraj](https://discuss.elastic.co/u/sunder_thangaraj)\
**Post date:** [January 5, 2018, 9:57am UTC](https://discuss.elastic.co/t/how-to-set-cluster-in-es-6-0-using-rest-client/113440/5 "2018-01-05T09:57:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 5, 2018, 10:11am UTC](https://discuss.elastic.co/t/how-to-set-cluster-in-es-6-0-using-rest-client/113440/6 "2018-01-05T10:11:24Z")

</div>

> ```
> 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](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-low-usage-initialization.html)

---

<div class="post-metadata">

**Author:** ![sunder\_thangaraj](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@sunder\_thangaraj](https://discuss.elastic.co/u/sunder_thangaraj)\
**Post date:** [January 8, 2018, 6:26am UTC](https://discuss.elastic.co/t/how-to-set-cluster-in-es-6-0-using-rest-client/113440/7 "2018-01-08T06:26:15Z")

</div>

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](http://cluster.name)], not dynamically updateable" .

Thanks

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 8, 2018, 7:08am UTC](https://discuss.elastic.co/t/how-to-set-cluster-in-es-6-0-using-rest-client/113440/8 "2018-01-08T07:08:55Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 5, 2018, 7:10am UTC](https://discuss.elastic.co/t/how-to-set-cluster-in-es-6-0-using-rest-client/113440/9 "2018-02-05T07:10:15Z")

</div>

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