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

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?

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