修改索引
更新时间:2025-04-18
POST
http://{host}/v{version}/index?modify
修改向量索引信息,目前只支持修改autoBuild属性。
权限说明
鉴权认证机制的详细内容请参见鉴权认证
请求参数
Headers 参数
除公共头域外,无其它特殊头域
URL 参数
version
string
API版本号,当前取1。
必选
host
string
"{实例IP}:{实例Port}"
必选
Query 参数
modify
string
修改索引操作
可选
Body 参数
database
string
指定库的名称。
必选
table
string
指定表的名称。
必选
index
object {3}
索引定义详情。
必选
显示子属性
隐藏子属性
autoBuild
boolean
是否自动构建索引。
必选
indexName
string
索引名称,要求表内唯一。索引名称的命名要求如下:
- 仅支持大小写字母、数字以及下划线(_),必须以字母开头;
- 长度限制为1~255。
必选
autoBuildPolicy
object {5}
构建索引策略。
可选
显示子属性
隐藏子属性
timing
string
- 定时构建索引,支持格式为LOCAL(%Y-%m-%d %H:%M:%S)以及UTC(%Y-%m-%dT%H:%M:%Z),在policyType为timing时生效时只构建一次,不会重复构建。
- 当policyType为periodical时,传入的时间作为周期性策略的开始时间
可选
policyType
string
自动构建索引策略类型,大小写不敏感,支持的类型如下:
- timing:定时构建索引,只构建一次。
- periodical:周期性构建索引,每过多少秒会构建一次索引。
- row_count_increment:根据tablet增加多少行数构建一次索引。
可选
periodInSecond
integer
周期性构建索引的参数,每过periodInSecond构建一次索引,只在policyType为periodical时生效。可以指定从某个时间点开始,通过上面的timing参数传入。周期不能低于3600
可选
rowCountIncrement
integer
当tablet(不是table)增加或者减少行数大于rowCountIncrement时构建一次索引,只在policyType为row_count_increment时生效。不能低于10000
可选
rowCountIncrementRatio
number
当tablet增加或者减少行数百分比大于rowCountIncrementRatio时构建一次索引,只在policyType为row_count_increment时生效。不能小于等于0
可选
请求结构
POST /v{version}/index?modify HTTP/1.1
HOST: {Endpoint}
Authorization: {Authorization}
{
"database": "db_name",
"table": "table_name",
"index": {
"indexName": "vector_idx",
"autoBuild": true,
"autoBuildPolicy": {
"policyType": "PERIODICAL",
"periodInSecond": 5000,
"timing": "2026-01-01 12:00:00"
}
}
}
示例代码
请求示例
curl --location 'http://vdb.nXWNyPCOSLci.vdb.bj.baidubce.com/v1/index?modify' \
--header 'Authorization: Bearer account=root&api_key=eC4bLRy2va******************************' \
--header 'Content-Type: application/json' \
--data '{
"database": "db_name",
"table": "table_name",
"index": {
"indexName": "vector_idx",
"autoBuild": true,
"autoBuildPolicy": {
"policyType": "PERIODICAL",
"periodInSecond": 5000,
"timing": "2026-01-01 12:00:00"
}
}
}'
返回响应
Headers 参数
除公共头域外,无其它特殊头域
返回参数
msg
string
返回信息
可选
code
integer
返回码
可选
响应示例
{
"code": 0,
"msg": "Success"
}
