# How to use custom ID for inserting document using java sdk

**URL:** <https://discuss.elastic.co/t/how-to-use-custom-id-for-inserting-document-using-java-sdk/321380>\
**Category:** Elasticsearch\
**Created:** [December 16, 2022, 7:19am UTC](https://discuss.elastic.co/t/how-to-use-custom-id-for-inserting-document-using-java-sdk/321380 "2022-12-16T07:19:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![suresh\_chaudhari](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suresh_chaudhari/32/106602_2.png) [@suresh\_chaudhari](https://discuss.elastic.co/u/suresh_chaudhari)\
**Post date:** [December 16, 2022, 7:19am UTC](https://discuss.elastic.co/t/how-to-use-custom-id-for-inserting-document-using-java-sdk/321380/1 "2022-12-16T07:19:21Z")

</div>

Hi  
I want to use java sdk to insert document using ID .I will have custom my own IDs to insert docs.  
Thanks  
Suresh

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [December 16, 2022, 7:44am UTC](https://discuss.elastic.co/t/how-to-use-custom-id-for-inserting-document-using-java-sdk/321380/2 "2022-12-16T07:44:32Z")

</div>

Have you looked at the documentation? As far as I can see it contains at least [one example](https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/8.5/indexing-bulk.html) of creating documents with custom ID. It would generally help if you provided information about exactly which client and version you are using as well as what you have tried so far.

---

<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:** [January 13, 2023, 7:44am UTC](https://discuss.elastic.co/t/how-to-use-custom-id-for-inserting-document-using-java-sdk/321380/3 "2023-01-13T07:44:56Z")

</div>

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