Help reindexing to change date format

Hi all,
I have to change the timestamp format of documents in my index.

Currently I have a "yyyymmddhhmmssZ" format.
I have to change it to something that grafana can understand. So I think Epoch_millis or ISO.
can you please help me with a correct console command to do that (if possible)?
I've tried to create an empty index with the "timestamp" already mapped with an epoch millis format. Then reindexing the whole index, but I obtained the error:

 ` "caused_by" : {
      "type" : "illegal_argument_exception",
      "reason" : "failed to parse date field [20140415152752Z] with format [epoch_millis]",
      "caused_by" : {
        "type" : "date_time_parse_exception",
        "reason" : "Failed to parse with all enclosed parsers"
      }`

Hey,

can you explain, how your reindexing strategy looks like? Where and how are you doing the date conversion? Can you share that snippet?

Thanks!

--Alex

Hey,
I just tried to reindex, without any particular option, from my source index to a destination empty index but with a pre configured mapping with the timestamp field mapped in the way I wanted to, I just hoped the conversion would have happened automatically. I was wrong.
Anyway I have now discovered that my environment works if I put a T in the yyyymmddhhmmssZ -> yyyymmddThhmmssZ so I have changed it with a query.
I had to do that for Grafana, who did not like the yyyymmddhhmmssZ format.

Mappings do not transform the JSON source, just determines how the data is parsed and indexed. If you want to change the format you probably need to reindex using an ingest pipeline.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.