# Template mapping not working

**URL:** https://discuss.elastic.co/t/template-mapping-not-working/234015
**Category:** Elasticsearch
**Created:** [May 23, 2020, 6:04pm UTC](https://discuss.elastic.co/t/template-mapping-not-working/234015 "2020-05-23T18:04:52Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![psteh](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@psteh](https://discuss.elastic.co/u/psteh)
#### Post date: [May 23, 2020, 6:04pm UTC](https://discuss.elastic.co/t/template-mapping-not-working/234015/1 "2020-05-23T18:04:52Z")

</div>

I am streaming logs from AWS CloudWatch to AWS Elasticsearch Service  
Currently I have template with mappings set as below:-

```auto
PUT _template/template
{
  "index_patterns": ["cwl*"],
  "order" : 0,
  "settings": {
    "number_of_shards": 1
  },
  "mappings": {
    "properties": {
  		"properties.bindings.1": {
  			"type": "text",
  			"fields": {
  				"keyword": {
  					"type": "keyword",
  					"ignore_above": 256
  				}
  			}
  		},
  		"properties.bindings.2": {
  			"type": "text",
  			"fields": {
  				"keyword": {
  					"type": "keyword",
  					"ignore_above": 256
  				}
  			}
  		},
  		"properties.bindings.3": {
  			"type": "text",
  			"fields": {
  				"keyword": {
  					"type": "keyword",
  					"ignore_above": 256
  				}
  			}
  		},
  		"properties.bindings.4": {
  			"type": "text",
  			"fields": {
  				"keyword": {
  					"type": "keyword",
  					"ignore_above": 256
  				}
  			}
  		},
  		"properties.bindings.5": {
  			"type": "text",
  			"fields": {
  				"keyword": {
  					"type": "keyword",
  					"ignore_above": 256
  				}
  			}
  		}
    }
  }
}

```

At Kibana, I found out there are conflicts

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/3/3/33853c0b70632f8ac21111ef585c6ec481592c5c.png)

How do I force it to convert fields to `Text` type?

---

<div class="post-metadata">

### Author: ![KoettingSimon](https://avatars.discourse-cdn.com/v4/letter/k/ba9def/32.png) [@KoettingSimon](https://discuss.elastic.co/u/KoettingSimon)
#### Post date: [May 23, 2020, 6:28pm UTC](https://discuss.elastic.co/t/template-mapping-not-working/234015/2 "2020-05-23T18:28:16Z")

</div>

When did you created the template?  
The template only takes affect on the creation of an index, as you cannot change the mapping of an existing index.

You could create a new index for the cwl-2020.02.12 with the correct mapping and reindex the data.

---

<div class="post-metadata">

### Author: ![psteh](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@psteh](https://discuss.elastic.co/u/psteh)
#### Post date: [May 23, 2020, 6:36pm UTC](https://discuss.elastic.co/t/template-mapping-not-working/234015/3 "2020-05-23T18:36:11Z")

</div>

It is before indexing of data.

Tried to:-

1. delete index
2. delete template
3. PUT template
4. re-index my data again

still gives same result.

---

<div class="post-metadata">

### Author: ![KoettingSimon](https://avatars.discourse-cdn.com/v4/letter/k/ba9def/32.png) [@KoettingSimon](https://discuss.elastic.co/u/KoettingSimon)
#### Post date: [May 23, 2020, 6:44pm UTC](https://discuss.elastic.co/t/template-mapping-not-working/234015/4 "2020-05-23T18:44:22Z")

</div>

Which field causes the conflict? Is it a field explicitly defined in the mapping?

---

<div class="post-metadata">

### Author: ![psteh](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@psteh](https://discuss.elastic.co/u/psteh)
#### Post date: [May 23, 2020, 6:49pm UTC](https://discuss.elastic.co/t/template-mapping-not-working/234015/5 "2020-05-23T18:49:34Z")

</div>

```auto
"properties.bindings.5": {
  			"type": "text",
  			"fields": {
  				"keyword": {
  					"type": "keyword",
  					"ignore_above": 256
  				}
  			}
  		}

```

this field, it is defined in the template mapping.

---

<div class="post-metadata">

### Author: ![KoettingSimon](https://avatars.discourse-cdn.com/v4/letter/k/ba9def/32.png) [@KoettingSimon](https://discuss.elastic.co/u/KoettingSimon)
#### Post date: [May 23, 2020, 6:53pm UTC](https://discuss.elastic.co/t/template-mapping-not-working/234015/6 "2020-05-23T18:53:46Z")

</div>

Could you please share the mapping of the 02.12-index and the 02.11-index.

---

<div class="post-metadata">

### Author: ![psteh](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@psteh](https://discuss.elastic.co/u/psteh)
#### Post date: [May 23, 2020, 7:01pm UTC](https://discuss.elastic.co/t/template-mapping-not-working/234015/7 "2020-05-23T19:01:15Z")

</div>

I have removed mapping for some fields cause it would be very long and it over the characters limit.

```auto
{
  "cwl-2020.02.11" : {
    "mappings" : {
      "properties" : {
        "properties" : {
          "properties" : {
            "bindings" : {
              "properties" : {
                "0" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "1" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "10" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "11" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "12" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "13" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "14" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "15" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "16" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "17" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "18" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "19" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "2" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "20" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "3" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "4" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "5" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "6" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "7" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "8" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "9" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

```

```auto
{
  "cwl-2020.02.12" : {
    "mappings" : {
      "properties" : {
        "properties" : {
          "properties" : {
            "bindings" : {
              "properties" : {
                "0" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "1" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "10" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "11" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "12" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "13" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "14" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "15" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "16" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "17" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "18" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "19" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "2" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "20" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "3" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "4" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "5" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "6" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "7" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "8" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                },
                "9" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

### Author: ![KoettingSimon](https://avatars.discourse-cdn.com/v4/letter/k/ba9def/32.png) [@KoettingSimon](https://discuss.elastic.co/u/KoettingSimon)
#### Post date: [May 23, 2020, 7:37pm UTC](https://discuss.elastic.co/t/template-mapping-not-working/234015/9 "2020-05-23T19:37:10Z")

</div>

Thats strange, are you sure its the properties.bindings.5 field?  
In both indices this field is mapped as text.  
Have you tried to refresh the kibana index pattern?

---

<div class="post-metadata">

### Author: ![psteh](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@psteh](https://discuss.elastic.co/u/psteh)
#### Post date: [May 24, 2020, 3:12am UTC](https://discuss.elastic.co/t/template-mapping-not-working/234015/10 "2020-05-24T03:12:53Z")

</div>

Sorry for late reply

Attach here is the screenshot of the index mapping at Kibana  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/9/c998013ecb968dc245af4c2473a093aceca39b0b.png)

I tried refreshing the index. Seems solved my problem.  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/6/56edd004a2cfbbf4e47d048482b0219f268c9a0d.png)

Thanks for your 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: [June 21, 2020, 3:12am UTC](https://discuss.elastic.co/t/template-mapping-not-working/234015/11 "2020-06-21T03:12:55Z")

</div>

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