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

**URL:** https://discuss.elastic.co/t/ingest-pipeline-date-processor-text-could-not-be-parsed-at-index-0/310374
**Category:** Elasticsearch
**Tags:** ingest-pipeline
**Created:** [July 22, 2022, 9:14am UTC](https://discuss.elastic.co/t/ingest-pipeline-date-processor-text-could-not-be-parsed-at-index-0/310374 "2022-07-22T09:14:54Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Vladi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vladi/32/108686_2.png) [@Vladi](https://discuss.elastic.co/u/Vladi)
#### Post date: [July 22, 2022, 9:14am UTC](https://discuss.elastic.co/t/ingest-pipeline-date-processor-text-could-not-be-parsed-at-index-0/310374/1 "2022-07-22T09:14:54Z")

</div>

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

```auto
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:

```auto
{
  "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

---

<div class="post-metadata">

### Author: ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)
#### Post date: [July 22, 2022, 12:10pm UTC](https://discuss.elastic.co/t/ingest-pipeline-date-processor-text-could-not-be-parsed-at-index-0/310374/2 "2022-07-22T12:10:51Z")

</div>

Hi @Vladi

The format wouldn't be: **yyyyMMdd**  
Date: 2022 **0** 611

> `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`

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [July 22, 2022, 1:24pm UTC](https://discuss.elastic.co/t/ingest-pipeline-date-processor-text-could-not-be-parsed-at-index-0/310374/3 "2022-07-22T13:24:47Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Vladi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vladi/32/108686_2.png) [@Vladi](https://discuss.elastic.co/u/Vladi)
#### Post date: [July 22, 2022, 1:36pm UTC](https://discuss.elastic.co/t/ingest-pipeline-date-processor-text-could-not-be-parsed-at-index-0/310374/4 "2022-07-22T13:36:44Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Vladi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vladi/32/108686_2.png) [@Vladi](https://discuss.elastic.co/u/Vladi)
#### Post date: [July 22, 2022, 2:17pm UTC](https://discuss.elastic.co/t/ingest-pipeline-date-processor-text-could-not-be-parsed-at-index-0/310374/5 "2022-07-22T14:17:09Z")

</div>

> <https://github.com/elastic/elasticsearch/issues/88727>
>
> \### Elasticsearch Version
> 
> 7.12
> 
> \### Installed Plugins
> 
> \_No response\_
> 
> \### Java …Version
> 
> \_bundled\_
> 
> \### OS Version
> 
> debian
> 
> \### Problem Description
> 
> I am trying to parse the 5 digits date 2022611 with a pattern yyyyMdd.
> 
> \### Steps to Reproduce
> 
> POST /\_ingest/pipeline/\_simulate
> {
> "pipeline" :
> {
> "description": "\_description",
> "processors": \[
> {
> "date" : {
> "target\_field" : "timestamp",
> "formats" : \["yyyyMdd" \],
> "field" : "ts"
> }
> }
> \]
> },
> "docs": \[
> {
> "\_index": "index",
> "\_id": "id",
> "\_source": {
> "ts": "2022611"
> }
> }
> \]
> }
> 
> \### Logs (if relevant)
> 
> {
> "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"
> }
> }
> }
> }
> \]
> }

---

<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: [August 19, 2022, 2:17pm UTC](https://discuss.elastic.co/t/ingest-pipeline-date-processor-text-could-not-be-parsed-at-index-0/310374/6 "2022-08-19T14:17:24Z")

</div>

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