Skip to main content

Add Collection Struct Field (V2)

This operation adds a StructArray field to an existing collection.

POST/v2/vectordb/collections/struct_fields/add
Connection Endpoint

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

https://${CLUSTER_ENDPOINT}

📘Notes
  • 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=""
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
dbNamestring

The name of the database.

collectionNamestringrequired

The name of the collection.

schemaobjectrequired

The StructArray field schema.

fieldNamestringrequired

The name of the StructArray field.

descriptionstring

A description of the StructArray field.

dataTypestringrequired

The StructArray data type. Use ArrayOfStruct, or Array together with elementDataType set to Struct.

elementDataTypestring

The element type when dataType is Array.

fieldsarrayrequired

The scalar or vector sub-fields in the StructArray 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.

typeParamsobject
max_capacityinteger

The maximum number of struct elements allowed per entity.

Value Range: ≥ 1≤ 4096
nullableboolean

Whether the StructArray field can be null.

bash
export TOKEN="db_admin:xxxxxxxxxxxxx"

curl --request POST \
--url "${CLUSTER_ENDPOINT}/v2/vectordb/collections/struct_fields/add" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Request-Timeout: 5" \
--header "Content-Type: application/json" \
-d '{
"dbName": "default",
"collectionName": "documents",
"schema": {
"fieldName": "chunks",
"dataType": "ArrayOfStruct",
"fields": [
{
"fieldName": "text",
"dataType": "Array",
"elementDataType": "VarChar",
"elementTypeParams": {
"max_length": 1024
}
}
],
"typeParams": {
"max_capacity": 100
}
}
}'
Responses

Returns an empty object.

codeinteger

Response code.

dataobject

Returns an error message.

codeinteger

Response code.

messagestring

Error message.

Ctrl I