# Dynamic mapping stops at a field called "\_id"

**URL:** https://discuss.elastic.co/t/dynamic-mapping-stops-at-a-field-called--id/19589
**Category:** Elasticsearch
**Created:** [September 3, 2014, 10:12am UTC](https://discuss.elastic.co/t/dynamic-mapping-stops-at-a-field-called--id/19589 "2014-09-03T10:12:53Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Andre\_Hansel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andre_hansel/32/934_2.png) [@Andre\_Hansel](https://discuss.elastic.co/u/Andre_Hansel)
#### Post date: [September 3, 2014, 10:12am UTC](https://discuss.elastic.co/t/dynamic-mapping-stops-at-a-field-called--id/19589/1 "2014-09-03T10:12:53Z")

</div>

When indexing a document, when there is a field named "\_id" in the source,  
the fields that come after this one don't get added to the mapping, even  
though they are stored in the \_source:

PUT /megacorp/blah/3  
{  
"a": "b",  
"\_id" : {},  
"c": "d"  
}

The document got stored:

GET megacorp/blah/\_search  
{  
"took": 8,  
"timed\_out": false,  
"\_shards": {  
"total": 5,  
"successful": 5,  
"failed": 0  
},  
"hits": {  
"total": 1,  
"max\_score": 1,  
"hits": [  
{  
"\_index": "megacorp",  
"\_type": "blah",  
"\_id": "3",  
"\_score": 1,  
"\_source": {  
"a": "b",  
"\_id": {},  
"c": "d"  
}  
}  
]  
}  
}

But no mapping was added for "c":

GET /megacorp/\_mapping/blah  
{  
"megacorp": {  
"mappings": {  
"blah": {  
"properties": {  
"a": {  
"type": "string"  
}  
}  
}  
}  
}  
}

Is this expected behavior?

Regards,  
André

--  
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/4498c028-9013-479b-a8ee-c43b8edc277f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4498c028-9013-479b-a8ee-c43b8edc277f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)
#### Post date: [September 3, 2014, 11:59pm UTC](https://discuss.elastic.co/t/dynamic-mapping-stops-at-a-field-called--id/19589/2 "2014-09-03T23:59:00Z")

</div>

The \_id field is one of the few reserved field names in Elasticsearch:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

You can set it to whatever you want, as long as it is not an object or  
(empty) array, as in your case. I have no idea what the proper behavior  
should be when you try to index bad data to this field, but I am not  
surprised that there are issues.

--  
Ivan

On Wed, Sep 3, 2014 at 3:12 AM, André Hänsel [andre@webkr.de](mailto:andre@webkr.de) wrote:

> When indexing a document, when there is a field named "\_id" in the source,  
> the fields that come after this one don't get added to the mapping, even  
> though they are stored in the \_source:
> 
> PUT /megacorp/blah/3  
> {  
> "a": "b",  
> "\_id" : {},  
> "c": "d"  
> }
> 
> The document got stored:
> 
> GET megacorp/blah/\_search  
> {  
> "took": 8,  
> "timed\_out": false,  
> "\_shards": {  
> "total": 5,  
> "successful": 5,  
> "failed": 0  
> },  
> "hits": {  
> "total": 1,  
> "max\_score": 1,  
> "hits": [  
> {  
> "\_index": "megacorp",  
> "\_type": "blah",  
> "\_id": "3",  
> "\_score": 1,  
> "\_source": {  
> "a": "b",  
> "\_id": {},  
> "c": "d"  
> }  
> }  
> ]  
> }  
> }
> 
> But no mapping was added for "c":
> 
> GET /megacorp/\_mapping/blah  
> {  
> "megacorp": {  
> "mappings": {  
> "blah": {  
> "properties": {  
> "a": {  
> "type": "string"  
> }  
> }  
> }  
> }  
> }  
> }
> 
> Is this expected behavior?
> 
> Regards,  
> André
> 
> --  
> 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/4498c028-9013-479b-a8ee-c43b8edc277f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4498c028-9013-479b-a8ee-c43b8edc277f%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/4498c028-9013-479b-a8ee-c43b8edc277f%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/4498c028-9013-479b-a8ee-c43b8edc277f%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CALY%3DcQBGS4aHofD7cFmPs\_320SOZ3SBi-rVjpx6DHXgFu6i4-w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBGS4aHofD7cFmPs_320SOZ3SBi-rVjpx6DHXgFu6i4-w%40mail.gmail.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:04am UTC](https://discuss.elastic.co/t/dynamic-mapping-stops-at-a-field-called--id/19589/3 "2017-07-06T01:04:29Z")

</div>


