Reindexing string to date format error

Hello,

I'm trying to reindex my data because of mapping changes and in this process I´m trying to convert a string to date format. The string of the date looks like this : "01.06.2016 01:05:34".

My template for this field:

"DispatchTime" : {
            "type" : "date",
            "format" : "dd.MM.yyyy HH:mm:ss"

But when I run the reindex api I get "Invalid format: \"31.05.2016 11:01:46\" is malformed at \".05.2016 11:01:46\"

What am I doing wrong? I'm a kind of new to elastic and maybe my whole logic of tackling this re-indexing is wrong.

Thanks and kind regards,

Uros

This looks correct for a date like 31.05.2016 11:01:46 so I guess the template was not correctly applies to the index you are reindexing to. What does "_mapping" for the target index tell you, did it pick up the correct format string?

Hello,

the _mapping shows:

"DispatchTime" : {
            "type" : "date",
            "format" : "strict_date_optional_time||epoch_millis"

It looks like it didn't pick up the correct settings I guess.

I found the problem. Deleted the new index and reran the reindex and it is ok. I first applied the wrong template, but forgot to clean the new index,

It's working now, thanks.

Kind regards,

Uros