Date processor ingest pipeline failed to parse

Hello,
I'm using date processor on ingest pipeline, I've seen the documentation about the date processor, the syntax I wrote seems right, but the result is not.
here's my date example

05/11/2022, 7:03:52 AM

and here's my date processor

      {
      "date" : {
        "field" : "timestamp",
        "target_field" : "@timestamp",
        "formats" : ["mm/dd/yyyy, h:mm:ss a"],
        "timezone" : "UTC"
      }

here's the error

{
  "docs" : [
    {
      "error" : {
        "root_cause" : [
          {
            "type" : "illegal_argument_exception",
            "reason" : "unable to parse date [05/11/2022, 7:03:52 AM]"
          }
        ],
        "type" : "illegal_argument_exception",
        "reason" : "unable to parse date [05/11/2022, 7:03:52 AM]",
        "caused_by" : {
          "type" : "illegal_argument_exception",
          "reason" : "failed to parse date field [05/11/2022, 7:03:52 AM] with format [mm/dd/yyyy, h:mm:ss a]",
          "caused_by" : {
            "type" : "date_time_parse_exception",
            "reason" : "Text '05/11/2022, 7:03:52 AM' could not be parsed at index 14"
          }
        }
      }
    }
  ]
}

anyone have any clue about this? I tried to trim the field first yet still experiencing same issue

any help is appreciated,
Thanks

Hi @alfianaf

Fixing the formats to "MM/dd/yyyy".

PUT _ingest/pipeline/test_date
{
  "description" : "...",
  "processors" : [
    {
      "date" : {
        "field" : "timestamp",
        "target_field" : "@timestamp",
        "formats" : ["MM/dd/yyyy, h:mm:ss a"],
        "timezone" : "UTC"
      }
    }
  ]
}

POST _ingest/pipeline/test_date/_simulate
{
  "docs": [
    {
      "_source": {
        "timestamp": "05/11/2022, 07:03:52 AM"
      }
    }
  ]
}
2 Likes

@RabBit_BR Beat me to it...

Did you try...

"MM/dd/yyyy, HH.mm.ss a"

Or

"MM/dd/yyyy, h.mm.ss a"

1 Like

I tried "MM/dd/yyyy, h:mm:ss a"

its fixed now, my bad I thought mm was the correct format,
thanks all

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