I have created a template with 3 fields.
The last one is DATE format.
The template index created successfully:
PUT _template/test_index_template
{
"index_patterns" : ["test-*"],
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1
},
"mappings": {
"properties": {
"FIRST_NAME": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"LAST_NAME": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"COMPETITION_DATE": {
"type": "date",
"format" : "dateOptionalTime"
}
}
}
}
When i tried to insert one row it failed .
I have tried to change the mapping to include : "format" : "dateOptionalTime"
as well see with no date format at all . In both cases it failed:
POST /test-2019/_doc/1
{
"FIRST_NAME": "aaa",
"LAST_NAME": "bbbb",
"COMPETITION_DATE": "24-NOV-2019"
}
The error is
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "failed to parse field [COMPETITION_DATE] of type [date] in document with id '1'. Preview of field's value: '24-NOV-2019'"
}
],
"type": "mapper_parsing_exception",
"reason": "failed to parse field [COMPETITION_DATE] of type [date] in document with id '1'. Preview of field's value: '24-NOV-2019'",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "failed to parse date field [24-NOV-2019] with format [date_optional_time]",
"caused_by": {
"type": "date_time_parse_exception",
"reason": "Text '24-NOV-2019' could not be parsed at index 3"
}
}
},
"status": 400
}
Please advise how to insert manually a date field in the simplest format
Thanks
Yoav