To begin with, the date format that that is stored in the index is 2021-09-16T14:06:02.000000Z
When I log in with the option to remember
the user and then I log out, I get the following error.
The response from ElasticSearch is
array:3 [▼
"took" => 1
"errors" => true
"items" => array:1 [▼
0 => array:1 [▼
"index" => array:5 [▼
"_index" => "users"
"_type" => "_doc"
"_id" => "313"
"status" => 400
"error" => array:3 [▼
"type" => "mapper_parsing_exception"
"reason" => "failed to parse field [created_at] of type [date] in document with id '313'. Preview of field's value: '2021-09-16 11:37:49'"
"caused_by" => array:3 [▼
"type" => "illegal_argument_exception"
"reason" => "failed to parse date field [2021-09-16 11:37:49] with format [strict_date_optional_time||epoch_millis]"
"caused_by" => array:2 [▼
"type" => "date_time_parse_exception"
"reason" => "Failed to parse with all enclosed parsers"
]
]
]
]
]
]
]
This happens because when a user logs out, the remember_token
attribute is modified and since the User
model is modified, the index is updated.
The problem is that when it tries to update the index, the format of the date it tries to store in the index is not 2021-09-16T14:06:02.000000Z
anymore
Instead, now the date format is 2021-09-16 11:37:49
and therefore there is a conflict in the date format that is already in the index and the date format that it tries to store.
This happens only when the framework
updates the User
model, when a user logs out
.
This does not happen if I update the attribute of any model myself.
UPDATED
I just noticed that then laravel
updates the remember_token
, it disables the timestamps
and that is why the date format changes to 2021-09-16 11:37:49
.
However, I still don't know how to fix this issue.