向量数据库VikingDB
UpdateIndex接口用于更新指定 Index 的描述、CpuQuota、ScalarIndex。
字段名 | 类型 | 是否必传 | 说明 |
|---|---|---|---|
CollectionName |
| 是 | 数据集名称 |
IndexName |
| 是 | 索引名称 |
Description |
| 否 | 索引描述 |
CpuQuota |
| 否 | 索引 CPU 用量 |
ShardConfig |
| 否 | 索引分片配置 |
ScalarIndexes |
| 否 | 标量过滤字段 |
type ShardConfig = | { ShardPolicy: ShardPolicy.Custom; ShardCount: number; } | { ShardPolicy: ShardPolicy.Auto; };
declare class VikingdbResponse { readonly OriginalRequest: string; readonly LogId: string; constructor( OriginalRequest: string, LogId: string ); }
以下示例分别展示自定义分片和自动分片,两种策略不要放在同一个请求对象中。
import { vikingdb } from '@volcengine/openapi' declare const service: vikingdb.VikingdbService // 替换为你初始化好的实例 await service.index.UpdateIndex({ CollectionName: 'test_collection_1', IndexName: 'test_index_1', ShardConfig: { ShardPolicy: vikingdb.index.ShardPolicy.Custom, ShardCount: 10, }, ScalarIndexes: ['Name'], }) await service.index.UpdateIndex({ CollectionName: 'test_collection_1', IndexName: 'test_index_2', ShardConfig: { ShardPolicy: vikingdb.index.ShardPolicy.Auto }, })
参考示例已拆分为自定义分片与自动分片两个独立 UpdateIndex 调用,移除了单个对象内重复的 ShardConfig 键。