You need to enable JavaScript to run this app.
导航

update

最近更新时间2024.04.16 13:11:56

首次发布时间2024.01.04 18:48:39

概述

/index/update 接口用于更新指定 Index 的描述、cpu_quota、scalar_index。

请求接口

说明

请求向量数据库 VikingDB 的 OpenAPI 接口时,需要构造签名进行鉴权,详细的 OpenAPI 签名调用方法请参见 API签名调用指南

URI

/api/index/update

统一资源标识符

请求方法

POST

客户端对向量数据库服务器请求的操作类型

请求头

Content-Type: application/json

请求消息类型

Authorization: HMAC-SHA256 ***

鉴权

请求参数

参数

类型

是否必选

参数说明

collection_name

string

指定更新索引所属的 Collection 名称。

  • 只能使用英文字母、数字、下划线_,并以英文字母开头,不能为空。
  • 长度要求:[1, 128]。
  • Collection 名称不能重复。

index_name

string

指定更新的索引 Index 名称。

  • 只能使用英文字母、数字、下划线_,并以英文字母开头,不能为空。
  • 长度要求:[1, 128]。
  • 索引名称不能重复。

cpu_quota

int

索引检索消耗的 CPU 配额,格式为正整数。

  • 与吞吐量有关,和延迟无关,1CPU 核约为 100QPS。
  • N个分片数量N倍的 CPU 消耗;如果检索消耗的 CPU 超过配额,该索引会被限流。
  • 取值范围:[2, 10240]。

description

string

更新索引的描述。

scalar_index

array

更新标量字段列表,设置需要构建到标量索引的字段。其中,float、int64 字段可用于范围检索,非 float 字段可用于枚举检索。

  • scalar_index 默认为 None,表示所有字段构建到标量索引。
  • scalar_index 为 [] 时,表示无标量索引。
  • scalar_index 为非空列表时,表示将列表内字段构建到标量索引。

shard_count

int

  • 分片数最大不超过256,默认为1,分片数预估参考:数据预估数据量/3000万。

响应消息

参数

参数说明

code

状态码

message

返回信息

request_id

标识每个请求的唯一标识符

状态码说明

状态码

http状态码

返回信息

状态码说明

0

200

success

索引 Index 更新成功。

1000005

400

collection not exist

索引相关的 Collection 不存在。

1000008

400

index not exist

指定的 Index 不存在。

1000003

400

invalid request:%s

非法参数。

1000001

401

unauthorized

请求头中缺乏鉴权信息。

1000002

403

no permission

权限不足。

完整示例

请求消息

curl -i -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: HMAC-SHA256 ***' \
  http://***/api/index/update \
  -d '{
    "collection_name": "test_name",
    "index_name": "index_test",
    "description": "update for index",
    "cpu_quota": 10,
    "scalar_index": ["city", "date"]
}'

响应消息

执行成功返回:

HTTP/1.1 200 OK
Content-Length: 43
Content-Type: application/json
 
{"code":0,"message":"success","request_id":"021695029736548fd001de66666000000000000000000029aa917"}

执行失败返回:

HTTP/1.1 400 OK
Content-Length: 43
Content-Type: application/json
 
{"code":1000005, "message":"collection not exist", "request_id":"021695029736548fd001de66666000000000000000000029aa917"}