AutoIncremented Id column is null after inserting data


(Swati Garg) #1

Hi Team,

String json = "{" +
""user":"kimchy"," +
""postDate":"2013-01-30"," +
""message":"trying out Elasticsearch"" +
"}";
IndexResponse response= client.prepareIndex("test1,"testType", "")
.setSource(json)
.setOpType(IndexRequest.OpType.CREATE)
.execute()
.actionGet();
System.out.println("Id "+response.getId());
System.out.println("Index "+response.getIndex());
System.out.println("Type "+response.getType());
System.out.println("Created "+response.status());
System.out.println("Created "+response.toString());

I ran above code through Java and "response.getId()" is returned null. I think, If we don't provide Id, ElasticSearch will create one. Looks like it is not doing that way. Can you please let me know what am i missing.


(David Pilato) #2

You provided an id : ""

Remove this parameter


(system) #3

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