Create Spark K-means Job (V2)
This operation creates a K-means clustering job.
The base URL for this API is in the following format:
https://api.cloud.zilliz.com
The endpoints on the control plane currently supports up to 20 requests per second per user per endpoint.
export BASE_URL="https://api.cloud.zilliz.com"
The authentication token should be an API key with appropriate privileges.
A unique key that makes repeated create requests idempotent.
The project ID.
The job description.
The cloud region ID.
A data resource (input or output) reference for a Spark job.
The data resource type.
The volume name.
The data path within the volume.
The data format.
The write mode.
The database name.
The collection name.
A data resource (input or output) reference for a Spark job.
The data resource type.
The volume name.
The data path within the volume.
The data format.
The write mode.
The database name.
The collection name.
The resource size for the job.
The timeout in seconds.
The primary key field.
The vector field.
The distance metric.
The number of clusters.
export TOKEN="YOUR_API_KEY"
export projectId="proj-xxxxxxxxxxxxxxxxxxxx"
curl --request POST \
--url "${BASE_URL}/v2/projects/${projectId}/jobs/kmeans" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Idempotency-Key: spark-job-20260814-001" \
--header "Request-Timeout: 5" \
--header "Content-Type: application/json" \
-d '{
"description": "Daily vector processing job.",
"regionId": "aws-us-west-2",
"input": {
"type": "VOLUME",
"volumeName": "volume-xxxxxxxxxxxxxxxxxxx",
"path": "/input/data.parquet",
"format": "parquet"
},
"output": {
"type": "VOLUME",
"volumeName": "volume-xxxxxxxxxxxxxxxxxxx",
"path": "/output/results",
"format": "parquet",
"writeMode": "OVERWRITE"
},
"resourceSize": "medium",
"timeoutSeconds": 3600,
"primaryKeyField": "id",
"vectorField": "embedding",
"metric": "L2",
"numClusters": 8
}'
Returns the created Spark job.
A success response.
Response code.
Summary information about a Spark batch job.
The job ID.
The project ID the job belongs to.
The job type.
The job description.
The job status.
The cloud region ID.
The cluster ID.
Creation time (ISO 8601).
Start time (ISO 8601).
Finish time (ISO 8601).
The duration in seconds.
A failure response.
Response code.
Error message.
{
"code": 0,
"data": {
"jobId": "job-xxxxxxxxxxxxxxxxxx",
"sparkInstanceId": "sp-xxxxxxxxxxxxxxxxxx",
"type": "SPARK",
"jobName": "daily-vector-job",
"status": "PENDING",
"regionId": "aws-us-west-2",
"projectId": "proj-xxxxxxxxxxxxxxxxxxx"
}
}