You need to enable JavaScript to run this app.
导航
Collection 数据过滤更新任务
最近更新时间:2025.04.27 17:35:23首次发布时间:2025.04.27 17:35:23
我的收藏
有用
有用
无用
无用

概述

按特定条件批量更新数据,不支持vector、sparse_vector、text 类型字段的更新

请求参数

参数名

类型

必须

说明

子字段

类型

必选

说明

task_type

string

任务类型,填入 filter_update

task_params

map

任务参数

collection_name

string

Collection 名称,必填

filter_conds

map

过滤条件,支持 must 、must_nor、range、range_out 算子,使用参考标量过滤
过滤更新 city 为 beijing 且 user_id (0, 4) 之间的数据

[
    {
        "op": "must",
        "field": "city",
        "conds": ["beijing"]
    },
    {
        "op": "range",
        "field": "user_id",
        "gt": 0,
        "lt": 4
    },

]

update_fileds

map

需要更新的字段值,必须是标量字段,不支持vector、sparse_vector、text 类型字段的更新

{
   "user_name":"xxx"
}

示例

请求参数

curl -i -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: HMAC-SHA256 ***' \
  https://api-vikingdb.volces.com/api/task/create \
  -d '{
    "task_type": "filter_update",
    "task_params": {
        "collection_name": "example", #collection 名称
        "filter_conds": [
            {
                "op": "must",
                "field": "city",
                "conds": ["beijing"]
            },
            {
                "op": "range",
                "field": "user_id",
                "gt": 0,
                "lt": 4
            },
        ],
        "update_fields": {
            "city": "shanghai"
        }
    }
}'

返回值

属性

说明

task_id

uuid