# Can't use the Java API with data-less node

**URL:** <https://discuss.elastic.co/t/cant-use-the-java-api-with-data-less-node/15842>\
**Category:** Elasticsearch\
**Created:** [February 17, 2014, 10:30am UTC](https://discuss.elastic.co/t/cant-use-the-java-api-with-data-less-node/15842 "2014-02-17T10:30:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dario\_Rossi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dario_rossi/32/1672_2.png) [@Dario\_Rossi](https://discuss.elastic.co/u/Dario_Rossi)\
**Post date:** [February 17, 2014, 10:30am UTC](https://discuss.elastic.co/t/cant-use-the-java-api-with-data-less-node/15842/1 "2014-02-17T10:30:25Z")

</div>

Hello,  
I'm in the process of moving away from the REST API to the JAVA one  
(because we want to benefit from the data-less node advantages).

I tried to startup the local node in this way (boot seems fine to me):

String localhostname = java.net.InetAddress.getLocalHost().getHostName();

```
    ImmutableSettings.Builder settings = 

```

ImmutableSettings.settingsBuilder();

```
    settings.put("cluster.name", clusterName);

    //Node name
    settings.put("node.name", localhostname + "-eslocalnode");

    //This is key to configure a data less node
    /*

    # 3. You want this node to be neither master nor data node, but
    # to act as a "search load balancer" (fetching data from nodes,
    # aggregating results, etc.)
    #
    # node.master: false
    # node.data: false

     */
    settings.put("node.master", false);
    settings.put("node.data", true);

    /*

    # By default, multiple nodes are allowed to start from the same 

```

installation location  
# to disable it, set the following:  
# node.max\_local\_storage\_nodes: 1

```
     */
    settings.put("node.max_local_storage_nodes", 1);

    /*

    # Set a custom port for the node to node communication (9300 by 

```

default):  
#  
# transport.tcp.port: 9300  
\*/  
if (tcpPort \> 0)  
settings.put("transport.tcp.port", tcpPort);  
else  
throw new IllegalArgumentException("tcpPort is not set");

```
    /*

    # Disable HTTP completely:
    #
    # http.enabled: false

    I don't want the HTTP api to be available on the local data-less 

```

nodes, so I disable it

```
     */

    settings.put("http.enabled", false);

    /**
     *
     * DISCOVERY PART!!!
     *
     *
     *
     */

    settings.put("discovery.zen.ping.timeout", discoveryPingTimeout);

    String unicastHostsArr[] = discoveryUnicastHosts.split("\\s*,\\s*");

    if (unicastHostsArr.length > 0)
        settings.put("discovery.zen.ping.unicast.hosts", 

```

unicastHostsArr);  
settings.put("discovery.zen.ping.multicast.enabled", false);  
Settings esSettings = settings.build();  
Node newNode =  
NodeBuilder.nodeBuilder().local(true).settings(esSettings).node();  
node = newNode.start();

(all variables are properly initialized I checked it). In particular, the  
unicastHosts are just one host that is our dev server (and it is filled  
with significant data) and the cluster name is the same.

Anyway if I attempt a search using like:

Client client = node.client();

```
    ActionFuture<SearchResponse> searchFuture = client.search(new 

```

SearchRequest("journalindex"));  
SearchResponse search = searchFuture.get();

I get:

Exception in thread "main" java.util.concurrent.ExecutionException:  
org.elasticsearch.cluster.block.ClusterBlockException: blocked by:  
[SERVICE\_UNAVAILABLE/1/state not recovered /  
initialized];[SERVICE\_UNAVAILABLE/2/no master];  
at  
org.elasticsearch.common.util.concurrent.BaseFuture$Sync.getValue(BaseFuture.java:288)  
at  
org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:275)  
at  
org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:113)  
at  
com.netaporter.cms.estests.test.EsDataLessNodeTest.main(EsDataLessNodeTest.java:32)  
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
at  
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)  
at  
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
at java.lang.reflect.Method.invoke(Method.java:606)  
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

