跳到主要内容

创建导入任务

This operation imports the prepared data files to a Zilliz Cloud cluster. To learn how to prepare your data files, read Prepare Data Import.

POST
/v2/vectordb/jobs/import/create
Base URL

该 API 的 Base URL 格式如下:

https://api.cloud.zilliz.com

export BASE_URL="https://api.cloud.zilliz.com"
参数
Authorizationstringheaderrequired

认证令牌,应为具备适当权限的 API 密钥。

示例值:Bearer {{TOKEN}}
请求体application/json
clusterIdstring必填项

Collection 所属的集群 ID。设置为不存在的集群将导致错误。您可以通过调用 /v2/clusters 端点获取集群 ID,或从 Zilliz Cloud 控制台 复制集群 ID。

示例值:inxx-xxxxxxxxxxxxxxxx
collectionNamestring必填项

目标 Collection 的名称。设置为不存在的 Collection 将导致错误。

partitionNamestring

目标 Partition 的名称。设置为不存在的 Partition 将导致错误。

objectUrlstring必填项

待导入数据的 URL。该 URL 应来自与诸如阿里云 OSS 或腾讯云 COS 等与 MinIO S3 兼容的对象存储服务。

accessKeystring

对象存储服务的访问密钥 (AK)。

secretKeystring

对象存储服务的访问密钥 (SK)。

tokenstring

A temporary token for you to access the object storage service. The token name and the way to obtain it may vary with cloud providers. For details, refer to the FAQ.

export TOKEN="YOUR_API_KEY"

curl --request POST \
--url "${BASE_URL}/v2/vectordb/jobs/import/create" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Content-Type: application/json" \
-d '{
"clusterId": "inxx-xxxxxxxxxxxxxxx",
"collectionName": "medium_articles",
"partitionName": "",
"objectUrl": "https://s3.us-west-2.amazonaws.com/publicdataset.zillizcloud.com/medium_articles_2020_dpr/medium_articles_2020_dpr.json",
"accessKey": "",
"secretKey": ""
}'
响应200 - application/json
codeinteger

响应码。

示例值:0
dataarray

响应负载,包含了当前操作创建的批量导入任务的 ID。

[]dataobject

A created bulk-import job.

jobIdstring

当前创建的批量导入任务 ID。

Returns an error message.

codeinteger

响应码。

messagestring

错误描述。

{
"code": 0,
"data": {
"jobId": "job-xxxxxxxxxxxxxxxxxxxxx"
}
}