# Index not recognized from java API

**URL:** <https://discuss.elastic.co/t/index-not-recognized-from-java-api/11257>\
**Category:** Elasticsearch\
**Created:** [March 22, 2013, 6:35am UTC](https://discuss.elastic.co/t/index-not-recognized-from-java-api/11257 "2013-03-22T06:35:53Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chetana](https://avatars.discourse-cdn.com/v4/letter/c/dbc845/32.png) [@Chetana](https://discuss.elastic.co/u/Chetana)\
**Post date:** [March 22, 2013, 6:35am UTC](https://discuss.elastic.co/t/index-not-recognized-from-java-api/11257/1 "2013-03-22T06:35:53Z")

</div>

I am new to ElasticSearch. Using Elastic search(version 0.20.5) as  
Standalone. I have created index using 'curl -XPUT '[http://localhost:9200/test/](http://localhost:9200/test/)''.  
I could also see empty mapping for '''test' when I run curl -XGET  
[http://localhost:9200/\_mapping](http://localhost:9200/_mapping), but the call to  
'client.admin().indices().prepareExists("test").execute().actionGet().exists()'  
returns false

Is it ok to set "node.name" in elasticsearch.yml for the standalone mode

'

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 22, 2013, 7:07am UTC](https://discuss.elastic.co/t/index-not-recognized-from-java-api/11257/2 "2013-03-22T07:07:47Z")

</div>

Hey,

when you do  
curl -X HEAD -v localhost:9200/test

Are you getting back a HTTP 200? Apart from that, can you post some  
snippets, how you are initiating your connection to the elasticsearch node?  
This might help in order to find your problem..

--Alex

On Fri, Mar 22, 2013 at 7:35 AM, Chetana [ambha.career@gmail.com](mailto:ambha.career@gmail.com) wrote:

> I am new to Elasticsearch. Using Elastic search(version 0.20.5) as  
> Standalone. I have created index using 'curl -XPUT '  
> [http://localhost:9200/test/](http://localhost:9200/test/)''. I could also see empty mapping for  
> '''test' when I run curl -XGET [http://localhost:9200/\_mapping](http://localhost:9200/_mapping), but the  
> call to  
> 'client.admin().indices().prepareExists("test").execute().actionGet().exists()'  
> returns false
> 
> Is it ok to set "node.name" in elasticsearch.yml for the standalone mode
> 
> '
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Chetana](https://avatars.discourse-cdn.com/v4/letter/c/dbc845/32.png) [@Chetana](https://discuss.elastic.co/u/Chetana)\
**Post date:** [March 22, 2013, 8:37am UTC](https://discuss.elastic.co/t/index-not-recognized-from-java-api/11257/3 "2013-03-22T08:37:49Z")

</div>

I am getting 200 OK.

For standalone, I created a single node cluster, I have set cluster name  
and node.anme in elasticsearch.yml. Looks like that is the problem, if I  
restore to default (no cluster and node name set in elasticsearch.yml) I  
get true for indices....exist().

My mapping is  
{"type1":{"properties":{"description":{"type":"string"},"id":{"type":  
"string"},"name":{"type":"string"}}}} . I see the same structure as output  
for curl -XGET [http://localhost:9200/\_mapping](http://localhost:9200/_mapping)

With default setting, I tried adding index (json as below) and in  
console could not see any exception

"id":"TEST2113-FFC4-4EE1-94A5-764D9EFD2C70","description":"sample  
test","name":"test it".

But  
curl -XGET  
[http://localhost:9200/test/type1/TEST2113-FFC4-4EE1-94A5-764D9EFD2C70](http://localhost:9200/test/type1/TEST2113-FFC4-4EE1-94A5-764D9EFD2C70) returns  
{"\_index":"test","\_type":"asset","type1":"TEST2113-FFC4-4EE1-94A5-764D9EFD2C70","exists":  
_false_}. Thus looks like index is not getting created.

I could see in the console [Flambe] [Test] creating index, cause  
[auto(index api)], shards [1]/[1], mappings . Does this mean Java api is  
not able to pick the mapping

Here is the code snippet I am using to add the index

Settings settings = ImmutableSettings.settingsBuilder()  
.put("index.store.type", "simplefs")  
.put("index.store.fs.memory.enabled", "false")  
.put("gateway.type", "none")  
.put("path.data", "E:\elasticsearch-0.20.5\temp\data")  
.put("path.work", "E:\elasticsearch-0.20.5\temp\work")  
.put("path.logs", "E:\elasticsearch-0.20.5\temp\logs")  
.put("index.number\_of\_shards", "1")  
.put("index.number\_of\_replicas", "1")  
.put("node.local", true).build();  
Client client =  
NodeBuilder.nodeBuilder().settings(settings).node().client();  
IndexRequestBuilder builder = client.prepareIndex();  
builder.setIndex("test");  
builder.setType("type1");  
builder.setId("TEST2113-FFC4-4EE1-94A5-764D9EFD2C70");  
builder.setSource(jsonString);  
builder.setRefresh(true);  
IndexResponse resp = client.index(builder.request()).get();

Please help

On Friday, March 22, 2013 12:37:47 PM UTC+5:30, Alexander Reelsen wrote:

> Hey,
> 
> when you do  
> curl -X HEAD -v localhost:9200/test
> 
> Are you getting back a HTTP 200? Apart from that, can you post some  
> snippets, how you are initiating your connection to the elasticsearch node?  
> This might help in order to find your problem..
> 
> --Alex
> 
> On Fri, Mar 22, 2013 at 7:35 AM, Chetana \<[ambha....@gmail.com](mailto:ambha....@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > I am new to Elasticsearch. Using Elastic search(version 0.20.5) as  
> > Standalone. I have created index using 'curl -XPUT '  
> > [http://localhost:9200/test/](http://localhost:9200/test/)''. I could also see empty mapping for  
> > '''test' when I run curl -XGET [http://localhost:9200/\_mapping](http://localhost:9200/_mapping), but the  
> > call to  
> > 'client.admin().indices().prepareExists("test").execute().actionGet().exists()'  
> > returns false
> > 
> > Is it ok to set "node.name" in elasticsearch.yml for the standalone mode
> > 
> > '
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [March 22, 2013, 8:49am UTC](https://discuss.elastic.co/t/index-not-recognized-from-java-api/11257/4 "2013-03-22T08:49:54Z")

</div>

Have a look here: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/index_.html)

I never used the get() notation but .execute().actionGet().

That said, if you are trying to connect to a running cluster, you have to add the cluster name in your Settings instance.  
Have a look at: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/client.html)

HTH

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 22 mars 2013 à 09:37, Chetana [ambha.career@gmail.com](mailto:ambha.career@gmail.com) a écrit :

> I am getting 200 OK.
> 
> For standalone, I created a single node cluster, I have set cluster name and node.anme in elasticsearch.yml. Looks like that is the problem, if I restore to default (no cluster and node name set in elasticsearch.yml) I get true for indices....exist().
> 
> My mapping is {"type1":{"properties":{"description":{"type":"string"},"id":{"type":  
> "string"},"name":{"type":"string"}}}} . I see the same structure as output for curl -XGET [http://localhost:9200/\_mapping](http://localhost:9200/_mapping)
> 
> With default setting, I tried adding index (json as below) and in console could not see any exception  
> "id":"TEST2113-FFC4-4EE1-94A5-764D9EFD2C70","description":"sample test","name":"test it".
> 
> But  
> curl -XGET [http://localhost:9200/test/type1/TEST2113-FFC4-4EE1-94A5-764D9EFD2C70](http://localhost:9200/test/type1/TEST2113-FFC4-4EE1-94A5-764D9EFD2C70) returns {"\_index":"test","\_type":"asset","type1":"TEST2113-FFC4-4EE1-94A5-764D9EFD2C70","exists":false}. Thus looks like index is not getting created.
> 
> I could see in the console [Flambe] [Test] creating index, cause [auto(index api)], shards [1]/[1], mappings . Does this mean Java api is not able to pick the mapping
> 
> Here is the code snippet I am using to add the index
> 
> Settings settings = ImmutableSettings.settingsBuilder()  
> .put("index.store.type", "simplefs")  
> .put("index.store.fs.memory.enabled", "false")  
> .put("gateway.type", "none")  
> .put("path.data", "E:\elasticsearch-0.20.5\temp\data")  
> .put("path.work", "E:\elasticsearch-0.20.5\temp\work")  
> .put("path.logs", "E:\elasticsearch-0.20.5\temp\logs")  
> .put("index.number\_of\_shards", "1")  
> .put("index.number\_of\_replicas", "1")  
> .put("node.local", true).build();  
> Client client = NodeBuilder.nodeBuilder().settings(settings).node().client();  
> IndexRequestBuilder builder = client.prepareIndex();  
> builder.setIndex("test");  
> builder.setType("type1");  
> builder.setId("TEST2113-FFC4-4EE1-94A5-764D9EFD2C70");  
> builder.setSource(jsonString);  
> builder.setRefresh(true);  
> IndexResponse resp = client.index(builder.request()).get();
> 
> Please help
> 
> On Friday, March 22, 2013 12:37:47 PM UTC+5:30, Alexander Reelsen wrote:  
> Hey,
> 
> when you do  
> curl -X HEAD -v localhost:9200/test
> 
> Are you getting back a HTTP 200? Apart from that, can you post some snippets, how you are initiating your connection to the elasticsearch node? This might help in order to find your problem..
> 
> --Alex
> 
> On Fri, Mar 22, 2013 at 7:35 AM, Chetana [ambha....@gmail.com](mailto:ambha....@gmail.com) wrote:  
> I am new to Elasticsearch. Using Elastic search(version 0.20.5) as Standalone. I have created index using 'curl -XPUT '[http://localhost:9200/test/](http://localhost:9200/test/)''. I could also see empty mapping for '''test' when I run curl -XGET [http://localhost:9200/\_mapping](http://localhost:9200/_mapping), but the call to 'client.admin().indices().prepareExists("test").execute().actionGet().exists()' returns false
> 
> Is it ok to set "node.name" in elasticsearch.yml for the standalone mode
> 
> '
> 
> --  
> 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 22, 2013, 8:52am UTC](https://discuss.elastic.co/t/index-not-recognized-from-java-api/11257/5 "2013-03-22T08:52:32Z")

</div>

Hey,

looking at your java code you are actually creating your own instance,  
instead of connecting to your existing elasticsearch instance. See this  
line which creates an elasticsearch node:

NodeBuilder.nodeBuilder().settings(settings).node()

If the node you created is not joining as a cluster with your already  
running elasticsearch instance, it will not see the created index and  
therefore show your error. Take a look at your logfiles if you are seeing  
any cluster joins. Also I think you need to call node.start() in order to  
fire it up.

--Alex

On Fri, Mar 22, 2013 at 9:37 AM, Chetana [ambha.career@gmail.com](mailto:ambha.career@gmail.com) wrote:

> I am getting 200 OK.
> 
> For standalone, I created a single node cluster, I have set cluster name  
> and node.anme in elasticsearch.yml. Looks like that is the problem, if I  
> restore to default (no cluster and node name set in elasticsearch.yml) I  
> get true for indices....exist().
> 
> My mapping is  
> {"type1":{"properties":{"description":{"type":"string"},"id":{"type":  
> "string"},"name":{"type":"string"}}}} . I see the same structure as output  
> for curl -XGET [http://localhost:9200/\_mapping](http://localhost:9200/_mapping)
> 
> With default setting, I tried adding index (json as below) and in  
> console could not see any exception
> 
> "id":"TEST2113-FFC4-4EE1-94A5-764D9EFD2C70","description":"sample  
> test","name":"test it".
> 
> But  
> curl -XGET  
> [http://localhost:9200/test/type1/TEST2113-FFC4-4EE1-94A5-764D9EFD2C70](http://localhost:9200/test/type1/TEST2113-FFC4-4EE1-94A5-764D9EFD2C70) returns  
> {"\_index":"test","\_type":"asset","type1":"TEST2113-FFC4-4EE1-94A5-764D9EFD2C70","exists":  
> _false_}. Thus looks like index is not getting created.
> 
> I could see in the console [Flambe] [Test] creating index, cause  
> [auto(index api)], shards [1]/[1], mappings . Does this mean Java api is  
> not able to pick the mapping
> 
> Here is the code snippet I am using to add the index
> 
> Settings settings = ImmutableSettings.settingsBuilder()  
> .put("index.store.type", "simplefs")  
> .put("index.store.fs.memory.enabled", "false")  
> .put("gateway.type", "none")  
> .put("path.data", "E:\elasticsearch-0.20.5\temp\data")  
> .put("path.work", "E:\elasticsearch-0.20.5\temp\work")  
> .put("path.logs", "E:\elasticsearch-0.20.5\temp\logs")  
> .put("index.number\_of\_shards", "1")  
> .put("index.number\_of\_replicas", "1")  
> .put("node.local", true).build();  
> Client client =  
> NodeBuilder.nodeBuilder().settings(settings).node().client();  
> IndexRequestBuilder builder = client.prepareIndex();  
> builder.setIndex("test");  
> builder.setType("type1");  
> builder.setId("TEST2113-FFC4-4EE1-94A5-764D9EFD2C70");  
> builder.setSource(jsonString);  
> builder.setRefresh(true);  
> IndexResponse resp = client.index(builder.request()).get();
> 
> Please help
> 
> On Friday, March 22, 2013 12:37:47 PM UTC+5:30, Alexander Reelsen wrote:
> 
> > Hey,
> > 
> > when you do  
> > curl -X HEAD -v localhost:9200/test
> > 
> > Are you getting back a HTTP 200? Apart from that, can you post some  
> > snippets, how you are initiating your connection to the elasticsearch node?  
> > This might help in order to find your problem..
> > 
> > --Alex
> > 
> > On Fri, Mar 22, 2013 at 7:35 AM, Chetana [ambha....@gmail.com](mailto:ambha....@gmail.com) wrote:
> > 
> > > I am new to Elasticsearch. Using Elastic search(version 0.20.5) as  
> > > Standalone. I have created index using 'curl -XPUT '  
> > > [http://localhost:9200/test/](http://localhost:9200/test/)''**. I could also see empty mapping for  
> > > '''test' when I run curl -XGET [http://localhost:9200/\_mapping](http://localhost:9200/_mapping)**, but  
> > > the call to 'client.admin().indices().**prepareExists("test").execute(**).actionGet().exists()'  
> > > returns false
> > > 
> > > Is it ok to set "node.name" in elasticsearch.yml for the standalone mode
> > > 
> > > '
> > > 
> > > --  
> > > 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 elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).
> > > 
> > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > .
> > 
> > --  
> > 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).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Chetana](https://avatars.discourse-cdn.com/v4/letter/c/dbc845/32.png) [@Chetana](https://discuss.elastic.co/u/Chetana)\
**Post date:** [March 22, 2013, 9:33am UTC](https://discuss.elastic.co/t/index-not-recognized-from-java-api/11257/6 "2013-03-22T09:33:24Z")

</div>

thanks both of you for quick responses...

Now I added cluster and node in in settings

.put("node.name", "mynode")  
.put("node.data", true)  
.put("cluster.name", "elasticsearch")

I have also set just the node name as "mynode" in elasticsearch.yml so that  
by default it will consider "elasticsearch" cluster

In log I see "mynode" as node in elasticsearch cluster and also curl -XGET  
[http://localhost:9200/\_cluster/nodes](http://localhost:9200/_cluster/nodes) confirms the same

There are no errors I see below lines and XGET returns exists:false

- [mynode] [test] creating index, cause [auto(index api)], shards [1]/[0],  
mappings   
-[mynode] [test] update\_mapping [asset] (dynamic)

With all these changes I am still not able to index valid data

On Friday, March 22, 2013 2:22:32 PM UTC+5:30, Alexander Reelsen wrote:

> Hey,
> 
> looking at your java code you are actually creating your own instance,  
> instead of connecting to your existing elasticsearch instance. See this  
> line which creates an elasticsearch node:
> 
> NodeBuilder.nodeBuilder().settings(settings).node()
> 
> If the node you created is not joining as a cluster with your already  
> running elasticsearch instance, it will not see the created index and  
> therefore show your error. Take a look at your logfiles if you are seeing  
> any cluster joins. Also I think you need to call node.start() in order to  
> fire it up.
> 
> --Alex
> 
> On Fri, Mar 22, 2013 at 9:37 AM, Chetana \<[ambha....@gmail.com](mailto:ambha....@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > I am getting 200 OK.
> > 
> > For standalone, I created a single node cluster, I have set cluster name  
> > and node.anme in elasticsearch.yml. Looks like that is the problem, if I  
> > restore to default (no cluster and node name set in elasticsearch.yml) I  
> > get true for indices....exist().
> > 
> > My mapping is  
> > {"type1":{"properties":{"description":{"type":"string"},"id":{"type":  
> > "string"},"name":{"type":"string"}}}} . I see the same structure as  
> > output for curl -XGET [http://localhost:9200/\_mapping](http://localhost:9200/_mapping)
> > 
> > With default setting, I tried adding index (json as below) and in  
> > console could not see any exception
> > 
> > "id":"TEST2113-FFC4-4EE1-94A5-764D9EFD2C70","description":"sample  
> > test","name":"test it".
> > 
> > But  
> > curl -XGET  
> > [http://localhost:9200/test/type1/TEST2113-FFC4-4EE1-94A5-764D9EFD2C70](http://localhost:9200/test/type1/TEST2113-FFC4-4EE1-94A5-764D9EFD2C70) returns  
> > {"\_index":"test","\_type":"asset","type1":"TEST2113-FFC4-4EE1-94A5-764D9EFD2C70","exists":  
> > _false_}. Thus looks like index is not getting created.
> > 
> > I could see in the console [Flambe] [Test] creating index, cause  
> > [auto(index api)], shards [1]/[1], mappings . Does this mean Java api is  
> > not able to pick the mapping
> > 
> > Here is the code snippet I am using to add the index
> > 
> > Settings settings = ImmutableSettings.settingsBuilder()  
> > .put("index.store.type", "simplefs")  
> > .put("index.store.fs.memory.enabled", "false")  
> > .put("gateway.type", "none")  
> > .put("path.data", "E:\elasticsearch-0.20.5\temp\data")  
> > .put("path.work", "E:\elasticsearch-0.20.5\temp\work")  
> > .put("path.logs", "E:\elasticsearch-0.20.5\temp\logs")  
> > .put("index.number\_of\_shards", "1")  
> > .put("index.number\_of\_replicas", "1")  
> > .put("node.local", true).build();  
> > Client client =  
> > NodeBuilder.nodeBuilder().settings(settings).node().client();  
> > IndexRequestBuilder builder = client.prepareIndex();  
> > builder.setIndex("test");  
> > builder.setType("type1");  
> > builder.setId("TEST2113-FFC4-4EE1-94A5-764D9EFD2C70");  
> > builder.setSource(jsonString);  
> > builder.setRefresh(true);  
> > IndexResponse resp = client.index(builder.request()).get();
> > 
> > Please help
> > 
> > On Friday, March 22, 2013 12:37:47 PM UTC+5:30, Alexander Reelsen wrote:
> > 
> > > Hey,
> > > 
> > > when you do  
> > > curl -X HEAD -v localhost:9200/test
> > > 
> > > Are you getting back a HTTP 200? Apart from that, can you post some  
> > > snippets, how you are initiating your connection to the elasticsearch node?  
> > > This might help in order to find your problem..
> > > 
> > > --Alex
> > > 
> > > On Fri, Mar 22, 2013 at 7:35 AM, Chetana [ambha....@gmail.com](mailto:ambha....@gmail.com) wrote:
> > > 
> > > > I am new to Elasticsearch. Using Elastic search(version 0.20.5) as  
> > > > Standalone. I have created index using 'curl -XPUT '  
> > > > [http://localhost:9200/test/](http://localhost:9200/test/)''**. I could also see empty mapping for  
> > > > '''test' when I run curl -XGET [http://localhost:9200/\_mapping](http://localhost:9200/_mapping)**, but  
> > > > the call to 'client.admin().indices().\*_prepareExists("test").execute(_  
> > > > \*).actionGet().exists()' returns false
> > > > 
> > > > Is it ok to set "node.name" in elasticsearch.yml for the standalone  
> > > > mode
> > > > 
> > > > '
> > > > 
> > > > --  
> > > > 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 elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).
> > > > 
> > > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > > .
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Chetana](https://avatars.discourse-cdn.com/v4/letter/c/dbc845/32.png) [@Chetana](https://discuss.elastic.co/u/Chetana)\
**Post date:** [March 22, 2013, 10:29am UTC](https://discuss.elastic.co/t/index-not-recognized-from-java-api/11257/7 "2013-03-22T10:29:39Z")

</div>

When I use tranportclient instead of NodeClient data gets inserted. Do you  
advice using TransportClient instead of NodeClient even for single node  
cluster

Which one (node or transport) is better when indexing is done from web  
application?

Does the TransportClient have runtime overhead compared to NodeClient?

On Friday, March 22, 2013 3:03:24 PM UTC+5:30, Chetana wrote:

> thanks both of you for quick responses...
> 
> Now I added cluster and node in in settings
> 
> .put("node.name", "mynode")  
> .put("node.data", true)  
> .put("cluster.name", "elasticsearch")
> 
> I have also set just the node name as "mynode" in elasticsearch.yml so  
> that by default it will consider "elasticsearch" cluster
> 
> In log I see "mynode" as node in elasticsearch cluster and also curl -XGET  
> [http://localhost:9200/\_cluster/nodes](http://localhost:9200/_cluster/nodes) confirms the same
> 
> There are no errors I see below lines and XGET returns exists:false
> 
> - [mynode] [test] creating index, cause [auto(index api)], shards [1]/[0],  
> mappings   
> -[mynode] [test] update\_mapping [asset] (dynamic)
> 
> With all these changes I am still not able to index valid data
> 
> On Friday, March 22, 2013 2:22:32 PM UTC+5:30, Alexander Reelsen wrote:
> 
> > Hey,
> > 
> > looking at your java code you are actually creating your own instance,  
> > instead of connecting to your existing elasticsearch instance. See this  
> > line which creates an elasticsearch node:
> > 
> > NodeBuilder.nodeBuilder().settings(settings).node()
> > 
> > If the node you created is not joining as a cluster with your already  
> > running elasticsearch instance, it will not see the created index and  
> > therefore show your error. Take a look at your logfiles if you are seeing  
> > any cluster joins. Also I think you need to call node.start() in order to  
> > fire it up.
> > 
> > --Alex
> > 
> > On Fri, Mar 22, 2013 at 9:37 AM, Chetana [ambha....@gmail.com](mailto:ambha....@gmail.com) wrote:
> > 
> > > I am getting 200 OK.
> > > 
> > > For standalone, I created a single node cluster, I have  
> > > set cluster name and node.anme in elasticsearch.yml. Looks like that is the  
> > > problem, if I restore to default (no cluster and node name set in  
> > > elasticsearch.yml) I get true for indices....exist().
> > > 
> > > My mapping is  
> > > {"type1":{"properties":{"description":{"type":"string"},"id":{"type":  
> > > "string"},"name":{"type":"string"}}}} . I see the same structure as  
> > > output for curl -XGET [http://localhost:9200/\_mapping](http://localhost:9200/_mapping)
> > > 
> > > With default setting, I tried adding index (json as below) and in  
> > > console could not see any exception
> > > 
> > > "id":"TEST2113-FFC4-4EE1-94A5-764D9EFD2C70","description":"sample  
> > > test","name":"test it".
> > > 
> > > But  
> > > curl -XGET  
> > > [http://localhost:9200/test/type1/TEST2113-FFC4-4EE1-94A5-764D9EFD2C70](http://localhost:9200/test/type1/TEST2113-FFC4-4EE1-94A5-764D9EFD2C70) returns  
> > > {"\_index":"test","\_type":"asset","type1":"TEST2113-FFC4-4EE1-94A5-764D9EFD2C70","exists":  
> > > _false_}. Thus looks like index is not getting created.
> > > 
> > > I could see in the console [Flambe] [Test] creating index, cause  
> > > [auto(index api)], shards [1]/[1], mappings . Does this mean Java api is  
> > > not able to pick the mapping
> > > 
> > > Here is the code snippet I am using to add the index
> > > 
> > > Settings settings = ImmutableSettings.settingsBuilder()  
> > > .put("index.store.type", "simplefs")  
> > > .put("index.store.fs.memory.enabled", "false")  
> > > .put("gateway.type", "none")  
> > > .put("path.data", "E:\elasticsearch-0.20.5\temp\data")  
> > > .put("path.work", "E:\elasticsearch-0.20.5\temp\work")  
> > > .put("path.logs", "E:\elasticsearch-0.20.5\temp\logs")  
> > > .put("index.number\_of\_shards", "1")  
> > > .put("index.number\_of\_replicas", "1")  
> > > .put("node.local", true).build();  
> > > Client client =  
> > > NodeBuilder.nodeBuilder().settings(settings).node().client();  
> > > IndexRequestBuilder builder = client.prepareIndex();  
> > > builder.setIndex("test");  
> > > builder.setType("type1");  
> > > builder.setId("TEST2113-FFC4-4EE1-94A5-764D9EFD2C70");  
> > > builder.setSource(jsonString);  
> > > builder.setRefresh(true);  
> > > IndexResponse resp = client.index(builder.request()).get();
> > > 
> > > Please help
> > > 
> > > On Friday, March 22, 2013 12:37:47 PM UTC+5:30, Alexander Reelsen wrote:
> > > 
> > > > Hey,
> > > > 
> > > > when you do  
> > > > curl -X HEAD -v localhost:9200/test
> > > > 
> > > > Are you getting back a HTTP 200? Apart from that, can you post some  
> > > > snippets, how you are initiating your connection to the elasticsearch node?  
> > > > This might help in order to find your problem..
> > > > 
> > > > --Alex
> > > > 
> > > > On Fri, Mar 22, 2013 at 7:35 AM, Chetana [ambha....@gmail.com](mailto:ambha....@gmail.com) wrote:
> > > > 
> > > > > I am new to Elasticsearch. Using Elastic search(version 0.20.5) as  
> > > > > Standalone. I have created index using 'curl -XPUT '  
> > > > > [http://localhost:9200/test/](http://localhost:9200/test/)''**. I could also see empty mapping for  
> > > > > '''test' when I run curl -XGET [http://localhost:9200/\_mapping](http://localhost:9200/_mapping)**, but  
> > > > > the call to 'client.admin().indices().\*\*prepareExists("test").execute(  
> > > > > \*\*).actionGet().exists()' returns false
> > > > > 
> > > > > Is it ok to set "node.name" in elasticsearch.yml for the standalone  
> > > > > mode
> > > > > 
> > > > > '
> > > > > 
> > > > > --  
> > > > > 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 elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).
> > > > > 
> > > > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > > > .
> > > > 
> > > > --  
> > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Chetana](https://avatars.discourse-cdn.com/v4/letter/c/dbc845/32.png) [@Chetana](https://discuss.elastic.co/u/Chetana)\
**Post date:** [March 22, 2013, 11:15am UTC](https://discuss.elastic.co/t/index-not-recognized-from-java-api/11257/8 "2013-03-22T11:15:49Z")

</div>

thanks both of you for quick responses...  
Now I added cluster and node in in settings

.put("_node.name_ [http://node.name/](http://node.name/)", "mynode")  
.put("node.data", true)  
.put("_cluster.name_ [http://cluster.name/](http://cluster.name/)", "elasticsearch")

I have also set just the node name as "mynode" in elasticsearch.yml so that  
by default it will consider "elasticsearch" cluster

In log I see "mynode" as node in elasticsearch cluster and also curl -XGET \*  
[http://localhost:9200/\_cluster/nodes](http://localhost:9200/_cluster/nodes)\* [http://localhost:9200/\_cluster/nodes](http://localhost:9200/_cluster/nodes)confirms the same

There are no errors I see below lines and XGET returns exists:false

- [mynode] [test] creating index, cause [auto(index api)], shards [1]/[0],  
mappings   
-[mynode] [test] update\_mapping [asset] (dynamic)

With all these changes I am still not able to index valid data  
When I use tranportclient instead of NodeClient data gets inserted. Do you  
advice using TransportClient instead of NodeClient even for single node  
cluster  
Which one (node or transport) is better when indexing is done from web  
application?  
Does the TransportClient have runtime overhead compared to NodeClient?  
For creating index both NodeClient and TransportClient works. Internally  
both use admin().IndicesAdminClient. But for adding index data only  
TransportClient works.  
Is there any bug in the code or only TransportClient is allowed to add the  
index?

On Friday, March 22, 2013 2:22:32 PM UTC+5:30, Alexander Reelsen wrote:

> Hey,
> 
> looking at your java code you are actually creating your own instance,  
> instead of connecting to your existing elasticsearch instance. See this  
> line which creates an elasticsearch node:
> 
> NodeBuilder.nodeBuilder().settings(settings).node()
> 
> If the node you created is not joining as a cluster with your already  
> running elasticsearch instance, it will not see the created index and  
> therefore show your error. Take a look at your logfiles if you are seeing  
> any cluster joins. Also I think you need to call node.start() in order to  
> fire it up.
> 
> --Alex
> 
> On Fri, Mar 22, 2013 at 9:37 AM, Chetana \<[ambha....@gmail.com](mailto:ambha....@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > I am getting 200 OK.
> > 
> > For standalone, I created a single node cluster, I have set cluster name  
> > and node.anme in elasticsearch.yml. Looks like that is the problem, if I  
> > restore to default (no cluster and node name set in elasticsearch.yml) I  
> > get true for indices....exist().
> > 
> > My mapping is  
> > {"type1":{"properties":{"description":{"type":"string"},"id":{"type":  
> > "string"},"name":{"type":"string"}}}} . I see the same structure as  
> > output for curl -XGET [http://localhost:9200/\_mapping](http://localhost:9200/_mapping)
> > 
> > With default setting, I tried adding index (json as below) and in  
> > console could not see any exception
> > 
> > "id":"TEST2113-FFC4-4EE1-94A5-764D9EFD2C70","description":"sample  
> > test","name":"test it".
> > 
> > But  
> > curl -XGET  
> > [http://localhost:9200/test/type1/TEST2113-FFC4-4EE1-94A5-764D9EFD2C70](http://localhost:9200/test/type1/TEST2113-FFC4-4EE1-94A5-764D9EFD2C70) returns  
> > {"\_index":"test","\_type":"asset","type1":"TEST2113-FFC4-4EE1-94A5-764D9EFD2C70","exists":  
> > _false_}. Thus looks like index is not getting created.
> > 
> > I could see in the console [Flambe] [Test] creating index, cause  
> > [auto(index api)], shards [1]/[1], mappings . Does this mean Java api is  
> > not able to pick the mapping
> > 
> > Here is the code snippet I am using to add the index
> > 
> > Settings settings = ImmutableSettings.settingsBuilder()  
> > .put("index.store.type", "simplefs")  
> > .put("index.store.fs.memory.enabled", "false")  
> > .put("gateway.type", "none")  
> > .put("path.data", "E:\elasticsearch-0.20.5\temp\data")  
> > .put("path.work", "E:\elasticsearch-0.20.5\temp\work")  
> > .put("path.logs", "E:\elasticsearch-0.20.5\temp\logs")  
> > .put("index.number\_of\_shards", "1")  
> > .put("index.number\_of\_replicas", "1")  
> > .put("node.local", true).build();  
> > Client client =  
> > NodeBuilder.nodeBuilder().settings(settings).node().client();  
> > IndexRequestBuilder builder = client.prepareIndex();  
> > builder.setIndex("test");  
> > builder.setType("type1");  
> > builder.setId("TEST2113-FFC4-4EE1-94A5-764D9EFD2C70");  
> > builder.setSource(jsonString);  
> > builder.setRefresh(true);  
> > IndexResponse resp = client.index(builder.request()).get();
> > 
> > Please help
> > 
> > On Friday, March 22, 2013 12:37:47 PM UTC+5:30, Alexander Reelsen wrote:
> > 
> > > Hey,
> > > 
> > > when you do  
> > > curl -X HEAD -v localhost:9200/test
> > > 
> > > Are you getting back a HTTP 200? Apart from that, can you post some  
> > > snippets, how you are initiating your connection to the elasticsearch node?  
> > > This might help in order to find your problem..
> > > 
> > > --Alex
> > > 
> > > On Fri, Mar 22, 2013 at 7:35 AM, Chetana [ambha....@gmail.com](mailto:ambha....@gmail.com) wrote:
> > > 
> > > > I am new to Elasticsearch. Using Elastic search(version 0.20.5) as  
> > > > Standalone. I have created index using 'curl -XPUT '  
> > > > [http://localhost:9200/test/](http://localhost:9200/test/)''**. I could also see empty mapping for  
> > > > '''test' when I run curl -XGET [http://localhost:9200/\_mapping](http://localhost:9200/_mapping)**, but  
> > > > the call to 'client.admin().indices().\*_prepareExists("test").execute(_  
> > > > \*).actionGet().exists()' returns false
> > > > 
> > > > Is it ok to set "node.name" in elasticsearch.yml for the standalone  
> > > > mode
> > > > 
> > > > '
> > > > 
> > > > --  
> > > > 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 elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).
> > > > 
> > > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > > .
> > > 
> > > --  
> > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:45am UTC](https://discuss.elastic.co/t/index-not-recognized-from-java-api/11257/9 "2017-07-06T02:45:07Z")

</div>


