Elasticsearch dynamic date field mapping

Hi,

I have a problem in handling dates in my indexes.
My indexes were created automatically from my application.

In one index the field "CreationDate" is of type text (Tue May 23 10:55:12 CEST 2023), in another index the field "CreationDate" is of type long (1685020804142) the milliseconds-since-the-epoch.

I would like to know why the dynamic field mapping did not work on this field? Why has this field not passed the detection date?

PUT my-index-000001
{
  "mappings": {
    "date_detection": true
  }
}

This gives

{
  "error" : {
    "root_cause" : [
      {
        "type" : "resource_already_exists_exception",
        "reason" : "index [my-index-000001/1CxdUvsQRsGNuOQ4TvpgXQ] already exists",
        "index_uuid" : "1CxdUvsQRsGNuOQ4TvpgXQ",
        "index" : "my-index-000001"
      }
    ],
    "type" : "resource_already_exists_exception",
    "reason" : "index [my-index-000001/1CxdUvsQRsGNuOQ4TvpgXQ] already exists",
    "index_uuid" : "1CxdUvsQRsGNuOQ4TvpgXQ",
    "index" : "my-index-000001"
  },
  "status" : 400
}

Thank you.

And how do I transform the type of the field "CreationDate" into Date please ?

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