stwilliams
(Stuart Williams)
September 25, 2019, 10:44am
1
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?!?!
spinscale
(Alexander Reelsen)
September 25, 2019, 11:42am
2
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"
}
stwilliams
(Stuart Williams)
September 25, 2019, 12:02pm
3
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'
spinscale
(Alexander Reelsen)
September 25, 2019, 1:08pm
4
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
stwilliams
(Stuart Williams)
September 25, 2019, 2:06pm
5
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.
spinscale
(Alexander Reelsen)
September 25, 2019, 2:19pm
6
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!
system
(system)
Closed
October 23, 2019, 2:19pm
7
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.