Skip to main content

Create Collection (V2)

This operation creates a collection in a specified cluster.

POST/v2/vectordb/collections/create
Connection Endpoint

The base URL for this API is in the following format:

https://{cluster-id}.{region}.vectordb.zillizcloud.com:19530

📘Notes
  • Use the cluster endpoint if you are using serving clusters.
    • Free & Serverless

      https://{cluster-id}.serverless.{region}.vectordb.zillizcloud.com

    • Dedicated

      https://{cluster-id}.{region}.vectordb.zillizcloud.com:19530

  • You need to fill in ${CLUSTER_ENDPOINT} with that of your Zilliz Cloud cluster.
  • To get the endpoint, use the Describe Cluster V2 API to extract the values from the responses.
shell
export CLUSTER_ENDPOINT="https://{cluster-id}.{region}.vectordb.zillizcloud.com:19530"
Parameters
Authorizationstringheaderrequired

The authentication token should be an API key with appropriate privileges or a pair of colon-joined username and password, like username:password. If you are using a project endpoint, only a valid API key with sufficient permissions applies.

Example Value: Bearer {{TOKEN}}
Request Body

Defines a Collection to be created with a quick setup. collectionName and dimension are required.

dbNamestring

The name of the database.

collectionNamestringrequired

The name of the collection to create.

dimensionintegerrequired

The number of dimensions a vector value should have. This is required if idType of this field is set to FloatVector or BinaryVector.

metricTypestring

The metric type applied to this operation.

idTypestring

The data type of the primary field. This parameter is designed for the quick-setup of a collection and will be ignored if schema is defined.

autoIDboolean

Whether the primary field automatically increments. This parameter is designed for the quick-setup of a collection and will be ignored if schema is defined.

primaryFieldNamestring

The name of the primary field. This parameter is designed for the quick-setup of a collection and will be ignored if schema is defined.

vectorFieldNamestring

The name of the vector field. This parameter is designed for the quick-setup of a collection and will be ignored if schema is defined.

descriptionstring

The description of the current collection.

paramsobject

Extra parameters for the collection.

max_lengthinteger

The maximum number of bytes allowed in the primary field. This parameter is available only when the primary field is a string field.

enableDynamicFieldboolean

Whether to enable the dynamic field feature.

consistencyLevelstring

The consistency level of the collection.

ttlSecondsinteger

The time-to-live (TTL) period of the collection. If set, the collection is to be dropped once the period ends.

mmap.enabledboolean

Specifies whether to enable memory mapping for the collection.

ttlFieldstring

The name of the field to use for TTL-based expiration.

warmup.scalarFieldboolean

Whether to preload scalar field data into memory on load.

warmup.scalarIndexboolean

Whether to preload scalar index data into memory on load.

warmup.vectorFieldboolean

Whether to preload vector field data into memory on load.

warmup.vectorIndexboolean

Whether to preload vector index data into memory on load.

consistencyLevelstringPublic Preview

The consistency level applied to the collection described by this setup. It determines the consistency guarantee used when the collection is queried.

propertiesobject

Additional properties of the Collection. Use it to specify extra settings for the Collection.

vectorFieldTypestringPublic Preview

The vector data type used for the vector field of the Collection created by quick setup.

A Collection setup whose configuration is supplied explicitly, including the required collectionName.

dbNamestring

The name of the database.

collectionNamestringrequired

The name of the collection to create.

schemaobject

The schema is responsible for organizing data in the target collection. A valid schema should have multiple fields, which must include a primary key, a vector field, and several scalar fields. Setting this parameter means that dimension, idType, autoID, primaryFieldName, and vectorFieldName will be ignored.

autoIDboolean

Whether allows the primary field to automatically increment. Setting this to True makes the primary field automatically increment. In this case, the primary field should not be included in the data to insert to avoid errors. Set this parameter in the field with is_primary set to True.

enableDynamicFieldboolean

Whether allows to use the reserved $meta field to hold non-schema-defined fields in key-value pairs.

fieldsarray

A list of field objects.

[]fieldsobject

A field schema object.

fieldNamestringrequired

The name of the field to create in the target collection

dataTypestringrequired

The data type of the field values.

elementDataTypestring

The data type of the elements in an array field. This is required if the current field is of the array type.

nullableboolean

Whether the field can be null. If set to true, the field can contain null values.

defaultValuestring

The default value of the field. This is required if the current field is of the VarChar type.

isPrimaryboolean

Whether the current field is the primary field. Setting this to True makes the current field the primary field.

isPartitionKeyboolean

Whether the current field serves as the partition key. Setting this to True makes the current field serve as the partition key. In this case, Zilliz Cloud manages all partitions in the current collection.

elementTypeParamsobject

Extra field parameters.

max_lengthinteger

An optional parameter for VarChar values that determines the maximum length of the value in the current field.

diminteger

An optional parameter for FloatVector or BinaryVector fields that determines the vector dimension.

max_capacityinteger

An optional parameter for Array field values that determines the maximum number of elements in the current array field.

functionsarray

A list of functions.

