# Automatic id generation on bulk create

**URL:** <https://discuss.elastic.co/t/automatic-id-generation-on-bulk-create/5599>\
**Category:** Elasticsearch\
**Created:** [October 14, 2011, 9:36am UTC](https://discuss.elastic.co/t/automatic-id-generation-on-bulk-create/5599 "2011-10-14T09:36:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael\_2](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@michael\_2](https://discuss.elastic.co/u/michael_2)\
**Post date:** [October 14, 2011, 9:36am UTC](https://discuss.elastic.co/t/automatic-id-generation-on-bulk-create/5599/1 "2011-10-14T09:36:23Z")

</div>

Is it possible to have automatic id generation on bulk create?  
What is the syntax? Leaving out the \_id?

{ "create" : { "\_index" : "test", "\_type" : "type1"} }  
{ "field1" : "value3" }

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [October 14, 2011, 12:35pm UTC](https://discuss.elastic.co/t/automatic-id-generation-on-bulk-create/5599/2 "2011-10-14T12:35:08Z")

</div>

Yep, this should work.

On Fri, Oct 14, 2011 at 11:36 AM, michael [michael.javaone@gmail.com](mailto:michael.javaone@gmail.com) wrote:

> Is it possible to have automatic id generation on bulk create?  
> What is the syntax? Leaving out the \_id?
> 
> { "create" : { "\_index" : "test", "\_type" : "type1"} }  
> { "field1" : "value3" }

---

<div class="post-metadata">

**Author:** ![Gurram\_Vinay](https://avatars.discourse-cdn.com/v4/letter/g/85e7bf/32.png) [@Gurram\_Vinay](https://discuss.elastic.co/u/Gurram_Vinay)\
**Post date:** [March 2, 2017, 11:48am UTC](https://discuss.elastic.co/t/automatic-id-generation-on-bulk-create/5599/3 "2017-03-02T11:48:01Z")

</div>

Hello ,  
I have a doubt at "index,type,id" for elastic search. I had a data and converted in json and seen code below like "index,type,id" of each&every data. How can I actually do it? I've checked some tutorials and could not understand.

Ex:{ "index" : { "index" : "pokedex", "type" : "pokemon", "\_id" : "1" } }  
{ "ndex": 1, "name": "Bulbasaur" }  
{ "index" : { "index" : "pokedex", "type" : "pokemon", "\_id" : "2" } }  
{ "ndex": 2, "name": "Ivysaur" }  
{ "index" : { "index" : "pokedex", "type" : "pokemon", "\_id" : "3" } }  
{ "ndex": 3, "name": "Venusaur"}

How did we take or automated this format like { "index" : { "index" : "pokedex", "type" : "pokemon", "\_id" : "1" } }, here "id" will change everytime along with the data.  
Thanks, advance.

---

<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:** [March 2, 2017, 12:12pm UTC](https://discuss.elastic.co/t/automatic-id-generation-on-bulk-create/5599/4 "2017-03-02T12:12:14Z")

</div>

Please open a new thread of your own rather than commenting on a thread that is 5 years old.

---

<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:** [July 5, 2017, 10:02pm UTC](https://discuss.elastic.co/t/automatic-id-generation-on-bulk-create/5599/5 "2017-07-05T22:02:43Z")

</div>