any idea on why this is happening?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/88c7a121-5ffb-43db-8e1d-ce6534a33a26%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/88c7a121-5ffb-43db-8e1d-ce6534a33a26%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Dario\_Rossi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dario_rossi/32/1672_2.png) [@Dario\_Rossi](https://discuss.elastic.co/u/Dario_Rossi)\
**Post date:** [February 17, 2014, 10:38am UTC](https://discuss.elastic.co/t/cant-use-the-java-api-with-data-less-node/15842/2 "2014-02-17T10:38:21Z")

</div>

There's a little mistake

```
    settings.put("node.data", true);

```

should be

```
    settings.put("node.data", false);

```

Il giorno lunedì 17 febbraio 2014 10:30:25 UTC, Dario Rossi ha scritto:

> Hello,  
> I'm in the process of moving away from the REST API to the JAVA one  
> (because we want to benefit from the data-less node advantages).
> 
> I tried to startup the local node in this way (boot seems fine to me):
> 
> String localhostname = java.net.InetAddress.getLocalHost().getHostName();
> 
> ```
> ImmutableSettings.Builder settings = 
> 
> ```
> 
> ImmutableSettings.settingsBuilder();
> 
> ```
> settings.put("cluster.name", clusterName);
> 
> //Node name
> settings.put("node.name", localhostname + "-eslocalnode");
> 
> //This is key to configure a data less node
> /*
> 
> # 3. You want this node to be neither master nor data node, but
> # to act as a "search load balancer" (fetching data from nodes,
> # aggregating results, etc.)
> #
> # node.master: false
> # node.data: false
> 
> */
> settings.put("node.master", false);
> settings.put("node.data", true);
> 
> /*
> 
> # By default, multiple nodes are allowed to start from the same 
> 
> ```
> 
> installation location  
> # to disable it, set the following:  
> # node.max\_local\_storage\_nodes: 1
> 
> ```
> */
> settings.put("node.max_local_storage_nodes", 1);
> 
> /*
> 
> # Set a custom port for the node to node communication (9300 by 
> 
> ```
> 
> default):  
> #  
> # transport.tcp.port: 9300  
> \*/  
> if (tcpPort \> 0)  
> settings.put("transport.tcp.port", tcpPort);  
> else  
> throw new IllegalArgumentException("tcpPort is not set");
> 
> ```
> /*
> 
> # Disable HTTP completely:
> #
> # http.enabled: false
> 
> I don't want the HTTP api to be available on the local data-less 
> 
> ```
> 
> nodes, so I disable it
> 
> ```
> */
> 
> settings.put("http.enabled", false);
> 
> /**
> *
> * DISCOVERY PART!!!
> *
> *
> *
> */
> 
> settings.put("discovery.zen.ping.timeout", discoveryPingTimeout);
> 
> String unicastHostsArr[] = 
> 
> ```
> 
> discoveryUnicastHosts.split("\s\*,\s\*");
> 
> ```
> if (unicastHostsArr.length > 0)
> settings.put("discovery.zen.ping.unicast.hosts", 
> 
> ```
> 
> unicastHostsArr);  
> settings.put("discovery.zen.ping.multicast.enabled", false);  
> Settings esSettings = settings.build();  
> Node newNode =  
> NodeBuilder.nodeBuilder().local(true).settings(esSettings).node();  
> node = newNode.start();
> 
> (all variables are properly initialized I checked it). In particular, the  
> unicastHosts are just one host that is our dev server (and it is filled  
> with significant data) and the cluster name is the same.
> 
> Anyway if I attempt a search using like:
> 
> Client client = node.client();
> 
> ```
> ActionFuture<SearchResponse> searchFuture = client.search(new 
> 
> ```
> 
> SearchRequest("journalindex"));  
> SearchResponse search = searchFuture.get();
> 
> I get:
> 
> Exception in thread "main" java.util.concurrent.ExecutionException:  
> org.elasticsearch.cluster.block.ClusterBlockException: blocked by:  
> [SERVICE\_UNAVAILABLE/1/state not recovered /  
> initialized];[SERVICE\_UNAVAILABLE/2/no master];  
> at  
> org.elasticsearch.common.util.concurrent.BaseFuture$Sync.getValue(BaseFuture.java:288)  
> at  
> org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:275)  
> at  
> org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:113)  
> at  
> com.netaporter.cms.estests.test.EsDataLessNodeTest.main(EsDataLessNodeTest.java:32)  
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
> at  
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)  
> at  
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
> at java.lang.reflect.Method.invoke(Method.java:606)  
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
> 
> any idea on why this is happening?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/8e4f8d55-743a-4b44-bcef-8d04d3efb3d1%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8e4f8d55-743a-4b44-bcef-8d04d3efb3d1%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Manthan\_Shah](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@Manthan\_Shah](https://discuss.elastic.co/u/Manthan_Shah)\
**Post date:** [August 14, 2014, 6:08am UTC](https://discuss.elastic.co/t/cant-use-the-java-api-with-data-less-node/15842/3 "2014-08-14T06:08:28Z")

</div>

Was that a really problem for above Error? I doubt this could be a reason.  
Facing similar issue with 1.3.1 version

On Monday, February 17, 2014 4:08:21 PM UTC+5:30, Dario Rossi wrote:

> There's a little mistake
> 
> ```
> settings.put("node.data", true);
> 
> ```
> 
> should be
> 
> ```
> settings.put("node.data", false);
> 
> ```
> 
> Il giorno lunedì 17 febbraio 2014 10:30:25 UTC, Dario Rossi ha scritto:
> 
> > Hello,  
> > I'm in the process of moving away from the REST API to the JAVA one  
> > (because we want to benefit from the data-less node advantages).
> > 
> > I tried to startup the local node in this way (boot seems fine to me):
> > 
> > String localhostname = java.net.InetAddress.getLocalHost().getHostName();
> > 
> > ```
> > ImmutableSettings.Builder settings = 
> > 
> > ```
> > 
> > ImmutableSettings.settingsBuilder();
> > 
> > ```
> > settings.put("cluster.name", clusterName);
> > 
> > //Node name
> > settings.put("node.name", localhostname + "-eslocalnode");
> > 
> > //This is key to configure a data less node
> > /*
> > 
> > # 3. You want this node to be neither master nor data node, but
> > # to act as a "search load balancer" (fetching data from nodes,
> > # aggregating results, etc.)
> > #
> > # node.master: false
> > # node.data: false
> > 
> > */
> > settings.put("node.master", false);
> > settings.put("node.data", true);
> > 
> > /*
> > 
> > # By default, multiple nodes are allowed to start from the same 
> > 
> > ```
> > 
> > installation location  
> > # to disable it, set the following:  
> > # node.max\_local\_storage\_nodes: 1
> > 
> > ```
> > */
> > settings.put("node.max_local_storage_nodes", 1);
> > 
> > /*
> > 
> > # Set a custom port for the node to node communication (9300 by 
> > 
> > ```
> > 
> > default):  
> > #  
> > # transport.tcp.port: 9300  
> > \*/  
> > if (tcpPort \> 0)  
> > settings.put("transport.tcp.port", tcpPort);  
> > else  
> > throw new IllegalArgumentException("tcpPort is not set");
> > 
> > ```
> > /*
> > 
> > # Disable HTTP completely:
> > #
> > # http.enabled: false
> > 
> > I don't want the HTTP api to be available on the local data-less 
> > 
> > ```
> > 
> > nodes, so I disable it
> > 
> > ```
> > */
> > 
> > settings.put("http.enabled", false);
> > 
> > /**
> > *
> > * DISCOVERY PART!!!
> > *
> > *
> > *
> > */
> > 
> > settings.put("discovery.zen.ping.timeout", discoveryPingTimeout);
> > 
> > String unicastHostsArr[] = 
> > 
> > ```
> > 
> > discoveryUnicastHosts.split("\s\*,\s\*");
> > 
> > ```
> > if (unicastHostsArr.length > 0)
> > settings.put("discovery.zen.ping.unicast.hosts", 
> > 
> > ```
> > 
> > unicastHostsArr);  
> > settings.put("discovery.zen.ping.multicast.enabled", false);  
> > Settings esSettings = settings.build();  
> > Node newNode =  
> > NodeBuilder.nodeBuilder().local(true).settings(esSettings).node();  
> > node = newNode.start();
> > 
> > (all variables are properly initialized I checked it). In particular, the  
> > unicastHosts are just one host that is our dev server (and it is filled  
> > with significant data) and the cluster name is the same.
> > 
> > Anyway if I attempt a search using like:
> > 
> > Client client = node.client();
> > 
> > ```
> > ActionFuture<SearchResponse> searchFuture = client.search(new 
> > 
> > ```
> > 
> > SearchRequest("journalindex"));  
> > SearchResponse search = searchFuture.get();
> > 
> > I get:
> > 
> > Exception in thread "main" java.util.concurrent.ExecutionException:  
> > org.elasticsearch.cluster.block.ClusterBlockException: blocked by:  
> > [SERVICE\_UNAVAILABLE/1/state not recovered /  
> > initialized];[SERVICE\_UNAVAILABLE/2/no master];  
> > at  
> > org.elasticsearch.common.util.concurrent.BaseFuture$Sync.getValue(BaseFuture.java:288)  
> > at  
> > org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:275)  
> > at  
> > org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:113)  
> > at  
> > com.netaporter.cms.estests.test.EsDataLessNodeTest.main(EsDataLessNodeTest.java:32)  
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
> > at  
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)  
> > at  
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
> > at java.lang.reflect.Method.invoke(Method.java:606)  
> > at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
> > 
> > any idea on why this is happening?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/1b089bd3-411e-444a-b2f7-20534ba75190%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1b089bd3-411e-444a-b2f7-20534ba75190%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [August 14, 2014, 7:06am UTC](https://discuss.elastic.co/t/cant-use-the-java-api-with-data-less-node/15842/4 "2014-08-14T07:06:01Z")

</div>

I don't think but yes you should set your node as a client node .client(true) and don't add too many settings.

Wondering if the port 9300 is opened on your nodes?

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

> Le 14 août 2014 à 08:08, Manthan Shah [msshah8@gmail.com](mailto:msshah8@gmail.com) a écrit :
> 
> Was that a really problem for above Error? I doubt this could be a reason. Facing similar issue with 1.3.1 version
> 
> > On Monday, February 17, 2014 4:08:21 PM UTC+5:30, Dario Rossi wrote:  
> > There's a little mistake
> > 
> > ```
> > settings.put("node.data", true);
> > 
> > ```
> > 
> > should be
> > 
> > ```
> > settings.put("node.data", false);
> > 
> > ```
> > 
> > Il giorno lunedì 17 febbraio 2014 10:30:25 UTC, Dario Rossi ha scritto:
> > 
> > > Hello,  
> > > I'm in the process of moving away from the REST API to the JAVA one (because we want to benefit from the data-less node advantages).
> > > 
> > > I tried to startup the local node in this way (boot seems fine to me):
> > > 
> > > String localhostname = java.net.InetAddress.getLocalHost().getHostName();
> > > 
> > > ```
> > > ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder();
> > > 
> > > settings.put("cluster.name", clusterName);
> > > 
> > > //Node name
> > > settings.put("node.name", localhostname + "-eslocalnode");
> > > 
> > > //This is key to configure a data less node
> > > /*
> > > 
> > > # 3. You want this node to be neither master nor data node, but
> > > # to act as a "search load balancer" (fetching data from nodes,
> > > # aggregating results, etc.)
> > > #
> > > # node.master: false
> > > # node.data: false
> > > 
> > > */
> > > settings.put("node.master", false);
> > > settings.put("node.data", true);
> > > 
> > > /*
> > > 
> > > # By default, multiple nodes are allowed to start from the same installation location
> > > # to disable it, set the following:
> > > # node.max_local_storage_nodes: 1
> > > 
> > > */
> > > settings.put("node.max_local_storage_nodes", 1);
> > > 
> > > /*
> > > 
> > > # Set a custom port for the node to node communication (9300 by default):
> > > #
> > > # transport.tcp.port: 9300
> > > */
> > > if (tcpPort > 0)
> > > settings.put("transport.tcp.port", tcpPort);
> > > else
> > > throw new IllegalArgumentException("tcpPort is not set");
> > > 
> > > /*
> > > 
> > > # Disable HTTP completely:
> > > #
> > > # http.enabled: false
> > > 
> > > I don't want the HTTP api to be available on the local data-less nodes, so I disable it
> > > 
> > > */
> > > 
> > > settings.put("http.enabled", false);
> > > 
> > > /**
> > > *
> > > * DISCOVERY PART!!!
> > > *
> > > *
> > > *
> > > */
> > > 
> > > settings.put("discovery.zen.ping.timeout", discoveryPingTimeout);
> > > 
> > > String unicastHostsArr[] = discoveryUnicastHosts.split("\\s*,\\s*");
> > > 
> > > if (unicastHostsArr.length > 0)
> > > settings.put("discovery.zen.ping.unicast.hosts", unicastHostsArr);
> > > settings.put("discovery.zen.ping.multicast.enabled", false);
> > > Settings esSettings = settings.build();
> > > Node newNode = NodeBuilder.nodeBuilder().local(true).settings(esSettings).node();
> > > node = newNode.start();
> > > 
> > > ```
> > > 
> > > (all variables are properly initialized I checked it). In particular, the unicastHosts are just one host that is our dev server (and it is filled with significant data) and the cluster name is the same.
> > > 
> > > Anyway if I attempt a search using like:
> > > 
> > > Client client = node.client();  
> > > ActionFuture searchFuture = client.search(new SearchRequest("journalindex"));  
> > > SearchResponse search = searchFuture.get();
> > > 
> > > I get:
> > > 
> > > Exception in thread "main" java.util.concurrent.ExecutionException: org.elasticsearch.cluster.block.ClusterBlockException: blocked by: [SERVICE\_UNAVAILABLE/1/state not recovered / initialized];[SERVICE\_UNAVAILABLE/2/no master];  
> > > at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.getValue(BaseFuture.java:288)  
> > > at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:275)  
> > > at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:113)  
> > > at com.netaporter.cms.estests.test.EsDataLessNodeTest.main(EsDataLessNodeTest.java:32)  
> > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
> > > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)  
> > > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
> > > at java.lang.reflect.Method.invoke(Method.java:606)  
> > > at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
> > > 
> > > any idea on why this is happening?
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/1b089bd3-411e-444a-b2f7-20534ba75190%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1b089bd3-411e-444a-b2f7-20534ba75190%40googlegroups.com).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/28D93982-2292-42E0-BC33-E7FF95C4638F%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/28D93982-2292-42E0-BC33-E7FF95C4638F%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [August 14, 2014, 7:17am UTC](https://discuss.elastic.co/t/cant-use-the-java-api-with-data-less-node/15842/5 "2014-08-14T07:17:16Z")

</div>

I doubt that "local(true)" and unicast can work seamlessly together -  
either the node should use the network (local=false, which is the default),  
or not.

Also, before search, a cluster health check would be appropriate, and a  
cluster nodes info request for the number of data nodes connected. This can  
give more clues than running into nasty service unavailable errors.

Jörg

On Thu, Aug 14, 2014 at 8:08 AM, Manthan Shah [msshah8@gmail.com](mailto:msshah8@gmail.com) wrote:

> Was that a really problem for above Error? I doubt this could be a reason.  
> Facing similar issue with 1.3.1 version
> 
> On Monday, February 17, 2014 4:08:21 PM UTC+5:30, Dario Rossi wrote:
> 
> > There's a little mistake
> > 
> > ```
> > settings.put("node.data", true);
> > 
> > ```
> > 
> > should be
> > 
> > ```
> > settings.put("node.data", false);
> > 
> > ```
> > 
> > Il giorno lunedì 17 febbraio 2014 10:30:25 UTC, Dario Rossi ha scritto:
> > 
> > > Hello,  
> > > I'm in the process of moving away from the REST API to the JAVA one  
> > > (because we want to benefit from the data-less node advantages).
> > > 
> > > I tried to startup the local node in this way (boot seems fine to me):
> > > 
> > > String localhostname = java.net.InetAddress.  
> > > getLocalHost().getHostName();
> > > 
> > > ```
> > > ImmutableSettings.Builder settings = ImmutableSettings.
> > > 
> > > ```
> > > 
> > > settingsBuilder();
> > > 
> > > ```
> > > settings.put("cluster.name", clusterName);
> > > 
> > > //Node name
> > > settings.put("node.name", localhostname + "-eslocalnode");
> > > 
> > > //This is key to configure a data less node
> > > /*
> > > 
> > > # 3. You want this node to be neither master nor data node, but
> > > # to act as a "search load balancer" (fetching data from
> > > 
> > > ```
> > > 
> > > nodes,  
> > > # aggregating results, etc.)  
> > > #  
> > > # node.master: false  
> > > # node.data: false
> > > 
> > > ```
> > > */
> > > settings.put("node.master", false);
> > > settings.put("node.data", true);
> > > 
> > > /*
> > > 
> > > # By default, multiple nodes are allowed to start from the same
> > > 
> > > ```
> > > 
> > > installation location  
> > > # to disable it, set the following:  
> > > # node.max\_local\_storage\_nodes: 1
> > > 
> > > ```
> > > */
> > > settings.put("node.max_local_storage_nodes", 1);
> > > 
> > > /*
> > > 
> > > # Set a custom port for the node to node communication (9300 by
> > > 
> > > ```
> > > 
> > > default):  
> > > #  
> > > # transport.tcp.port: 9300  
> > > \*/  
> > > if (tcpPort \> 0)  
> > > settings.put("transport.tcp.port", tcpPort);  
> > > else  
> > > throw new IllegalArgumentException("tcpPort is not set");
> > > 
> > > ```
> > > /*
> > > 
> > > # Disable HTTP completely:
> > > #
> > > # http.enabled: false
> > > 
> > > I don't want the HTTP api to be available on the local data-less
> > > 
> > > ```
> > > 
> > > nodes, so I disable it
> > > 
> > > ```
> > > */
> > > 
> > > settings.put("http.enabled", false);
> > > 
> > > /**
> > > *
> > > * DISCOVERY PART!!!
> > > *
> > > *
> > > *
> > > */
> > > 
> > > settings.put("discovery.zen.ping.timeout",
> > > 
> > > ```
> > > 
> > > discoveryPingTimeout);
> > > 
> > > ```
> > > String unicastHostsArr[] = discoveryUnicastHosts.split("\
> > > 
> > > ```
> > > 
> > > \s\*,\s\*");
> > > 
> > > ```
> > > if (unicastHostsArr.length > 0)
> > > settings.put("discovery.zen.ping.unicast.hosts",
> > > 
> > > ```
> > > 
> > > unicastHostsArr);  
> > > settings.put("discovery.zen.ping.multicast.enabled", false);  
> > > Settings esSettings = settings.build();  
> > > Node newNode = NodeBuilder.nodeBuilder().local(true).settings(  
> > > esSettings).node();  
> > > node = newNode.start();
> > > 
> > > (all variables are properly initialized I checked it). In particular,  
> > > the unicastHosts are just one host that is our dev server (and it is filled  
> > > with significant data) and the cluster name is the same.
> > > 
> > > Anyway if I attempt a search using like:
> > > 
> > > Client client = node.client();
> > > 
> > > ```
> > > ActionFuture<SearchResponse> searchFuture = client.search(new
> > > 
> > > ```
> > > 
> > > SearchRequest("journalindex"));  
> > > SearchResponse search = searchFuture.get();
> > > 
> > > I get:
> > > 
> > > Exception in thread "main" java.util.concurrent.ExecutionException:  
> > > org.elasticsearch.cluster.block.ClusterBlockException: blocked by:  
> > > [SERVICE\_UNAVAILABLE/1/state not recovered / initialized];[SERVICE\_UNAVAILABLE/2/no  
> > > master];  
> > > at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.  
> > > getValue(BaseFuture.java:288)  
> > > at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.  
> > > get(BaseFuture.java:275)  
> > > at org.elasticsearch.common.util.concurrent.BaseFuture.get(  
> > > BaseFuture.java:113)  
> > > at com.netaporter.cms.estests.test.EsDataLessNodeTest.main(  
> > > EsDataLessNodeTest.java:32)  
> > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
> > > at sun.reflect.NativeMethodAccessorImpl.invoke(  
> > > NativeMethodAccessorImpl.java:57)  
> > > at sun.reflect.DelegatingMethodAccessorImpl.invoke(  
> > > DelegatingMethodAccessorImpl.java:43)  
> > > at java.lang.reflect.Method.invoke(Method.java:606)  
> > > at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
> > > 
> > > any idea on why this is happening?
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/1b089bd3-411e-444a-b2f7-20534ba75190%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1b089bd3-411e-444a-b2f7-20534ba75190%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/1b089bd3-411e-444a-b2f7-20534ba75190%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/1b089bd3-411e-444a-b2f7-20534ba75190%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHe0HoXnDavcHiGdSJgQaHTxdi%2B%3D3b0uFVYkKC60cvQ7g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHe0HoXnDavcHiGdSJgQaHTxdi%2B%3D3b0uFVYkKC60cvQ7g%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![eunever32](https://avatars.discourse-cdn.com/v4/letter/e/e68b1a/32.png) [@eunever32](https://discuss.elastic.co/u/eunever32)\
**Post date:** [August 14, 2014, 6:26pm UTC](https://discuss.elastic.co/t/cant-use-the-java-api-with-data-less-node/15842/6 "2014-08-14T18:26:01Z")

</div>

Is the clusterName set correctly?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/3b956394-5f7b-4f01-87ed-a227b2218e6b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3b956394-5f7b-4f01-87ed-a227b2218e6b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:08am UTC](https://discuss.elastic.co/t/cant-use-the-java-api-with-data-less-node/15842/7 "2017-07-06T01:08:27Z")

</div>


