# How to define dynamic date formats in index template

**URL:** <https://discuss.elastic.co/t/how-to-define-dynamic-date-formats-in-index-template/186689>\
**Category:** Elasticsearch\
**Created:** [June 20, 2019, 12:55pm UTC](https://discuss.elastic.co/t/how-to-define-dynamic-date-formats-in-index-template/186689 "2019-06-20T12:55:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RamanGupta16](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramangupta16/32/46899_2.png) [@RamanGupta16](https://discuss.elastic.co/u/RamanGupta16)\
**Post date:** [June 20, 2019, 12:55pm UTC](https://discuss.elastic.co/t/how-to-define-dynamic-date-formats-in-index-template/186689/1 "2019-06-20T12:55:56Z")

</div>

I tried to customize the dynamic\_date\_formats as part of Index template in ElasticSearch version 6.7.2. But I am facing issues:-

```
PUT _template/template_1
{
  "index_patterns":"*",
  "version": 1,
  "mappings": {
    "dynamic_date_formats": ["yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z||dd/MM/yyyy||yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-ddTHH:mm:ss"]
  },
  "settings": {
    "number_of_shards": 5,
    "mapping.ignore_malformed": true
    }
}

```

## Error:

```
{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "Malformed [mappings] section for type [dynamic_date_formats], should include an inner object describing the mapping"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "Malformed [mappings] section for type [dynamic_date_formats], should include an inner object describing the mapping"
  },
  "status": 400
}
```

---

<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:** [July 18, 2019, 12:56pm UTC](https://discuss.elastic.co/t/how-to-define-dynamic-date-formats-in-index-template/186689/2 "2019-07-18T12:56:00Z")

</div>

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