# Dynamic templates

**URL:** <https://discuss.elastic.co/t/dynamic-templates/3780>\
**Category:** Elasticsearch\
**Created:** [January 15, 2011, 12:00am UTC](https://discuss.elastic.co/t/dynamic-templates/3780 "2011-01-15T00:00:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![searchersteve](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/searchersteve/32/3008_2.png) [@searchersteve](https://discuss.elastic.co/u/searchersteve)\
**Post date:** [January 15, 2011, 12:00am UTC](https://discuss.elastic.co/t/dynamic-templates/3780/1 "2011-01-15T00:00:09Z")

</div>

Trying to implement dynamic templating in my app, consulting ES docs [here](http://www.elasticsearch.com/docs/elasticsearch/mapping/root_object_type/#dynamic_templates). I'm not sure on what REST call I should be using. Should it be:

curl '[http://localhost:9200/twitter/tweets/\_dynamic\_templates](http://localhost:9200/twitter/tweets/_dynamic_templates)' -d '  
'{  
"person" : {  
"dynamic\_templates" : [  
{  
"template\_1" : {  
etcetera....

_Or_ should I be including the "dynamic\_templates" portion of the JSON in a standard mapping PUT:

'curl -XPUT '[http://localhost:9200/twitter/tweets/\_mapping](http://localhost:9200/twitter/tweets/_mapping)' -d '  
''{tweet:  
"person" : {  
"dynamic\_templates" : [  
{  
"template\_1" : {  
etcetera....

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 16, 2011, 9:36am UTC](https://discuss.elastic.co/t/dynamic-templates/3780/2 "2011-01-16T09:36:08Z")

</div>

It should be part of the mapping when you PUT it in elasticsearch using the put mapping API.  
On Saturday, January 15, 2011 at 2:00 AM, searchersteve wrote:

> Trying to implement dynamic templating in my app, consulting ES docs  
> [http://www.elasticsearch.com/docs/elasticsearch/mapping/root\_object\_type/#dynamic\_templates](http://www.elasticsearch.com/docs/elasticsearch/mapping/root_object_type/#dynamic_templates)  
> here . I'm not sure on what REST call I should be using. Should it be:
> 
> curl '[http://localhost:9200/twitter/tweets/\_dynamic\_templates](http://localhost:9200/twitter/tweets/_dynamic_templates)' -d '  
> '{  
> "person" : {  
> "dynamic\_templates" : [  
> {  
> "template\_1" : {  
> etcetera....
> 
> Or should I be including the "dynamic\_templates" portion of the JSON in a  
> standard mapping PUT:
> 
> 'curl -XPUT '[http://localhost:9200/twitter/tweets/\_mapping](http://localhost:9200/twitter/tweets/_mapping)' -d '  
> ''{tweet:  
> "person" : {  
> "dynamic\_templates" : [  
> {  
> "template\_1" : {  
> etcetera....
> 
> --  
> View this message in context: [http://elasticsearch-users.115913.n3.nabble.com/Dynamic-templates-tp2259254p2259254.html](http://elasticsearch-users.115913.n3.nabble.com/Dynamic-templates-tp2259254p2259254.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<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, 4:13am UTC](https://discuss.elastic.co/t/dynamic-templates/3780/3 "2017-07-06T04:13:51Z")

</div>


