# Why "IndicesExistsRequest" is always comes as false on very startup of ES data node

**URL:** <https://discuss.elastic.co/t/why-indicesexistsrequest-is-always-comes-as-false-on-very-startup-of-es-data-node/22607>\
**Category:** Elasticsearch\
**Created:** [March 10, 2015, 8:20pm UTC](https://discuss.elastic.co/t/why-indicesexistsrequest-is-always-comes-as-false-on-very-startup-of-es-data-node/22607 "2015-03-10T20:20:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gaurav\_gupta](https://avatars.discourse-cdn.com/v4/letter/g/e274bd/32.png) [@Gaurav\_gupta](https://discuss.elastic.co/u/Gaurav_gupta)\
**Post date:** [March 10, 2015, 8:20pm UTC](https://discuss.elastic.co/t/why-indicesexistsrequest-is-always-comes-as-false-on-very-startup-of-es-data-node/22607/1 "2015-03-10T20:20:40Z")

</div>

I need to check if any index already exist or not or re-start or start up  
the ES Data node.

I am facing issue if I restart the ES Data node and then directly check if  
an index exist or not. I am always getting response as "false" (even if it  
exist and a valid one). But if, I perform a search or any other operation  
on that index and then again check "is index exist" then I am correctly  
getting "true" as response. Could you guide me what I might be missing or  
doing wrong.

I am using the Java client API and using following code snippet for it:-

_1- to start the data node :-_

```
    defaultSettingsFile = new

```

FileInputStream(ElasticSearchConfig.modulesDir + "/" +  
ElasticSearchConfig.ES\_DEFAULT\_PROP);

settingsBuilder.loadFromStream(ElasticSearchConfig.ES\_DEFAULT\_PROP,  
defaultSettingsFile);

```
    // override the default properties
    settingsFile = new FileInputStream(ElasticSearchConfig.modulesDir +

```

"/" + ElasticSearchConfig.ES\_OVERRIDE\_PROP);

settingsBuilder.loadFromStream(ElasticSearchConfig.ES\_OVERRIDE\_PROP,  
settingsFile);

```
    Settings finalSettings = settingsBuilder
            .put(ElasticSearchReservedWords.CLUSTER_NAME.getText(),

```

ElasticSearchConfig.clusterName)  
.put(ElasticSearchReservedWords.NODE\_NAME.getText(),  
ElasticSearchConfig.esDataNodeProperty.getName())  
.put(ElasticSearchReservedWords.NODE\_MASTER.getText(), true)  
.put(ElasticSearchReservedWords.NODE\_DATA.getText(), true)  
.put(ElasticSearchReservedWords.PATH\_DATA.getText(),  
ElasticSearchConfig.esDataNodeProperty.getDataPath())  
.put("discovery.zen.ping.multicast.enabled", false)  
.put("discovery.zen.ping.unicast.hosts",  
ElasticSearchConfig.unicast\_hosts) // //  
NetworkUtils.getLocalAddress().getHostName()  
.put("indices.store.type", "mmapfs")  
.put("index.number\_of\_shards",  
ElasticSearchConfig.numberOfShards)  
.build();

```
    node = nodeBuilder().settings(finalSettings).node();
    node.start();

```

_2- To check if Index exist :-_

```
IndicesExistsRequest request = new IndicesExistsRequest(indexName);
IndicesExistsResponse response =

```

getClientAdminNode().indices().exists(request).actionGet();

Thanks  
Gaurav

--  
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/CALZAj3%2BvKH2s3Mwg%3DbmhF1idbUrXAfB9ic48o6J9rXF1MZ%2BZvA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALZAj3%2BvKH2s3Mwg%3DbmhF1idbUrXAfB9ic48o6J9rXF1MZ%2BZvA%40mail.gmail.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, 12:27am UTC](https://discuss.elastic.co/t/why-indicesexistsrequest-is-always-comes-as-false-on-very-startup-of-es-data-node/22607/2 "2017-07-06T00:27:34Z")

</div>