[]functionsobject

A function schema object.

namestringrequired

The name of the function to create.

descriptionstring

The description of the function to create.

typestringrequired

The type of the function to create.

inputFieldNamesarrayrequired

The names of the input fields for the function to create.

[]inputFieldNamesstring

A field name.

outputFieldNamesarrayrequired

The names of the output fields for the function to create.

[]outputFieldNamesstring

A field name.

paramsobject

Configuration parameters specific to the current function. Once the function type is set to BM25, no parameter is required. For applicable parameters to functions of TEXTEMBEDDING or RERANK, refer to Embedding Functions and Reranking Functions

structFieldsarray

A list of struct array fields.

[]structFieldsobject

A struct array field that groups multiple sub-fields.

fieldNamestringrequired

The name of the struct array field.

descriptionstring

A description of the struct array field.

fieldsarrayrequired

The sub-fields in the struct array. Each dataType refers to the scalar or vector type of a struct field.

[]fieldsobjectrequired

A sub-field definition within a struct array. The dataType refers to the scalar or vector type of each struct field.

fieldNamestringrequired

The name of the sub-field.

dataTypestringrequired

The scalar or vector type of the struct field.

elementTypeParamsobject

Parameters for the element type, such as max_length for VarChar or dim for vector types.

typeParamsobjectrequired

Parameters of the struct array field. max_capacity is required and specifies the maximum number of struct elements allowed per entity.

max_capacityintegerrequired

The maximum number of struct elements allowed per entity.

Value Range: ≥ 1≤ 4096
indexParamsarray

The parameters that apply to the index-building process.

[]indexParamsobject

An index Schema object.

metricTypestringrequired

The similarity metric type used to build the index. For more information, refer to Similarity Metrics Explained](/docs/search-metrics-explained).

fieldNamestringrequired

The name of the target field on which an index is to be created.

indexNamestringrequired

The name of the index to create. The value defaults to the target field name.

paramsobject

The index type and related settings. For Zilliz Cloud clusters, you should always set index_type to AUTOINDEX.

index_typestringrequired

The type of the index to create

paramsobject

Extra parameters for the collection.

consistencyLevelstring

The consistency level of the collection.

partitionsNuminteger

The number of partitions to create along with the current collection. This parameter is mandatory if one field of the collection has been designated as the partition key.

ttlSecondsinteger

The time-to-live (TTL) period of the collection. If set, the collection is to be dropped once the period ends.

partitionKeyIsolationboolean

Specifies whether to enable partition key isolation for the collection.

mmap.enabledboolean

Specifies whether to enable memory mapping for the collection.

ttlFieldstring

The name of the field to use for TTL-based expiration.

warmup.scalarFieldboolean

Whether to preload scalar field data into memory on load.

warmup.scalarIndexboolean

Whether to preload scalar index data into memory on load.

warmup.vectorFieldboolean

Whether to preload vector field data into memory on load.

warmup.vectorIndexboolean

Whether to preload vector index data into memory on load.

descriptionstring

The description of the current collection.

consistencyLevelstringPublic Preview

The consistency level applied to the collection described by this setup. It determines the consistency guarantee used when the collection is queried.

propertiesobject

Additional Collection properties, given as key-value pairs.

A Collection setup that refers to an existing external Collection, identified by the required collectionName.

dbNamestring

The name of the database.

collectionNamestringrequired

The name of the collection to create.

schemaobject

The schema for an external collection. Must include fields with externalField mappings, plus externalSource. externalSpec is optional; for a milvus:// source, omitting it defaults format to milvus-table.

autoIDboolean

Whether allows the primary field to automatically increment. Setting this to True makes the primary field automatically increment. In this case, the primary field should not be included in the data to insert to avoid errors. Set this parameter in the field with is_primary set to True.

enableDynamicFieldboolean

Whether allows to use the reserved $meta field to hold non-schema-defined fields in key-value pairs.

fieldsarray

A list of field objects.

[]fieldsobject

A field schema object.

fieldNamestringrequired

The name of the field to create in the target collection

dataTypestringrequired

The data type of the field values.

elementDataTypestring

The data type of the elements in an array field. This is required if the current field is of the array type.

nullableboolean

Whether the field can be null. If set to true, the field can contain null values.

defaultValuestring

The default value of the field. This is required if the current field is of the VarChar type.

isPrimaryboolean

Whether the current field is the primary field. Setting this to True makes the current field the primary field.

isPartitionKeyboolean

Whether the current field serves as the partition key. Setting this to True makes the current field serve as the partition key. In this case, Zilliz Cloud manages all partitions in the current collection.

elementTypeParamsobject

Extra field parameters.

max_lengthinteger

An optional parameter for VarChar values that determines the maximum length of the value in the current field.

diminteger

An optional parameter for FloatVector or BinaryVector fields that determines the vector dimension.

max_capacityinteger

An optional parameter for Array field values that determines the maximum number of elements in the current array field.

externalFieldstring

The name of the corresponding column in the external source. Required when creating an external collection.

functionsarray

A list of functions.

[]functionsobject

