I have create_date column as timestamp in database and need create_date value in elastic as "MM/DD/YYYY"
or "yyyy-MM-dd" . I am getting below error exception while loading data from oracle database using logstash 2.4.
SQL:
select to_date(to_char(cast(create_date as date),'MM/DD/YYYY') ,'MM/DD/YYYY') from table X.
exception.
"error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse [create_date]", "caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"Invalid format: "2015-01-21T05:00:00.000Z" is malformed at "T05:00:00.000Z""}}}},
date mapping in elastic is as below.
createddt": {
"type": "date",
"format": "yyyy-MM-dd"
}
Invalid format: "2015-01-21T05:00:00.000Z" is malformed at "T05:00:00.000Z""}}}},
You are passing all the way through the seconds but only specifying the date part of it (YYYY-MM-dd). In your case, you should be using a different time stamp.
The following could be the possible fit for you: (As given docs)
basic_ordinal_date_time:
A formatter for a full ordinal date and time, using a four digit year and three digit dayOfYear: yyyyDDD'T'HHmmss.SSSZ.
I need only date format in elastic such as YYYY-MM-dd or MM/DD/YYYY without time , used trunc in sql to get only date.
trunc(to_date(to_char(cast(create_date as date),'MM/DD/YYYY') ,'MM/DD/YYYY')).
Which date format we need to use elastic mapping for date property?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.