Help Center/ Cloud Search Service/ FAQs/ Using CSS Cluster Search Engines/ How Do I Create a Type Under an Index in an Elasticsearch 7.x Cluster of CSS?
Updated on 2024-09-14 GMT+08:00

How Do I Create a Type Under an Index in an Elasticsearch 7.x Cluster of CSS?

In Elasticsearch 7.x and later versions, types cannot be created for indexes.

If you need to use types, add include_type_name=true to the command. Only a single type is supported.

PUT index?include_type_name=true
{
  "mappings": {
    "my_type": {
      "properties": {
        "@timestamp": {
          "type": "date"
        }
      }
    }
  }
}

After a multi-type index is created, run the following command to write data into it:

PUT index/my_type/1
{
  "@timestamp":"2019-02-20"
}