Mapping fields as date when index already exists

Hi all and sorry for my poor english.
I've successfully mapped a field as date (for kibana purpose) before ingestioning one document ,using this:

PUT my-index
{
  "mappings": {
  "properties": {
  "currentDate": {
  "type": "date" ,
  "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
}
}
}
}

I wonder how can I do that when a document is already ingestioned.

You can't change a mapping once you have indexed some documents using it. You can only add to the mapping with new fields. But you do have 2 options and the 2nd one is probably the easiest as long as you can ingest that document again easily.

Option 1

  1. Create mapping you want
  2. Reindex into new index using new mapping
  3. Delete old index
  4. Reindex back to original index name

Option 2

  1. Delete your current index
  2. Reingest your data with new mapping
1 Like

Why do you not plan to enable a mapping runtime on indexed document (if mapping is compliant )?
This is could be a good enhancement.

Thanks for your response!

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