Add Default Date Format on Mapping

I am confused ... this is a dynamic mapping ... it will create a flexible date fields for any field that it sees that matches the patterns...

PUT index-002
{
  "mappings": {
    "dynamic_date_formats": ["yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||yyyy-MM-dd||epoch_millis"]
  }
}

POST /index-002/_doc
{
  "date": "2021/01/01"
}

POST /index-002/_doc
{
  "maybe_a_date": "2021-01-01"
}

flexible date fields

GET index-002

restults 
{
  "index-002" : {
    "aliases" : { },
    "mappings" : {
      "dynamic_date_formats" : [
        "yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||yyyy-MM-dd||epoch_millis"
      ],
      "properties" : {
        "date" : {
          "type" : "date",
          "format" : "yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||yyyy-MM-dd||epoch_millis"
        },
        "maybe_a_date" : {
          "type" : "date",
          "format" : "yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||yyyy-MM-dd||epoch_millis"
        }
      }
    },
    "settings" : {
      "index" : {
        "routing" : {
          "allocation" : {
            "include" : {
              "_tier_preference" : "data_content"
            }
          }
        },
        "number_of_shards" : "1",
        "provided_name" : "index-002",
        "creation_date" : "1637102907427",
        "number_of_replicas" : "1",
        "uuid" : "tBrJs0A2QJq2GXyVjEOL4Q",
        "version" : {
          "created" : "7150299"
        }
      }
    }
  }
}

Your error would be solved using my solution...