UNPKG

@zilliz/milvus2-sdk-node

Version:

Official Node.js SDK for [Milvus](https://github.com/milvus-io/milvus) vector database. Provides gRPC and HTTP clients for vector similarity search, metadata filtering, and full collection/index/user management.

60 lines (59 loc) • 2.9 kB
import { ChannelOptions } from '@grpc/grpc-js'; import { GRPCClient, ClientConfig, CreateColReq, ResStatus, CreateCollectionReq, SearchReq, SearchSimpleReq, HybridSearchReq, SearchIteratorReq, QueryReq, QueryIteratorReq, GetReq, SearchResults, QueryResults, CreateColWithSchemaAndIndexParamsReq } from '.'; /** * Milvus Client class that extends GRPCClient and handles communication with Milvus server. */ export declare class MilvusClient extends GRPCClient { /** * Returns the SDK information. * SDK information will be generated on the building phase * @returns Object containing SDK version and recommended Milvus version. */ static get sdkInfo(): { version: string; recommendMilvus: string; }; /** * Creates a new instance of MilvusClient. * @param configOrAddress The Milvus server's address or client configuration object. * @param ssl Whether to use SSL or not. * @param username The username for authentication. * @param password The password for authentication. * @param channelOptions Additional channel options for gRPC. */ constructor(configOrAddress: ClientConfig | string, ssl?: boolean, username?: string, password?: string, channelOptions?: ChannelOptions); /** * Creates a lightweight DQL session pinned to a target cluster. * The session reuses this client's connection and injects `cluster_id` into * search/query/get/iterator request parameters. * @param clusterId The target cluster id. */ session(clusterId: string): MilvusClientSession; /** * Creates a new collection with the given parameters. * @function create_collection * @param {CreateColReq | CreateColWithSchemaAndIndexParamsReq | CreateCollectionReq} data - The data required to create the collection. * @returns {Promise<ResStatus>} - The result of the operation. */ createCollection(data: CreateColReq | CreateColWithSchemaAndIndexParamsReq | CreateCollectionReq): Promise<ResStatus>; } /** * Lightweight DQL session bound to a cluster id and backed by a parent client. * Closing the session only prevents future session calls; it does not close the * parent client or its gRPC channel pool. */ export declare class MilvusClientSession { private readonly parent; private readonly clusterId; private closed; constructor(parent: MilvusClient, clusterId: string); private ensureOpen; private withClusterId; close(): void; search<T extends SearchReq | SearchSimpleReq | HybridSearchReq>(params: T): Promise<SearchResults<T>>; hybridSearch<T extends HybridSearchReq>(params: T): Promise<SearchResults<T>>; searchIterator(param: SearchIteratorReq): Promise<any>; query(data: QueryReq): Promise<QueryResults>; queryIterator(data: QueryIteratorReq): Promise<any>; get(data: GetReq): Promise<QueryResults>; }