Bug found!

Found an undocumented feature while importing date data into ES with Search::elasticsearch routine (so not sure where the bug is exactly...)

Error message:
'reason' => 'Cannot parse "2016-02-29 15:56:07 +1100": Value 29 for dayOfMonth must be in the range [1,28]','type' => 'illegal_field_value_exception'

Leap year?!?!

Hm, this clearly looks like a valid date with 2016 being a leap year.

Can you share the full index operation and the Elasticsearch version, so that this can be reproduced locally?

Also, it looks as if you have configured a special mapping for this field, as this is not an ISO8601 date. Can you share that mapping as well?

I tried this under 7.3.2 and the document got indexed...

PUT foo
{
  "mappings": {
    "properties": {
      "date" : {
        "type": "date",
        "format": "yyyy-MM-dd HH:mm:ss Z"
      }
    }
  }
}

PUT foo/_doc/1
{
  "date" : "2016-02-29 15:56:07 +1100"
}

elasticsearch : 6.5.0-1 (which is probably the issue)

The mapping is...
{
"template": "repo_commit-*",
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
},
"mappings": {
"commit": {
"properties": {
"Approver": {
"type": "text" },
"Nos_of_Approvals": {
"type": "integer" },
"Author": {
"type": "text" },
"Comment": {
"type": "text" },
"Commit": {
"type": "text" },
"Date": {
"type": "date",
"format": "y-MM-d H:m:s Z" },
"Merge": {
"type": "text" },
"Repo": {
"type": "keyword" }
}
}
}
}

Which the java formatting docs suggests is the right string.

The date is generated by 'git log --date=iso'

Can you please create a small fully reproducible example, starting with an empty node, creating the template, the index, indexing the document, etc..

I just did this on 6.5.0 and it worked

PUT test
{
  "mappings": {
    "_doc": {
      "properties": {
        "date": {
          "type": "date",
          "format": "y-MM-d H:m:s Z"
        }
      }
    }
  }
}

PUT foo/_doc/1
{
  "date" : "2016-02-29 15:56:07 +1100"
}

thanks

Gosh darn it.

That worked.

So I did a perl script to test search::elasticsearch - that worked fine

So I went back to the original code and dataset - That parsed without an issue too --- grrrrr

Now I have no idea what caused the error but its gone now.

weird one. If you ever encounter this again, feel free to ping me here or drop me an email at $firstname.$lastname@elastic.co - thanks a bunch!

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