# Get generated document ID when using bulk index

**URL:** <https://discuss.elastic.co/t/get-generated-document-id-when-using-bulk-index/154520>\
**Category:** Elasticsearch\
**Created:** [October 29, 2018, 9:22pm UTC](https://discuss.elastic.co/t/get-generated-document-id-when-using-bulk-index/154520 "2018-10-29T21:22:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![robertvoit](https://avatars.discourse-cdn.com/v4/letter/r/d07c76/32.png) [@robertvoit](https://discuss.elastic.co/u/robertvoit)\
**Post date:** [October 29, 2018, 9:22pm UTC](https://discuss.elastic.co/t/get-generated-document-id-when-using-bulk-index/154520/1 "2018-10-29T21:22:18Z")

</div>

I am using the java high level rest client to do a bulk index of a few million documents from an existing application with data from oracle sql. Each document has it's own primary Id. I am indexing the documents into elastic search and letting ES generate it's own document Ids for optimal spacial locality. I need to create a lookup table in oracle that will map the ES document Id to the primary Id in the sql database.

Is there a way to use the bulk-response of an indexing operation to get the generated ES document Ids so that I can map them to their corresponding oracle primary keys?

Thanks for the help!

---

<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:** [October 29, 2018, 9:37pm UTC](https://discuss.elastic.co/t/get-generated-document-id-when-using-bulk-index/154520/2 "2018-10-29T21:37:05Z")

</div>

I'd use the Oracle Id as the elasticsearch document id.

---

<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:** [November 26, 2018, 9:37pm UTC](https://discuss.elastic.co/t/get-generated-document-id-when-using-bulk-index/154520/3 "2018-11-26T21:37:05Z")

</div>

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