A partition is a logical subset of a collection that segments vector data.
Create a partition in a DashVector collection by calling the HTTP API described below.
Prerequisites
Before you begin, make sure that you have:
-
A DashVector cluster. See Create a cluster
-
An API key. See Manage API keys
-
The latest version of the DashVector SDK. See Install DashVector SDK
Method and URL
POST https://{Endpoint}/v1/collections/{CollectionName}/partitionsExample
Before running this example:
-
Replace
<your-api-key>with your API key and<your-cluster-endpoint>with your cluster endpoint. -
Create a collection named
quickstart. See the "Example" section in Create a collection.
The following request creates a partition named shoes in the quickstart collection:
API_KEY="<your-api-key>"
CLUSTER_ENDPOINT="<your-cluster-endpoint>"
curl -X POST \
-H "dashvector-auth-token: ${API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"name": "shoes"
}' \
"https://${CLUSTER_ENDPOINT}/v1/collections/quickstart/partitions"Sample response:
{
"request_id": "19215409-ea66-4db9-8764-26ce2eb5bb99",
"code": 0,
"message": ""
}
A code value of 0 confirms that the partition was created.
Request parameters
|
Parameter |
Location |
Type |
Required |
Description |
|
{Endpoint} |
path |
str |
Yes |
The cluster endpoint. Find this on the cluster details page in the console. |
|
{CollectionName} |
path |
str |
Yes |
The name of the collection to create the partition in. |
|
dashvector-auth-token |
header |
str |
Yes |
The API key. |
|
name |
body |
str |
Yes |
The name of the partition. |
Response parameters
|
Parameter |
Type |
Description |
Example |
|
code |
int |
Status code. |
0 |
|
message |
str |
Response message. |
success |
|
request_id |
str |
Unique request ID. |
19215409-ea66-4db9-8764-26ce2eb5bb99 |