# Mapping related question?

**URL:** <https://discuss.elastic.co/t/mapping-related-question/23820>\
**Category:** Elasticsearch\
**Created:** [June 17, 2015, 10:01am UTC](https://discuss.elastic.co/t/mapping-related-question/23820 "2015-06-17T10:01:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saket\_Kumar](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@Saket\_Kumar](https://discuss.elastic.co/u/Saket_Kumar)\
**Post date:** [June 17, 2015, 10:01am UTC](https://discuss.elastic.co/t/mapping-related-question/23820/1 "2015-06-17T10:01:54Z")

</div>

I have string field value such as "/worldrediff/style\_3\_16/home\_tile\_us\_18.css"  
when add aggregation on same field on bar chart, it splits like "/", "worldrediff", "style" etc.  
and shows different bars for each terms.

I read from blog to use {field}.raw in mapping and use index template and so

Question: When i define index template do in need to do mapping for each field or just the one which i would wish {field}.raw.

Can I use it in that way?

---

<div class="post-metadata">

**Author:** ![mkelkar](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@mkelkar](https://discuss.elastic.co/u/mkelkar)\
**Post date:** [June 17, 2015, 8:12pm UTC](https://discuss.elastic.co/t/mapping-related-question/23820/2 "2015-06-17T20:12:09Z")

</div>

what you need to do is update the field mapping to not\_analyzed for just the field that you are interested in, so it wouldn't split each term in the value.

for example, for a field name field1

```
"field1": {
 "type": "string",
  "fields": {
      "raw": {
            "type": "string",
            "index": "not_analyzed"
       }
   }
}

```

now the field "field1" would be analyzed, but "field.raw" would not be, which should work for your case.

Thanks,  
Madhav.

---

<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, 12:06am UTC](https://discuss.elastic.co/t/mapping-related-question/23820/3 "2017-07-06T00:06:56Z")

</div>


