How to get document id using java api?

Hi

I have doubt regarding setting document id manually or automatically.

1.what benefit we get from setting document id.

2.if it not set the it assign automatically which java method is help
to get the document id.

Thanks

It depends on your use case.
It could be useful for debugging for example.

You could use also ES as a NoSql database and need to retrieve docs by Id.

I think you can get the ID back in the IndexResponse object.
https://github.com/elasticsearch/elasticsearch/blob/master/modules/elasticsearch/src/main/java/org/elasticsearch/action/index/IndexResponse.java#L101

David :wink:

Le 3 nov. 2011 à 07:30, sam mishra.sameek@gmail.com a écrit :

Hi

I have doubt regarding setting document id manually or automatically.

1.what benefit we get from setting document id.

2.if it not set the it assign automatically which java method is help
to get the document id.

Thanks