# A problem with \_id in the mapping

**URL:** https://discuss.elastic.co/t/a-problem-with--id-in-the-mapping/12728
**Category:** Elasticsearch
**Created:** [July 9, 2013, 8:43pm UTC](https://discuss.elastic.co/t/a-problem-with--id-in-the-mapping/12728 "2013-07-09T20:43:21Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Zhoutuo\_Yang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zhoutuo_yang/32/2211_2.png) [@Zhoutuo\_Yang](https://discuss.elastic.co/u/Zhoutuo_Yang)
#### Post date: [July 9, 2013, 8:43pm UTC](https://discuss.elastic.co/t/a-problem-with--id-in-the-mapping/12728/1 "2013-07-09T20:43:21Z")

</div>

Hi folks,  
I'm having trouble with \_id field.  
I use path to referring another field in the document for the id. Like  
"\_id": {  
"path": "myId"  
}.  
The problem is the elasticsearch seems to reject the document with the same  
"myId" which will become the "\_id" after indexing.  
Isn't the overwriting a more nature way instead of rejecting?  
BTW, I'm feeding docs using logstash with elasticsearch\_http  
Thank you.

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)
#### Post date: [July 10, 2013, 8:16am UTC](https://discuss.elastic.co/t/a-problem-with--id-in-the-mapping/12728/2 "2013-07-10T08:16:22Z")

</div>

Hello,

I can't reproduce this issue, unless I specifically say to "create"  
documents instead of "index". Here's a gist:

> <https://gist.github.com/radu-gheorghe/5964376>

Can you provide a gist where the problem is recreated? Also, what versions  
of ES and logstash are you using?

Best regards,  
Radu

On Tue, Jul 9, 2013 at 11:43 PM, Zhoutuo Yang [zhoutuoy@gmail.com](mailto:zhoutuoy@gmail.com) wrote:

> Hi folks,  
> I'm having trouble with \_id field.  
> I use path to referring another field in the document for the id. Like  
> "\_id": {  
> "path": "myId"  
> }.  
> The problem is the elasticsearch seems to reject the document with the  
> same "myId" which will become the "\_id" after indexing.  
> Isn't the overwriting a more nature way instead of rejecting?  
> BTW, I'm feeding docs using logstash with elasticsearch\_http  
> Thank you.
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
[http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Zhoutuo\_Yang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zhoutuo_yang/32/2211_2.png) [@Zhoutuo\_Yang](https://discuss.elastic.co/u/Zhoutuo_Yang)
#### Post date: [July 10, 2013, 5:16pm UTC](https://discuss.elastic.co/t/a-problem-with--id-in-the-mapping/12728/3 "2013-07-10T17:16:48Z")

</div>

Hi,  
Thank you for replying, I found that it is a logstash issue. The plugin  
elasticsearch\_http is unstable somehow.  
I pulled it out, made it my own plugin with the same source code, it all  
worked.  
Version of logstash: 1.1.13, ES: 0.90.1  
BTW, the exception was also thrown by logstash not ES

On Wed, Jul 10, 2013 at 1:16 AM, Radu Gheorghe  
[radu.gheorghe@sematext.com](mailto:radu.gheorghe@sematext.com)wrote:

> Hello,
> 
> I can't reproduce this issue, unless I specifically say to "create"  
> documents instead of "index". Here's a gist:  
> [Elasticsearch: If you create a mapping with the ID field pointing to a certain path, inserting two docs with the same ID should overwrite, instead of throwing an error. Unless you specify to "create" documents · GitHub](https://gist.github.com/radu-gheorghe/5964376)
> 
> Can you provide a gist where the problem is recreated? Also, what versions  
> of ES and logstash are you using?
> 
> Best regards,  
> Radu
> 
> On Tue, Jul 9, 2013 at 11:43 PM, Zhoutuo Yang [zhoutuoy@gmail.com](mailto:zhoutuoy@gmail.com) wrote:
> 
> > Hi folks,  
> > I'm having trouble with \_id field.  
> > I use path to referring another field in the document for the id. Like  
> > "\_id": {  
> > "path": "myId"  
> > }.  
> > The problem is the elasticsearch seems to reject the document with the  
> > same "myId" which will become the "\_id" after indexing.  
> > Isn't the overwriting a more nature way instead of rejecting?  
> > BTW, I'm feeding docs using logstash with elasticsearch\_http  
> > Thank you.
> > 
> > --  
> > 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).
> > 
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/LUXCx4i6W5g/unsubscribe](https://groups.google.com/d/topic/elasticsearch/LUXCx4i6W5g/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:27am UTC](https://discuss.elastic.co/t/a-problem-with--id-in-the-mapping/12728/4 "2017-07-06T02:27:06Z")

</div>


