Spark K-means ジョブの作成 (V2)
This operation creates a K-means clustering job.
POST/v2/projects/{projectId}/jobs/kmeans
https://api.cloud.zilliz.com
shell
export BASE_URL="https://api.cloud.zilliz.com"
パラメータ
Authorizationstringheader必要
認証トークンは、適切な権限を持つ API キーである必要があります。
値の例: Bearer {{TOKEN}}
Idempotency-Keystringheader
繰り返しの作成リクエストを冪等にするための一意のキー。
値の例: spark-job-20260814-001
projectIdstringpath必要
プロジェクト ID。
値の例: proj-xxxxxxxxxxxxxxxxxxxx
リクエスト・ボディapplication/json
descriptionstring
ジョブの説明。
regionIdstring必要
クラウドリージョン ID。
inputobject
Spark ジョブのデータリソース(入力または出力)参照。
typestring必要
データリソースのタイプ。
volumeNamestring必要
ボリューム名。
pathstring必要
ボリューム内のデータパス。
formatstring
データ形式。
writeModestring
書き込みモード。
dbNamestring
データベース名。
collectionNamestring
コレクション名。
outputobject
Spark ジョブのデータリソース(入力または出力)参照。
typestring必要
データリソースのタイプ。
volumeNamestring必要
ボリューム名。
pathstring必要
ボリューム内のデータパス。
formatstring
データ形式。
writeModestring
書き込みモード。
dbNamestring
データベース名。
collectionNamestring
コレクション名。
resourceSizestring
ジョブのリソースサイズ。
timeoutSecondsinteger
タイムアウト時間(秒)。
primaryKeyFieldstring必要
主キーフィールド。
vectorFieldstring必要
ベクトルフィールド。
metricstring
距離メトリック。
numClustersinteger必要
クラスターの数。
Create Spark Jobbash
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
}'
レスポンス201 Created - application/json
作成された Spark ジョブを返します。
成功レスポンス。
codeinteger
レスポンスコード。
値の例: 0
dataobject
Spark バッチジョブに関する概要情報。
jobIdstring必要
ジョブ ID。
projectIdstring必要
ジョブが属するプロジェクト ID。
typestring必要
ジョブタイプ。
descriptionstring
ジョブの説明。
statusstring必要
ジョブのステータス。
regionIdstring必要
クラウドリージョン ID。
clusterIdstring
クラスター ID。
createdAtstring
作成時刻(ISO 8601)。
startedAtstring
開始時刻(ISO 8601)。
finishedAtstring
終了時刻(ISO 8601)。
durationSecondsinteger<int64>
所要時間(秒)。
失敗レスポンス。
codeinteger
レスポンスコード。
messagestring
エラーメッセージ。
Successjson
{
"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"
}
}