Hello is it possible to insert a document using the current time, like this?
PUT /tmp
{
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
}
}
}
}
POST tmp/_doc/1
{
"@timestamp":"{now-1m/d}"
}
So far i am unsuccessful, but unsure it this is not possible, or i am doing something wrong.
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "failed to parse field [@timestamp] of type [date] in document with id '1'. Preview of field's value: '{now-1m/d}'"
}
],
"type": "mapper_parsing_exception",
"reason": "failed to parse field [@timestamp] of type [date] in document with id '1'. Preview of field's value: '{now-1m/d}'",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "failed to parse date field [{now-1m/d}] with format [strict_date_optional_time||epoch_millis]",
"caused_by": {
"type": "date_time_parse_exception",
"reason": "Failed to parse with all enclosed parsers"
}
}
},
"status": 400
It is hard to tell if what i am trying IS possible, but i need to set the date format, or what i am trying is NOT possible.