Multiple date format failes

Hi .. I have mapping for a date field set as follows. ES version used 7.9

"itemtransactionid":
							{
							   "type":  "date",
							   "format": "yyyy-MM-dd'T'HH:mm:ss:SSZ||strict_date_optional_time||yyyy-MM-dd'T'HH:mm:ss:SSSSZ||yyyy-MM-dd'T'HH:mm:ss:SSSSSZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSSZ"
							},

Though when indexing data, I keep getting an exception about parsing as follows

doc: aff_M48ab99101774949165dM752f1017816596 with status: 400 and result: null failed to index/delete to/from ES!!!!ES Index response: {"took":3,"errors":true,"items":[{"index":{"_index":"affiliation","_type":"_doc","_id":"aff_M48ab99101774949165dM752f1017816596","status":400,"error":{"type":"mapper_parsing_exception","reason":"failed to parse field [docproperties.itemtransactionid] of type [date] in document with id 'aff_M48ab99101774949165dM752f1017816596'. Preview of field's value: '2021-01-13T14:45:23:610063Z'","caused_by":{"type":"illegal_argument_exception","reason":"failed to parse date field [2021-01-13T14:45:23:610063Z] with format [yyyy-MM-dd'T'HH:mm:ss:SSZ||strict_date_optional_time||yyyy-MM-dd'T'HH:mm:ss:SSSSZ||yyyy-MM-dd'T'HH:mm:ss:SSSSSZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSSZ]","caused_by":{"type":"date_time_parse_exception","reason":"Failed to parse with all enclosed parsers"}}}}},{"index":{"_index":"affiliation","_type":"_doc","_id":"aff_M14e66abd15fb6f68adaM7ffe10178163220","status":400,"error":{"type":"mapper_parsing_exception","reason":"failed to parse field [docproperties.itemtransactionid] of type [date] in document with id 'aff_M14e66abd15fb6f68adaM7ffe10178163220'. Preview of field's value: '2017-10-28T21:01:54:874766Z'","caused_by":{"type":"illegal_argument_exception","reason":"failed to parse date field [2017-10-28T21:01:54:874766Z] with format [yyyy-MM-dd'T'HH:mm:ss:SSZ||strict_date_optional_time||yyyy-MM-dd'T'HH:mm:ss:SSSSZ||yyyy-MM-dd'T'HH:mm:ss:SSSSSZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSSZ]","caused_by":{"type":"date_time_parse_exception","reason":"date_time_parse_exception: Failed to parse with all enclosed parsers"}}}}}]}

Try using X instead of a Z for the timezone. See DateTimeFormatter (Java SE 11 & JDK 11 ) as a reference,as this includes the Z as the default timezone...

1 Like

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