# Customize field name in dynamic template

**URL:** <https://discuss.elastic.co/t/customize-field-name-in-dynamic-template/17553>\
**Category:** Elasticsearch\
**Created:** [May 16, 2014, 12:24pm UTC](https://discuss.elastic.co/t/customize-field-name-in-dynamic-template/17553 "2014-05-16T12:24:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dionysus1016](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@Dionysus1016](https://discuss.elastic.co/u/Dionysus1016)\
**Post date:** [May 16, 2014, 12:24pm UTC](https://discuss.elastic.co/t/customize-field-name-in-dynamic-template/17553/1 "2014-05-16T12:24:30Z")

</div>

Hi All,

Can I customize filed name in dynamic template? For example, I have  
fields like "twitter\_title", "twitter\_body","blog\_title","blog\_body" , and  
there could be more fields with format "xxx\_title","xxx\_body" which are  
added from front-end, then I want mapping "twitter\_title" and  
"twitter\_body"to field “twitter”, mapping "xxx\_title" and "xxx\_body" to  
"xxx", are there any way for this kind of mapping?

I find there are some sample dynamic templates which append string to field  
name, but I request to truncate field name..., here is sample to append  
string to field name.

dynamic\_templates" : [  
{  
"string\_template" : {  
"match" : "\*",  
"match\_mapping\_type" : "string",  
"mapping" : {  
"type" : "multi\_field",  
"fields" : {  
"{name}" : {"type": "string", "index" :  
"analyzed", "analyzer" : "default", "store" : "false"},  
"untouched" : {"type": "string", "index" :  
"analyzed", "analyzer" : "default", "store" : "false"}

```
               }
           }
       }
     }                                                         
   ]

```

Thanks!  
Jun

--  
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/fb065b1b-b923-436f-8392-cf9bae6529bd%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/fb065b1b-b923-436f-8392-cf9bae6529bd%40googlegroups.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:28am UTC](https://discuss.elastic.co/t/customize-field-name-in-dynamic-template/17553/2 "2017-07-06T01:28:56Z")

</div>


