import { type ScalarFieldInfo, type ScalarFieldType, VikingdbResponse } from "../types"; import { Distance, type IndexStatus, IndexType, Quant, ShardPolicy } from "./backend"; export { Distance, IndexType, Quant, ShardPolicy } from "./backend"; export interface DropIndexRequest { CollectionName: string; IndexName: string; } export type GetIndexInfoRequest = DropIndexRequest; interface HnswVector1 { IndexType: IndexType.Hnsw; Distance: Exclude; Quant: Exclude; HnswM?: number; HnswCef?: number; HnswSef?: number; } interface HnswVector2 { IndexType: IndexType.Hnsw; Distance: Distance.l2; Quant: Exclude; HnswM?: number; HnswCef?: number; HnswSef?: number; } export type HnswVector = HnswVector1 | HnswVector2; interface HnswHybridVector1 { IndexType: IndexType.HnswHybrid; Distance: Exclude; Quant: Exclude; } interface HnswHybridVector2 { IndexType: IndexType.HnswHybrid; Distance: Distance.l2; Quant: Exclude; } export type HnswHybridVector = HnswHybridVector1 | HnswHybridVector2; interface FlatVector1 { IndexType: IndexType.Flat; Distance: Exclude; Quant: Exclude; } interface FlatVector2 { IndexType: IndexType.Flat; Distance: Distance.l2; Quant: Exclude; } export type FlatVector = FlatVector1 | FlatVector2; export interface DiskannVector { IndexType: IndexType.Diskann; Distance: Distance; Quant: Exclude; DiskannM?: number; DiskannCef?: number; CacheRatio?: number; PqCodeRatio?: number; } export interface IvfVector { IndexType: IndexType.Ivf; Distance: Exclude; Quant: Quant.PQ; } export type VectorIndex = HnswVector | HnswHybridVector | FlatVector | DiskannVector | IvfVector; export interface IndexInfo { CollectionName: string; IndexName: string; CpuQuota: number; Description?: string; ShardPolicy: ShardPolicy; ShardCount: number; PartitionBy?: string; Partitions?: string[]; VectorIndex?: VectorIndex; ScalarIndex?: ScalarFieldInfo[]; Status: IndexStatus; IndexCost: { CpuCore: number; MemoryGb: string; }; CreateTime: string; UpdateTime: string; UpdatePerson: string; } export declare class GetIndexInfoResponse extends VikingdbResponse { readonly IndexInfo: IndexInfo; constructor(IndexInfo: IndexInfo, OriginalRequest: string, LogId: string); } export interface ListIndexesRequest { CollectionName: string; } export declare class ListIndexesResponse extends VikingdbResponse { readonly ListIndexes: IndexInfo[]; constructor(ListIndexes: IndexInfo[], OriginalRequest: string, LogId: string); } export type ShardConfig = { ShardPolicy: ShardPolicy.Custom; ShardCount: number; } | { ShardPolicy: ShardPolicy.Auto; }; export interface CreateIndexRequest { CollectionName: string; IndexName: string; Description?: string; CpuQuota?: number; ShardConfig: ShardConfig; VectorIndex?: VectorIndex; PartitionBy?: string; /** 标量过滤字段 */ ScalarIndexes?: string[]; } export interface UpdateIndexRequest extends Omit { ShardConfig?: ShardConfig; }