Skip to content
Advertisement

Date mapper doesn’t accept the data sent although it seems to be in an acceptable format

My request it like this,

$params = [
'index' => 'reportings',
'type' => 'datax',
'id' => $row["id"],
'body' => [
'id' => $row["id"],
'dateCreated' => "2020-11-20 20:39:53"
'dateUpdated' => "2020-11-20 20:39:53"
]
];
$response = $client->index($params);

and the mapping for these rows are like this,

"dateCreated": { "type": "date", "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis" }, "dateUpdated": { "type": "date", "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis" },

The error is “mapper [dateCreated] cannot be changed from [date] to [text]”

And when I try to send it as epoch, it recognizes it as long. How can I make it recognize it as date data?

Advertisement

Answer

All I needed to replace the space with T and also change the mapping to strict_date_optional_time||epoch_millis then I could index all the data!

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement