What is difference between document id and index id?


(Sam-4) #1

Hi

I have doubt regarding document id and index id:

1.both are same or both are different.

2.how to set the document id using java API.

Thanks


(Karussell) #2

When you create an index you'll need the name(==index id) or what do
you mean?

When you create a document you can specify the id:
client.prepareIndex("index", "type", "id")

or using bulk api:
BulkRequestBuilder brb = client.prepareBulk();
IndexRequest indexReq =
Requests.indexRequest("index").type("type").id("id").source(source);
brb.add(indexReq);

Peter.

On 3 Nov., 08:27, sam mishra.sam...@gmail.com wrote:

Hi

I have doubt regarding document id and index id:

1.both are same or both are different.

2.how to set the document id using java API.

Thanks


(system) #3