跳到主要内容

合并数据
内测版

对指定 Collection 和存储在指定位置的待插入字段的数据集利用指定的合并键进行左连接,并生成新的 Collection,其中包含合并后的数据。必须是项目管理员及以上权限才能执行此操作。
POST
/v2/etl/merge
Base URL

该 API 的 Base URL 格式如下:

https://api.cloud.zilliz.com.cn

📘说明

控制面接口速率限制为单用户单接口每秒最多 20 个请求。

当前接口为公测版。如果您在使用该接口过程中遇到任何问题,欢迎您联系 Zilliz Cloud 技术支持

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

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

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

本操作目标 Collection 所在集群的名称。

示例值:in00-xxxxxxxxxxxxxxxxxx
dbNamestring

本操作目标 Collection 所在数据库的名称。

collectionNamestring

本操作目标 Collection 的名称。

destDbNamestring

待创建 Collection 所在数据库的名称。

destCollectionNamestring

待创建 Collection 的名称。该 Collection 将保存合并后的数据。

dataSourceobject

待与指定 Collection 合并的数据。您需要将待合并数据存为 PARQUET 文件,然后将其上传到 Zilliz Cloud 可以访问的对象存储桶中。在此参数中,您需要提供待合并数据文件的 URL 及存放该数据文件的存储桶的访问凭据。

typestring

数据源的类型。

stageNamestring

Zilliz Cloud 存储点的名称。此参数仅当您将 type 设置为 stage 时有效。有关创建存储点的详细信息,请参阅 Create Stage 操作的文档。

dataPathstring

待与指定 Collection 合并的 PARQUET 文件的 URL。

示例值:s3://my-bucket/my_data.parquet
credentialobject

存放待合并数据文件的存储桶的访问凭据。

accessKeystring

存放待合并数据文件的存储桶的访问密钥。

secretKeystring

存放待合并数据文件的存储桶的访问密钥。

mergeFieldstring

作为合并键的字段名称。该字段必须同时存在于待合并 Collection 和待插入数据记录中。在一般情况下,您可以使用主键作为合并字段。

newFieldsarray

待创建 Collection 的各字段数据结构。该参数的值应该为字段数据结构数组。

[]newFieldsobject

The schema of a field to add.

fieldNamestring

Name of the current field to add.

dataTypestring

Data type of the current field to add.

paramsobject

Extra settings for the current field to add.

maxLengthinteger

VARCHAR 字段的最大长度。该参数仅当 dataType 设置为 VARCHAR 时可用。

export TOKEN="YOUR_API_KEY"

curl --request POST \
--url "${BASE_URL}/v2/etl/merge" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Content-Type: application/json" \
-d '{
"clusterId": "in00-xxxxxxxxxxxxxxx",
"dbName": "my_database",
"collectionName": "my_collection",
"targetDbName": "my_database",
"targetCollectionName": "my_merged_collection",
"mergeData": {
"dataPath": "s3://my-bucket/my_data.parquet",
"regionId": "us-west-2",
"credential": {
"accessKey": "my-access-key",
"secretKey": "my-secret-key"
}
},
"mergeKey": "id",
"mergeFieldSchema": [
{
"name": "my_field1",
"dataType": "VARCHAR",
"params": {
"maxLength": 512
}
}
]
}'
响应200 - application/json
codeinteger

响应码。

示例值:0
dataarray

响应负载,包含了当前操作创建的数据合并任务的 ID。

[]dataobject

A created data-merge job.

jobIdstring

当前创建的数据合并任务 ID。

Returns an error message.

codeinteger

响应码。

messagestring

错误描述。

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