# Not able to update mapping in template

**URL:** <https://discuss.elastic.co/t/not-able-to-update-mapping-in-template/147844>\
**Category:** Elasticsearch\
**Created:** [September 9, 2018, 5:34am UTC](https://discuss.elastic.co/t/not-able-to-update-mapping-in-template/147844 "2018-09-09T05:34:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nitin\_gupta](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@Nitin\_gupta](https://discuss.elastic.co/u/Nitin_gupta)\
**Post date:** [September 9, 2018, 5:34am UTC](https://discuss.elastic.co/t/not-able-to-update-mapping-in-template/147844/1 "2018-09-09T05:34:11Z")

</div>

Hi ,  
i recently installed 6.4 version . Uploaded few logs and new index got created .Now i want to use template .

When i am using below query to create template , only "_default_" mapping is updated but not the "doc"

**My template Query**  
PUT logstash-template-  
{  
"order" : 0,  
"index\_patterns" : [  
"logstash-template-"  
],  
"settings" : {  
"index" : {  
"number\_of\_shards" : "1",  
"codec" : "best\_compression"  
}  
},  
"mapping": {  
"doc": {  
"\_source": {  
"enabled": false  
},  
"properties": {  
"@timestamp": {  
"type": "date"  
},  
"@version": {  
"type": "keyword"  
},   
"var": {  
"norms": false,  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"ip": {  
"norms": false,  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"sessionId": {  
"norms": false,  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"type": {  
"norms": false,  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"userId": {  
"norms": false,  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"filename": {  
"norms": false,  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"writeBytes": {  
"type": "text",  
"norms": false,  
"fields": {  
"keyword": {  
"type": "long"  
}  
}  
},  
"readBytes": {  
"type": "text",  
"norms": false,  
"fields": {  
"keyword": {  
"type": "long"  
}  
}  
},  
"event": {  
"norms": false,  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"var2": {  
"norms": false,  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"beat": {  
"properties": {  
"hostname": {  
"type": "text",  
"norms": false,  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
},  
"name": {  
"type": "text",  
"norms": false,  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
},  
"version": {  
"type": "text",  
"norms": false,  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
}  
}  
},  
"geoip": {  
"dynamic": "true",  
"properties": {  
"ip": {  
"type": "ip"  
},  
"latitude": {  
"type": "half\_float"  
},  
"location": {  
"type": "geo\_point"  
},  
"longitude": {  
"type": "half\_float"  
}  
}  
},  
"host": {  
"properties": {  
"name": {  
"type": "text",  
"norms": false,  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
}  
}  
},  
"input": {  
"properties": {  
"type": {  
"type": "text",  
"norms": false,  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
}  
}  
},  
"message": {  
"type": "text",  
"norms": false  
},  
"offset": {  
"type": "long"  
},  
"prospector": {  
"properties": {  
"type": {  
"type": "text",  
"norms": false,  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
}  
}  
},  
"source": {  
"type": "text",  
"norms": false,  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"tags": {  
"type": "text",  
"norms": false,  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
}  
}  
},  
"_default_": {  
"dynamic\_templates": [  
{  
"message\_field": {  
"path\_match": "message",  
"match\_mapping\_type": "string",  
"mapping": {  
"norms": false,  
"type": "text"  
}  
}  
},  
{  
"string\_fields": {  
"match": "\*",  
"match\_mapping\_type": "string",  
"mapping": {  
"fields": {  
"keyword": {  
"ignore\_above": 256,  
"type": "keyword"  
}  
},  
"norms": false,  
"type": "text"  
}  
}  
}  
],  
"properties": {  
"@timestamp": {  
"type": "date"  
},  
"@version": {  
"type": "keyword"  
},  
"geoip": {  
"dynamic": "true",  
"properties": {  
"ip": {  
"type": "ip"  
},  
"latitude": {  
"type": "half\_float"  
},  
"location": {  
"type": "geo\_point"  
},  
"longitude": {  
"type": "half\_float"  
}  
}  
}  
}  
}  
},  
"aliases" : { }  
}

Regards Nitin

---

<div class="post-metadata">

**Author:** ![Nitin\_gupta](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@Nitin\_gupta](https://discuss.elastic.co/u/Nitin_gupta)\
**Post date:** [September 9, 2018, 5:34am UTC](https://discuss.elastic.co/t/not-able-to-update-mapping-in-template/147844/2 "2018-09-09T05:34:33Z")

</div>

**Template in system created after my query**  
GET logstash-template-  
{  
"logstash-template-":{  
"aliases":{

```
  },
  "mappings":{  
     "default":{  
        "dynamic_templates":[  
           {  
              "message_field":{  
                 "path_match":"message",
                 "match_mapping_type":"string",
                 "mapping":{  
                    "norms":false,
                    "type":"text"
                 }
              }
           },
           {  
              "string_fields":{  
                 "match":"*",
                 "match_mapping_type":"string",
                 "mapping":{  
                    "fields":{  
                       "keyword":{  
                          "ignore_above":256,
                          "type":"keyword"
                       }
                    },
                    "norms":false,
                    "type":"text"
                 }
              }
           }
        ],
        "properties":{  
           "@timestamp":{  
              "type":"date"
           },
           "@version":{  
              "type":"keyword"
           },
           "geoip":{  
              "dynamic":"true",
              "properties":{  
                 "ip":{  
                    "type":"ip"
                 },
                 "latitude":{  
                    "type":"half_float"
                 },
                 "location":{  
                    "type":"geo_point"
                 },
                 "longitude":{  
                    "type":"half_float"
                 }
              }
           }
        }
     }
  },
  "settings":{  
     "index":{  
        "codec":"best_compression",
        "refresh_interval":"5s",
        "number_of_shards":"1",
        "provided_name":"logstash-template-",
        "creation_date":"1536308233761",
        "number_of_replicas":"0",
        "uuid":"EnriugFrTS-999O0F1Hk_g",
        "version":{  
           "created":"6040099"
        }
     }
  }

```

}  
}

---

<div class="post-metadata">

**Author:** ![Nitin\_gupta](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@Nitin\_gupta](https://discuss.elastic.co/u/Nitin_gupta)\
**Post date:** [September 10, 2018, 6:40pm UTC](https://discuss.elastic.co/t/not-able-to-update-mapping-in-template/147844/3 "2018-09-10T18:40:15Z")

</div>

please help

---

<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:** [October 8, 2018, 6:40pm UTC](https://discuss.elastic.co/t/not-able-to-update-mapping-in-template/147844/4 "2018-10-08T18:40:24Z")

</div>

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