A function schema object.

namestringrequired

The name of the function to create.

descriptionstring

The description of the function to create.

typestringrequired

The type of the function to create.

inputFieldNamesarrayrequired

The names of the input fields for the function to create.

[]inputFieldNamesstring

A field name.

outputFieldNamesarrayrequired

The names of the output fields for the function to create.

[]outputFieldNamesstring

A field name.

paramsobject

Configuration parameters specific to the current function. Once the function type is set to BM25, no parameter is required. For applicable parameters to functions of TEXTEMBEDDING or RERANK, refer to Embedding Functions and Reranking Functions

externalSourcestringrequired

The external data source identifier. On Zilliz Cloud, externalSource accepts two schemes: volume://<volume_name>/<path> and milvus://<instance_id>/<db_name>/<collection_name>. The milvus:// scheme points to a collection on another cluster compatible with Milvus v3.0.x in the same project and region. The scheme must be lowercase, all three segments are required (including default as the database name), and a single trailing slash is tolerated. Required when creating an external collection.

externalSpecstring

A JSON-encoded string describing the connection parameters for the external source. The format key accepts parquet, vortex, lance-table, iceberg-table, and milvus-table. Optional when creating an external collection; for a milvus:// source, omitting it defaults format to milvus-table.

structFieldsarray

A list of struct array fields.

[]structFieldsobject

A struct array field that groups multiple sub-fields.

fieldNamestringrequired

The name of the struct array field.

descriptionstring

A description of the struct array field.

fieldsarrayrequired

The sub-fields in the struct array. Each dataType refers to the scalar or vector type of a struct field.

[]fieldsobjectrequired

A sub-field definition within a struct array. The dataType refers to the scalar or vector type of each struct field.

fieldNamestringrequired

The name of the sub-field.

dataTypestringrequired

The scalar or vector type of the struct field.

elementTypeParamsobject

Parameters for the element type, such as max_length for VarChar or dim for vector types.

typeParamsobjectrequired

Parameters of the struct array field. max_capacity is required and specifies the maximum number of struct elements allowed per entity.

max_capacityintegerrequired

The maximum number of struct elements allowed per entity.

Value Range: ≥ 1≤ 4096
indexParamsarray

The parameters that apply to the index-building process.

[]indexParamsobject

An index Schema object.

metricTypestringrequired

The similarity metric type used to build the index. For more information, refer to Similarity Metrics Explained](/docs/search-metrics-explained).

fieldNamestringrequired

The name of the target field on which an index is to be created.

indexNamestringrequired

The name of the index to create. The value defaults to the target field name.

paramsobject

The index type and related settings. For Zilliz Cloud clusters, you should always set index_type to AUTOINDEX.

index_typestringrequired

The type of the index to create

paramsobject

Extra parameters for the collection.

consistencyLevelstring

The consistency level of the collection.

partitionsNuminteger

The number of partitions to create along with the current collection. This parameter is mandatory if one field of the collection has been designated as the partition key.

ttlSecondsinteger

The time-to-live (TTL) period of the collection. If set, the collection is to be dropped once the period ends.

partitionKeyIsolationboolean

Specifies whether to enable partition key isolation for the collection.

mmap.enabledboolean

Specifies whether to enable memory mapping for the collection.

ttlFieldstring

The name of the field to use for TTL-based expiration.

warmup.scalarFieldboolean

Whether to preload scalar field data into memory on load.

warmup.scalarIndexboolean

Whether to preload scalar index data into memory on load.

warmup.vectorFieldboolean

Whether to preload vector field data into memory on load.

warmup.vectorIndexboolean

Whether to preload vector index data into memory on load.

descriptionstring

The description of the current collection.

consistencyLevelstringPublic Preview

The consistency level applied to the collection described by this setup. It determines the consistency guarantee used when the collection is queried.

propertiesobject

Additional properties to apply to the Collection.

bash
export TOKEN="db_admin:xxxxxxxxxxxxx"

curl --request POST \
--url "${CLUSTER_ENDPOINT}/v2/vectordb/collections/create" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Request-Timeout: 5" \
--header "Content-Type: application/json" \
-d '{
"collectionName": "test_collection",
"dimension": 5
}'
bash
export TOKEN="db_admin:xxxxxxxxxxxxx"

curl --request POST \
--url "${CLUSTER_ENDPOINT}/v2/vectordb/collections/create" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Request-Timeout: 5" \
--header "Content-Type: application/json" \
-d '{
"collectionName": "custom_quick_setup",
"dimension": 5,
"primaryFieldName": "my_id",
"idType": "VarChar",
"vectorFieldName": "my_vector",
"metric_type": "L2",
"autoId": true,
"params": {
"max_length": "512"
}
}'
Responses

Returns a collection object.

A generic response envelope returned by operations that carry no operation-specific result data. It still includes a data object.

codeinteger

Response code.

dataobject

The response payload object. Its contents depend on the operation that returns it.

Returns an error message.

codeinteger

Response code.

messagestring

Error message.

Successjson
{
"code": 0,
"data": {}
}