# Dynamic template (key/value mapping)

**URL:** <https://discuss.elastic.co/t/dynamic-template-key-value-mapping/16258>\
**Category:** Elasticsearch\
**Created:** [March 10, 2014, 7:14am UTC](https://discuss.elastic.co/t/dynamic-template-key-value-mapping/16258 "2014-03-10T07:14:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Gulliksen](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@Michael\_Gulliksen](https://discuss.elastic.co/u/Michael_Gulliksen)\
**Post date:** [March 10, 2014, 7:14am UTC](https://discuss.elastic.co/t/dynamic-template-key-value-mapping/16258/1 "2014-03-10T07:14:00Z")

</div>

If i have a document like this:

document:  
{  
id:"11513",  
title:"this is the title"  
sections:  
[  
{  
value:"This is the headline",  
type:"headline"  
},  
{  
value:"This is the body",  
type:"body"  
},  
{  
value:"Some One",  
type:"author"  
}  
]  
}

is it possible using dynamic\_template so that the "type" under sections  
will become the field name for the "value"?  
e.g.  
document.sections.body:"this is the body"

If so how would the mapping look like?

--  
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/53ee5f97-08ee-462d-b217-776bfda9dd3f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/53ee5f97-08ee-462d-b217-776bfda9dd3f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [March 11, 2014, 12:02pm UTC](https://discuss.elastic.co/t/dynamic-template-key-value-mapping/16258/2 "2014-03-11T12:02:09Z")

</div>

No. You'd have to change the document before indexing it.

On 10 March 2014 08:14, Michael Gulliksen [michael.gulliksen@gmail.com](mailto:michael.gulliksen@gmail.com)wrote:

> If i have a document like this:
> 
> document:  
> {  
> id:"11513",  
> title:"this is the title"  
> sections:  
> [  
> {  
> value:"This is the headline",  
> type:"headline"  
> },  
> {  
> value:"This is the body",  
> type:"body"  
> },  
> {  
> value:"Some One",  
> type:"author"  
> }  
> ]  
> }
> 
> is it possible using dynamic\_template so that the "type" under sections  
> will become the field name for the "value"?  
> e.g.  
> document.sections.body:"this is the body"
> 
> If so how would the mapping look like?
> 
> --  
> 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/53ee5f97-08ee-462d-b217-776bfda9dd3f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/53ee5f97-08ee-462d-b217-776bfda9dd3f%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/53ee5f97-08ee-462d-b217-776bfda9dd3f%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/53ee5f97-08ee-462d-b217-776bfda9dd3f%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/CAPt3XKTGnWViDF0JEJERR42qHPomBYMAmGWMdR5Vnk2qY6dNzQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPt3XKTGnWViDF0JEJERR42qHPomBYMAmGWMdR5Vnk2qY6dNzQ%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:44am UTC](https://discuss.elastic.co/t/dynamic-template-key-value-mapping/16258/3 "2017-07-06T01:44:15Z")

</div>


