# Default mapping does not get triggered on first request

**URL:** <https://discuss.elastic.co/t/default-mapping-does-not-get-triggered-on-first-request/8601>\
**Category:** Elasticsearch\
**Created:** [August 1, 2012, 9:52pm UTC](https://discuss.elastic.co/t/default-mapping-does-not-get-triggered-on-first-request/8601 "2012-08-01T21:52:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yadu](https://avatars.discourse-cdn.com/v4/letter/y/e95f7d/32.png) [@Yadu](https://discuss.elastic.co/u/Yadu)\
**Post date:** [August 1, 2012, 9:52pm UTC](https://discuss.elastic.co/t/default-mapping-does-not-get-triggered-on-first-request/8601/1 "2012-08-01T21:52:58Z")

</div>

Default mapping does not get triggered on very first request but works well  
on second request onwards.

Please find complete set of operation on this gist:

> <https://gist.github.com/yadu/3230779>

For quick reference:

{  
"_default_" : {  
"\_id" : {  
"path" : "item.@id",  
"index": "not\_analyzed",  
"store" : "yes"  
}  
}  
}

I put this default mapping to index.mapper.default\_mapping\_location: /default-mapping.json. Then created test index

curl -XPOST '[http://localhost:9200/test](http://localhost:9200/test)' -d '{}'

Response:  
{  
"ok": true,  
"acknowledged": true  
}

Tried to add content to article type

curl -XPOST '[http://localhost:9200/test/article](http://localhost:9200/test/article)' -d '  
{  
"item": {  
"@id": "26883238",  
"@name": "yankees vs redsox"  
}  
}  
'

Response:  
{  
"ok": true,  
"\_index": "test",  
"\_type": "article",  
"\_id": "DWXgRADCSNqk36faFx3ICg",  
"\_version": 1  
}

Posted same item again and I got response as expected with correct Id (extracted from content)

{  
"ok": true,  
"\_index": "test",  
"\_type": "article",  
"\_id": "26883238",  
"\_version": 1  
}

So my question is, why the id was not picked up on very first attempt?

This resulted in two copies of the same item, one with auto generated id and other with id extracted from content.

Appreciate your help!

Thanks  
Yadu

---

<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, 3:18am UTC](https://discuss.elastic.co/t/default-mapping-does-not-get-triggered-on-first-request/8601/2 "2017-07-06T03:18:05Z")

</div>

Closed on July 6, 2017, 3:18am UTC


