# Invalid epoch\_millis for Java client when adding document with Date.getTime()

**URL:** <https://discuss.elastic.co/t/invalid-epoch-millis-for-java-client-when-adding-document-with-date-gettime/100188>\
**Category:** Elasticsearch\
**Created:** [September 12, 2017, 9:51am UTC](https://discuss.elastic.co/t/invalid-epoch-millis-for-java-client-when-adding-document-with-date-gettime/100188 "2017-09-12T09:51:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Pocivalnik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_pocivalnik/32/56098_2.png) [@David\_Pocivalnik](https://discuss.elastic.co/u/David_Pocivalnik)\
**Post date:** [September 12, 2017, 9:51am UTC](https://discuss.elastic.co/t/invalid-epoch-millis-for-java-client-when-adding-document-with-date-gettime/100188/1 "2017-09-12T09:51:41Z")

</div>

I have the following mapping defined:

```
"stopDate": { 
            "type": "date", "index": true, "store": false,
            "format": "yyyy-MM-dd HH:mm:ss:SSS||yyyy-MM-dd HH:mm:ss||epoch_millis"
        }

```

and with Java I just get someDate.getTime() where I get a long back.

The error I get during indexing is:

```
  [MapperParsingException[failed to parse [stopDate]]; nested: IllegalArgumentException[Invalid format:
 "1505201004403" is malformed at "4403"];]

```

So my question is, what format do I need? I found some issue here: [https://github.com/elastic/elasticsearch/issues/18507](https://github.com/elastic/elasticsearch/issues/18507) , but can't make anything out of it. Obviously there's still a check, but the value I put in (according to the exception) is only 13 characters long.

So, what do I have to do? or do I need to specify the format differently?

Thanks for any hints.

---

<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 10, 2017, 9:51am UTC](https://discuss.elastic.co/t/invalid-epoch-millis-for-java-client-when-adding-document-with-date-gettime/100188/2 "2017-10-10T09:51:42Z")

</div>

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