# Elasticsearch Define Dynamic Mapping

**URL:** <https://discuss.elastic.co/t/elasticsearch-define-dynamic-mapping/62583>\
**Category:** Elasticsearch\
**Created:** [October 9, 2016, 5:07pm UTC](https://discuss.elastic.co/t/elasticsearch-define-dynamic-mapping/62583 "2016-10-09T17:07:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sreeram](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@sreeram](https://discuss.elastic.co/u/sreeram)\
**Post date:** [October 9, 2016, 5:07pm UTC](https://discuss.elastic.co/t/elasticsearch-define-dynamic-mapping/62583/1 "2016-10-09T17:07:48Z")

</div>

Hi,

I'm using Elasticsearch 2.3.4 & [Elasticsearch.Net](http://Elasticsearch.Net) (Low-level client) SDK for indexing JSON documents which are dynamic in nature.

I want to create mapping for my JSON structure before indexing documents in order to avoid field type getting detected (numeric\_detection & date\_detection = True) wrongly while inserting the first document.

**How to PUT below mapping (JSON) through [Elasticsearch.Net](http://Elasticsearch.Net) Or NEST SDK API?!**  
PUT my\_index  
{  
"mappings": {  
"user": {  
"\_all": { "enabled": false },  
"properties": {  
"title": { "type": "string" },  
"name": { "type": "string" },  
"age": { "type": "integer" }  
}  
},  
"blogpost": {  
"properties": {  
"title": { "type": "string" },  
"body": { "type": "string" },  
"user\_id": {  
"type": "string",  
"index": "not\_analyzed"  
},  
"created": {  
"type": "date",  
"format": "strict\_date\_optional\_time||epoch\_millis"  
}  
}  
}  
}  
}

Regards,  
Sreeram

---

<div class="post-metadata">

**Author:** ![sreeram](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@sreeram](https://discuss.elastic.co/u/sreeram)\
**Post date:** [October 11, 2016, 3:14pm UTC](https://discuss.elastic.co/t/elasticsearch-define-dynamic-mapping/62583/3 "2016-10-11T15:14:52Z")

</div>

please provide some clarifications.

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [October 11, 2016, 3:25pm UTC](https://discuss.elastic.co/t/elasticsearch-define-dynamic-mapping/62583/4 "2016-10-11T15:25:30Z")

</div>

This question looks like [How to define mapping in runtime](https://discuss.elastic.co/t/how-to-define-mapping-in-runtime/62728), so I'll close it in favour of the other post.

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [October 11, 2016, 3:25pm UTC](https://discuss.elastic.co/t/elasticsearch-define-dynamic-mapping/62583/5 "2016-10-11T15:25:47Z")

</div>


