# Elasticsearch mapping select all fields via template to change the data type

**URL:** <https://discuss.elastic.co/t/elasticsearch-mapping-select-all-fields-via-template-to-change-the-data-type/68177>\
**Category:** Elasticsearch\
**Created:** [December 6, 2016, 1:56pm UTC](https://discuss.elastic.co/t/elasticsearch-mapping-select-all-fields-via-template-to-change-the-data-type/68177 "2016-12-06T13:56:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrunalgosar](https://avatars.discourse-cdn.com/v4/letter/m/eada6e/32.png) [@mrunalgosar](https://discuss.elastic.co/u/mrunalgosar)\
**Post date:** [December 6, 2016, 1:56pm UTC](https://discuss.elastic.co/t/elasticsearch-mapping-select-all-fields-via-template-to-change-the-data-type/68177/1 "2016-12-06T13:56:50Z")

</div>

Hi All I am using elasticsearch-template.json to set data type of all of my fields to string. Below is the snippet of the template:

> ```
> {
> "template": "logstash-*",
> "settings": {
> "index.refresh_interval": "5s",
> "number_of_shards": 1,
> "number_of_replicas": 0
> },
> "mappings": {
> "logs": {
> "_all": {
> "enabled": true
> },
> "properties": {
> "level1": {
> "properties": {
> "level2": {
> "properties": {
> "_all": {"type": "string"}
> }
> }
> }
> }
> }
> }
> }
> }
> 
> ```

Here under level2 i have got lots of fields which get created i want to set all of them to string how can i set it. I have tried "\*" character as well as "%" character to select all the fields. but unfortunately it only gets added as a new field to the mapping. How to specify in template to select all the fields under a certain level?

---

<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:** [January 3, 2017, 1:57pm UTC](https://discuss.elastic.co/t/elasticsearch-mapping-select-all-fields-via-template-to-change-the-data-type/68177/2 "2017-01-03T13:57:04Z")

</div>

Closed on January 3, 2017, 1:57pm UTC

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