# Mapping template for one raw field

**URL:** <https://discuss.elastic.co/t/mapping-template-for-one-raw-field/61243>\
**Category:** Elasticsearch\
**Created:** [September 22, 2016, 11:19am UTC](https://discuss.elastic.co/t/mapping-template-for-one-raw-field/61243 "2016-09-22T11:19:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![misiekzet](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@misiekzet](https://discuss.elastic.co/u/misiekzet)\
**Post date:** [September 22, 2016, 11:19am UTC](https://discuss.elastic.co/t/mapping-template-for-one-raw-field/61243/1 "2016-09-22T11:19:51Z")

</div>

Hi,

I want to create mapping template for my index - lets name it testindex-\*  
The main goal is to create raw field with not\_analyzed value for ONE field.  
Rest of the fields i want to create by sending them by logstash without mapping tamplete for them. How can I do that? PLEASE help ☹

---

<div class="post-metadata">

**Author:** ![misiekzet](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@misiekzet](https://discuss.elastic.co/u/misiekzet)\
**Post date:** [September 22, 2016, 4:50pm UTC](https://discuss.elastic.co/t/mapping-template-for-one-raw-field/61243/2 "2016-09-22T16:50:04Z")

</div>

Ok. I got it:

curl -XPUT 'localhost:9200/\_template/template\_1?pretty' -d'  
{  
"template" : "testindex-\*",  
"mappings" : {  
"_default_" : {  
"dynamic\_templates" : [  
{  
"string\_fields" : {  
"match" : "name\_of\_field",  
"mapping" : {  
"type" : "string", "index" : "analyzed",  
"fields" : {  
"raw" : {"type": "string", "index" : "not\_analyzed"}  
}  
}  
}  
}]  
}  
}  
}'

---

<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 5, 2017, 10:18pm UTC](https://discuss.elastic.co/t/mapping-template-for-one-raw-field/61243/3 "2017-07-05T22:18:03Z")

</div>


