Ingest pipeline date processor - text could not be parsed at index 0

Hi,
I am trying to parse the 5 digits date 2022611 with a pattern yyyyMdd.

POST /_ingest/pipeline/_simulate
{
  "pipeline" :
  {
    "description": "_description",
    "processors": [
      {
        "date" : {
          "target_field" : "timestamp",
          "formats" : [ "yyyyMdd" ],
          "field" : "ts"
        }
      }
    ]
  },
  "docs": [
    {
      "_index": "index",
      "_id": "id",
      "_source": {
        "ts": "2022611"
      }
    }
  ]
}

However, I receive the following error:

{
  "docs" : [
    {
      "error" : {
        "root_cause" : [
          {
            "type" : "illegal_argument_exception",
            "reason" : "unable to parse date [2022611]"
          }
        ],
        "type" : "illegal_argument_exception",
        "reason" : "unable to parse date [2022611]",
        "caused_by" : {
          "type" : "illegal_argument_exception",
          "reason" : "failed to parse date field [2022611] with format [yyyyMdd]",
          "caused_by" : {
            "type" : "date_time_parse_exception",
            "reason" : "Text '2022611' could not be parsed at index 0"
          }
        }
      }
    }
  ]
}

What am I missing?

Thank you,
Vlad

Hi @Vladi

The format wouldn't be: yyyyMMdd
Date: 20220611

basic_date
A basic formatter for a full date as four digit year, two digit month of year, and two digit day of month: yyyyMMdd

Just tried with your format and it is not working as well, maybe it is a bug?

It should work because the format yyyyMdd matchs your string 2022611, but for some reason elastic is rejecting it.

An ugly working around until someone from elastic chimes in and gives more light in this issue is to hardcode the year.

If your logs are all from 2022, you could use the format 2022Mdd and it will work.

I absolutely agree, here, it's probably a bug.
FYI, logstash will reject this as well as _ingest pipeline, I did a test before but logstash was not a subject of my ticket. But the problem exists there too.

2022Mdd works, thank you.

Should I create an issue on github, or you can do it better?

Thank you,
Vlad

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