# Problem with date format Mapping

**URL:** https://discuss.elastic.co/t/problem-with-date-format-mapping/13996
**Category:** Elasticsearch
**Created:** [October 17, 2013, 4:10pm UTC](https://discuss.elastic.co/t/problem-with-date-format-mapping/13996 "2013-10-17T16:10:11Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![inaramb](https://avatars.discourse-cdn.com/v4/letter/i/d26b3c/32.png) [@inaramb](https://discuss.elastic.co/u/inaramb)
#### Post date: [October 17, 2013, 4:10pm UTC](https://discuss.elastic.co/t/problem-with-date-format-mapping/13996/1 "2013-10-17T16:10:11Z")

</div>

I show this error when I try to index timeStamp:

[2013-10-17 18:03:50,442][DEBUG][action.index] [Nodo\_4] [201310][4], node[gAsHZ-efQjiFyqvFUCY3fw], [P], s[STARTED]: Failed to execute [index {[201310][navegacion][IMOR80MKR0uKubGU0W4d6w], source[{  
"ip\_origen": "10.7.2.75",  
"campo2": "-",  
"campo4": "[http://www.libertaddigital.com/](http://www.libertaddigital.com/)",  
"campo6": "-",  
"cs-bytes": 859,  
"content-type": "text/html",  
"host": "[www.libertaddigital.com](http://www.libertaddigital.com)",  
"method":"GET",  
"port":80,  
"referer":"10.7.2.68",  
"uri-path":"/espana/2013-10-15/el-ayuntamiento-de-barcelona-censura-la-foto-del-torero-padilla-para-promocionar-una-exposicion-1276501875/",  
"uri-query":"-",  
"uri-scheme":"http",  
"user-agent":"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)",  
"event-date":"2013-10-16 10:00:00",  
"instance":"cacheint3",  
"sc-bytes":59634,  
"filter-category":"News/Media",  
"filter-result":"OBSERVED",  
"status":200  
}]}]  
org.elasticsearch.index.mapper.MapperParsingException: failed to parse [event-date]  
at org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:396)  
at org.elasticsearch.index.mapper.multifield.MultiFieldMapper.parse(MultiFieldMapper.java:207)  
at org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:614)  
at org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:467)  
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:508)  
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:452)  
at org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:341)  
at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:203)  
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:533)  
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:418)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
at java.lang.Thread.run(Unknown Source)  
Caused by: org.elasticsearch.index.mapper.MapperParsingException: failed to parse date field [2013-10-16 10:00:00], tried both date format [dateOptionalTime], and timestamp number with locale [null]  
at org.elasticsearch.index.mapper.core.DateFieldMapper.parseStringValue(DateFieldMapper.java:465)  
at org.elasticsearch.index.mapper.core.DateFieldMapper.innerParseCreateField(DateFieldMapper.java:413)  
at org.elasticsearch.index.mapper.core.NumberFieldMapper.parseCreateField(NumberFieldMapper.java:188)  
at org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:385)  
... 12 more  
Caused by: java.lang.IllegalArgumentException: Invalid format: "2013-10-16 10:00:00" is malformed at " 10:00:00"  
at org.elasticsearch.common.joda.time.format.DateTimeFormatter.parseMillis(DateTimeFormatter.java:754)  
at org.elasticsearch.index.mapper.core.DateFieldMapper.parseStringValue(DateFieldMapper.java:459)  
... 15 more

With this definition:

{  
"navegacion": {  
"properties": {  
"ip\_origen":{"type": "string"},  
"campo2":{"type": "string"},  
"campo4":{"type": "string"},  
"campo6":{"type": "string"},  
"cs-bytes":{"type": "integer"},  
"content-type":{"type": "string"},  
"host":{"type": "string"},  
"method":{"type": "string"},  
"port":{"type": "integer"},  
"referer":{"type": "string"},  
"uri-path":{"type": "string"},  
"uri-query":{"type": "string"},  
"uri-scheme":{"type": "string"},  
"user-agent":{"type": "string"},  
"username":{"type": "string"},  
"event-date":{"type" : "date","format" : "MM-dd-yyyy||yyyy-MM-dd HH:mm:ss"},  
"instance":{"type": "string"},  
"sc-bytes":{"type": "integer"},  
"filter-category":{"type": "string"},  
"filter-result":{"type": "string"},  
"status":{"type": "integer"}  
}  
}  
}

---

<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 6, 2017, 2:11am UTC](https://discuss.elastic.co/t/problem-with-date-format-mapping/13996/2 "2017-07-06T02:11:53Z")

</div>


