# How to build Mapping for all indexes and types in ES 5.2.0

**URL:** <https://discuss.elastic.co/t/how-to-build-mapping-for-all-indexes-and-types-in-es-5-2-0/75880>\
**Category:** Elasticsearch\
**Created:** [February 21, 2017, 1:03pm UTC](https://discuss.elastic.co/t/how-to-build-mapping-for-all-indexes-and-types-in-es-5-2-0/75880 "2017-02-21T13:03:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhishekash](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@abhishekash](https://discuss.elastic.co/u/abhishekash)\
**Post date:** [February 21, 2017, 1:03pm UTC](https://discuss.elastic.co/t/how-to-build-mapping-for-all-indexes-and-types-in-es-5-2-0/75880/1 "2017-02-21T13:03:47Z")

</div>

I understand how to build a mapping for any index and type. But, I want to have a field my\_field\_1 and my\_field\_2 which will not be analyzed for all the indexes and types that will be created in future.

PUT /address\_index  
{  
"mappings":{  
"address":{  
"properties":{  
"state":{  
"type":"string",  
"fields":{  
"raw":{  
"type":"string",  
"index":"not\_analyzed"  
}  
}  
}  
}  
}  
}  
}  
I also saw in one of the links on how to do for all the [_default_](http://stackoverflow.com/questions/36448941/how-to-have-not-analyzed-for-all-new-indexes-by-default). But, I am unable to add it for just the fields mentioned above.

I will be implementing this in Java. However, just DSL JSON would be good headstart.

Also, i am using java api BulKProcessor to add documents like :  
bulkProcessor.add(new IndexRequest(indexName, type, id).source(json));

Will it impact my index mapping created earlier ?

I had posted it in SO , but dint get a satifactory reply. Sorry for duplication though.

Thanks  
Abhishek.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 21, 2017, 11:16pm UTC](https://discuss.elastic.co/t/how-to-build-mapping-for-all-indexes-and-types-in-es-5-2-0/75880/2 "2017-02-21T23:16:02Z")

</div>

You need to setup a template with a priority of 0 🙂

---

<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:** [March 21, 2017, 11:16pm UTC](https://discuss.elastic.co/t/how-to-build-mapping-for-all-indexes-and-types-in-es-5-2-0/75880/3 "2017-03-21T23:16:31Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
