# Correct date format for data ingestion

**URL:** <https://discuss.elastic.co/t/correct-date-format-for-data-ingestion/217331>\
**Category:** Logstash\
**Created:** [January 31, 2020, 9:14am UTC](https://discuss.elastic.co/t/correct-date-format-for-data-ingestion/217331 "2020-01-31T09:14:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![T\_Martin\_T](https://avatars.discourse-cdn.com/v4/letter/t/e8c25b/32.png) [@T\_Martin\_T](https://discuss.elastic.co/u/T_Martin_T)\
**Post date:** [January 31, 2020, 9:14am UTC](https://discuss.elastic.co/t/correct-date-format-for-data-ingestion/217331/1 "2020-01-31T09:14:07Z")

</div>

Hi guys,

Im trying to ingest some data and I encountered a problem with the correct date assignment.

The following sample of data looks like this:

"price\_eur" =\> 4922.28,  
"engine\_power" =\> 122,  
"maker" =\> "mazda",  
"seat\_count" =\> 5,  
"mileage" =\> 59000,  
"fuel\_type" =\> "gasoline",  
"stk\_year" =\> "None",  
**"date\_created" =\> "2015-11-14 19:00:48.141345+00",**  
"door\_count" =\> 5,  
"message" =\> "mazda;6;59000;2007;2261;122;;;None;man;5;5;gasoline;2015-11-14 19:00:48.141345+00;2016-01-27 20:40:15.46361+00;4922.28\r",  
"path" =\> "/data/obs-dbb2/ElasticSearch\_Data/cars.csv",  
"body\_type" =\> nil,  
"host" =\> "sysm-aiops-elk-master1",  
"color\_slug" =\> nil,  
"engine\_displacement" =\> "2261",  
"model" =\> "6",  
"transmission" =\> "man",  
"@version" =\> "1",  
"manufacture\_year" =\> "2007",  
**"date\_last\_seen" =\> "2016-01-27 20:40:15.46361+00",**  
"@timestamp" =\> 2020-01-31T08:46:42.733Z

The problem is time\_created and date\_last\_seen - it is still ingesting it as String, but I would like to ingest it as long (just like the field @timestamp, which is ingested correctly).

In my configuration file, I tried various types, the latest time format i tried, looks like this:

```
   date {
    match => ["date_created", "yyyy-MM-dd HH:mm:ss.SSSZZ"]
   target => "@date_created"

```

Is there a way to make it indexing time\_created, and date\_last\_seen just like timestamp ?

Thank you

Martin

---

<div class="post-metadata">

**Author:** ![TWhitehouse](https://avatars.discourse-cdn.com/v4/letter/t/e480ec/32.png) [@TWhitehouse](https://discuss.elastic.co/u/TWhitehouse)\
**Post date:** [January 31, 2020, 9:58am UTC](https://discuss.elastic.co/t/correct-date-format-for-data-ingestion/217331/2 "2020-01-31T09:58:06Z")

</div>

Hey  
You need to convert it to a date in logstash to ensure its in the right format, then map that field in elasticsearch in your index to a date format using an index template or the mapping api.  
Best to ask how to do that in the elasticsearch forum if you're unsure. Alternatively, the documentation is pretty comprehensive 🙂

---

<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:** [February 28, 2020, 9:58am UTC](https://discuss.elastic.co/t/correct-date-format-for-data-ingestion/217331/3 "2020-02-28T09:58:15Z")

</div>

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