How to set different types for the same fields under the same index and different type in Elasticsearch?

when Elasticsearch creates mapping, it will report an error if the same field name of different type is set to different type, so how to solve this situation?

request a connection

 PUT  http://localhost:9200/new

parameters are as follows:

{
    "max_result_window": "1000000",
    "_source" : {
        "enabled": true
      },
      "_all" : {
        "enabled": false
      },
    "mappings": {
         "type1": {
          "properties": {
            "@timestamp" : {
              "type" : "date"
            },
            "@version" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "create_time" : {
              "index": "not_analyzed",
              "type" : "long"
            }
          }
        },
        "type2": {
          "properties": {
            "@timestamp" : {
              "type" : "date"
            },
            "@version" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "create_time" : {
              "index": "not_analyzed",
              "type" : "date"
            }
          }
        }
    }
}
 

request result:

 {
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "mapper [create_time] cannot be changed from type [date] to [long]"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "mapper [create_time] cannot be changed from type [date] to [long]"
    },
    "status": 400
}

this is dead by Elasticsearch, and the same fields in the same index must be of the same type.

but you can save the nation by using the curve, copy it to another field using copy_to, and use a different type

.

you can use nested objects, or set the child property to a different type, but once set, it cannot be changed

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3199e-34158.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3199e-34158.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?