# Storing auto generated \_id under different name

**URL:** <https://discuss.elastic.co/t/storing-auto-generated--id-under-different-name/18164>\
**Category:** Elasticsearch\
**Created:** [June 17, 2014, 6:16pm UTC](https://discuss.elastic.co/t/storing-auto-generated--id-under-different-name/18164 "2014-06-17T18:16:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johny\_Lam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johny_lam/32/1487_2.png) [@Johny\_Lam](https://discuss.elastic.co/u/Johny_Lam)\
**Post date:** [June 17, 2014, 6:16pm UTC](https://discuss.elastic.co/t/storing-auto-generated--id-under-different-name/18164/1 "2014-06-17T18:16:39Z")

</div>

Is it possible to have the \_id be auto-generated and store it so that it's  
in the \_source field under a different name, like say "id" instead of "\_id"?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/1eb03930-64c8-44ac-9f69-7ad2ff6b563e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1eb03930-64c8-44ac-9f69-7ad2ff6b563e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [June 17, 2014, 11:25pm UTC](https://discuss.elastic.co/t/storing-auto-generated--id-under-different-name/18164/2 "2014-06-17T23:25:11Z")

</div>

No, it isn't possible.

Why would you like to have the id of the document included in \_source?

On Tue, Jun 17, 2014 at 8:16 PM, Johny Lam [johny.lam@gmail.com](mailto:johny.lam@gmail.com) wrote:

> Is it possible to have the \_id be auto-generated and store it so that it's  
> in the \_source field under a different name, like say "id" instead of "\_id"?
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/1eb03930-64c8-44ac-9f69-7ad2ff6b563e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1eb03930-64c8-44ac-9f69-7ad2ff6b563e%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/1eb03930-64c8-44ac-9f69-7ad2ff6b563e%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/1eb03930-64c8-44ac-9f69-7ad2ff6b563e%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Adrien Grand

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j4bXnVGEmu%3D6Qwz3fgaZKvDOJicGqLLf1VakX%3Dpq6oFvw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j4bXnVGEmu%3D6Qwz3fgaZKvDOJicGqLLf1VakX%3Dpq6oFvw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Johny\_Lam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johny_lam/32/1487_2.png) [@Johny\_Lam](https://discuss.elastic.co/u/Johny_Lam)\
**Post date:** [June 17, 2014, 11:34pm UTC](https://discuss.elastic.co/t/storing-auto-generated--id-under-different-name/18164/3 "2014-06-17T23:34:23Z")

</div>

I'm using elasticsearch as the database for a service. It would make things  
easier. For example, I could just return the \_source field when other apps  
query my service. Related to that is that on the javascript client side, I  
am inserting the \_id field into the \_source JSON object as "id" and using  
that as the model for two way data-binding. If the id field was in the  
source already, I wouldn't have to keep track of this.

On Tuesday, June 17, 2014 4:26:07 PM UTC-7, Adrien Grand wrote:

> No, it isn't possible.
> 
> Why would you like to have the id of the document included in \_source?
> 
> On Tue, Jun 17, 2014 at 8:16 PM, Johny Lam \<[john...@gmail.com](mailto:john...@gmail.com)  
> \<javascript:\>\> wrote:
> 
> > Is it possible to have the \_id be auto-generated and store it so that  
> > it's in the \_source field under a different name, like say "id" instead of  
> > "\_id"?
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/1eb03930-64c8-44ac-9f69-7ad2ff6b563e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1eb03930-64c8-44ac-9f69-7ad2ff6b563e%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/1eb03930-64c8-44ac-9f69-7ad2ff6b563e%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/1eb03930-64c8-44ac-9f69-7ad2ff6b563e%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Adrien Grand

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a1b9d878-47cc-4e06-ae02-0b32375cf3bc%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a1b9d878-47cc-4e06-ae02-0b32375cf3bc%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:21am UTC](https://discuss.elastic.co/t/storing-auto-generated--id-under-different-name/18164/4 "2017-07-06T01:21:40Z")

</div>


