Add Collection Struct Field (V2)
This operation adds a StructArray field to an existing collection.
The base URL for this API is in the following format:
https://${CLUSTER_ENDPOINT}
- 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.
export CLUSTER_ENDPOINT=""
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.
The name of the database.
The name of the collection.
The StructArray field schema.
The name of the StructArray field.
A description of the StructArray field.
The StructArray data type. Use ArrayOfStruct, or Array together with elementDataType set to Struct.
The element type when dataType is Array.
The scalar or vector sub-fields in the StructArray field.
A sub-field definition within a struct array. The dataType refers to the scalar or vector type of each struct field.
The name of the sub-field.
The scalar or vector type of the struct field.
Parameters for the element type, such as max_length for VarChar or dim for vector types.
The maximum number of struct elements allowed per entity.
Whether the StructArray field can be null.
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
}
}
}'
Returns an empty object.
Response code.
Returns an error message.
Response code.
Error message.