{"id":13715896,"url":"https://github.com/milvus-io/milvus-sdk-node","last_synced_at":"2026-04-02T14:42:34.308Z","repository":{"id":38319706,"uuid":"360436551","full_name":"milvus-io/milvus-sdk-node","owner":"milvus-io","description":"The Official Mivus node.js sdk(client)","archived":false,"fork":false,"pushed_at":"2026-01-19T07:44:39.000Z","size":4595,"stargazers_count":190,"open_issues_count":16,"forks_count":53,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-01-19T16:11:53.825Z","etag":null,"topics":["milvus","sdk","sdk-node"],"latest_commit_sha":null,"homepage":"https://milvus.io","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/milvus-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2021-04-22T07:52:01.000Z","updated_at":"2026-01-19T07:44:40.000Z","dependencies_parsed_at":"2026-01-19T10:02:40.333Z","dependency_job_id":null,"html_url":"https://github.com/milvus-io/milvus-sdk-node","commit_stats":null,"previous_names":[],"tags_count":107,"template":false,"template_full_name":null,"purl":"pkg:github/milvus-io/milvus-sdk-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milvus-io%2Fmilvus-sdk-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milvus-io%2Fmilvus-sdk-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milvus-io%2Fmilvus-sdk-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milvus-io%2Fmilvus-sdk-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/milvus-io","download_url":"https://codeload.github.com/milvus-io/milvus-sdk-node/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milvus-io%2Fmilvus-sdk-node/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29363010,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T08:51:36.827Z","status":"ssl_error","status_checked_at":"2026-02-12T08:51:26.849Z","response_time":55,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["milvus","sdk","sdk-node"],"created_at":"2024-08-03T00:01:04.836Z","updated_at":"2026-04-02T14:42:34.299Z","avatar_url":"https://github.com/milvus-io.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @zilliz/milvus2-sdk-node\n\nOfficial 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.\n\n**Package**: `@zilliz/milvus2-sdk-node` | **Node.js**: v18+ | **License**: Apache-2.0\n\n[![npm version](https://img.shields.io/npm/v/@zilliz/milvus2-sdk-node)](https://www.npmjs.com/package/@zilliz/milvus2-sdk-node)\n[![downloads](https://img.shields.io/npm/dw/@zilliz/milvus2-sdk-node)](https://www.npmjs.com/package/@zilliz/milvus2-sdk-node)\n[![codecov](https://codecov.io/gh/milvus-io/milvus-sdk-node/branch/main/graph/badge.svg?token=Zu5FwWstwI)](https://codecov.io/gh/milvus-io/milvus-sdk-node)\n\n## Installation\n\n```bash\nnpm install @zilliz/milvus2-sdk-node\n# or\nyarn add @zilliz/milvus2-sdk-node\n```\n\n## Compatibility\n\n| Milvus version | SDK version | Install command                             |\n| :------------: | :---------: | :------------------------------------------ |\n|    v2.6.0+     |  **latest** | `yarn add @zilliz/milvus2-sdk-node@latest`  |\n|    v2.5.0+     |   v2.5.0    | `yarn add @zilliz/milvus2-sdk-node@2.5.12`  |\n|    v2.4.0+     |   v2.4.9    | `yarn add @zilliz/milvus2-sdk-node@2.4.9`   |\n\n## Quick Start\n\n### Connect to Milvus\n\n```typescript\nimport { MilvusClient } from '@zilliz/milvus2-sdk-node';\n\n// Local Milvus\nconst client = new MilvusClient({ address: 'localhost:19530' });\n\n// With authentication\nconst client = new MilvusClient({\n  address: 'localhost:19530',\n  username: 'root',\n  password: 'milvus',\n});\n\n// Zilliz Cloud\nconst client = new MilvusClient({\n  address: 'your-endpoint.zillizcloud.com',\n  token: 'your-api-key',\n});\n\n// Wait for connection to be ready\nawait client.connectPromise;\n```\n\n### Create Collection, Insert, and Search\n\n```typescript\nimport {\n  MilvusClient,\n  DataType,\n  MetricType,\n} from '@zilliz/milvus2-sdk-node';\n\nconst client = new MilvusClient({ address: 'localhost:19530' });\n\n// 1. Create collection with schema\nawait client.createCollection({\n  collection_name: 'my_collection',\n  fields: [\n    { name: 'id', data_type: DataType.Int64, is_primary_key: true, autoID: true },\n    { name: 'text', data_type: DataType.VarChar, max_length: 512 },\n    { name: 'vector', data_type: DataType.FloatVector, dim: 128 },\n  ],\n  index_params: [\n    {\n      field_name: 'vector',\n      index_type: 'HNSW',\n      metric_type: MetricType.COSINE,\n      params: { M: 16, efConstruction: 256 },\n    },\n  ],\n  enable_dynamic_field: true,\n});\n\n// 2. Load into memory (required before search/query)\nawait client.loadCollection({ collection_name: 'my_collection' });\n\n// 3. Insert data\nawait client.insert({\n  collection_name: 'my_collection',\n  data: [\n    { vector: Array(128).fill(0.1), text: 'doc1' },\n    { vector: Array(128).fill(0.2), text: 'doc2' },\n  ],\n});\n\n// 4. Search\nconst results = await client.search({\n  collection_name: 'my_collection',\n  data: [Array(128).fill(0.1)],\n  limit: 10,\n  output_fields: ['text'],\n});\nconsole.log(results.results);\n```\n\n---\n\n## API Reference\n\n### Imports\n\n```typescript\n// Main client\nimport { MilvusClient } from '@zilliz/milvus2-sdk-node';\n\n// HTTP client (for environments without gRPC support)\nimport { HttpClient } from '@zilliz/milvus2-sdk-node';\n\n// Enums and constants\nimport {\n  DataType,\n  MetricType,\n  IndexType,\n  ConsistencyLevelEnum,\n  ErrorCode,\n} from '@zilliz/milvus2-sdk-node';\n\n// Bulk writer for large-scale imports\nimport { BulkWriter } from '@zilliz/milvus2-sdk-node';\n```\n\n### Client Configuration\n\n```typescript\nnew MilvusClient({\n  address: string;              // Required. \"host:port\" or \"https://host:port\"\n  token?: string;               // Auth token (username:password or API key)\n  username?: string;            // Username for auth\n  password?: string;            // Password for auth\n  ssl?: boolean;                // Enable SSL/TLS\n  database?: string;            // Default database name\n  timeout?: number | string;    // Request timeout in ms (or string like '30s')\n  maxRetries?: number;          // Max retry attempts (default: 3)\n  retryDelay?: number;          // Retry delay in ms (default: 10)\n  logLevel?: string;            // 'debug' | 'info' | 'warn' | 'error'\n  trace?: boolean;              // Enable OpenTelemetry tracing\n  tls?: {                       // TLS certificate configuration\n    rootCertPath?: string;\n    privateKeyPath?: string;\n    certChainPath?: string;\n    serverName?: string;\n    skipCertCheck?: boolean;\n  };\n  pool?: {                      // Connection pool (generic-pool options)\n    max?: number;               // Max connections (default: 10)\n    min?: number;               // Min connections (default: 2)\n  };\n});\n```\n\n---\n\n### Data Operations\n\n#### insert\n\nInsert rows into a collection.\n\n```typescript\nawait client.insert({\n  collection_name: string;\n  data: Record\u003cstring, any\u003e[];      // Array of row objects\n  partition_name?: string;\n});\n// Returns: { succ_index: number[], err_index: number[], IDs: string[] | number[], ... }\n```\n\n#### upsert\n\nInsert or update rows (matched by primary key).\n\n```typescript\nawait client.upsert({\n  collection_name: string;\n  data: Record\u003cstring, any\u003e[];\n  partition_name?: string;\n});\n```\n\n#### delete\n\nDelete rows by filter expression or primary key IDs.\n\n```typescript\n// By filter\nawait client.delete({\n  collection_name: 'articles',\n  filter: 'age \u003e 18',\n});\n\n// By IDs\nawait client.delete({\n  collection_name: 'articles',\n  ids: [1, 2, 3],\n});\n```\n\n#### search\n\nVector similarity search.\n\n```typescript\nconst results = await client.search({\n  collection_name: string;\n  data: number[][] | number[];  // Query vector(s)\n  limit: number;                // Top-K results (default: 100)\n  output_fields?: string[];     // Fields to return\n  filter?: string;              // Scalar filter expression\n  metric_type?: MetricType;     // Distance metric\n  params?: {                    // Index-specific search params\n    ef?: number;                // HNSW ef (search width)\n    nprobe?: number;            // IVF nprobe\n    radius?: number;            // Range search radius\n    range_filter?: number;      // Range search filter\n  };\n  consistency_level?: ConsistencyLevelEnum;\n  partition_names?: string[];\n  group_by_field?: string;      // Group results by field\n});\n// Returns: { results: [{ id, score, ...output_fields }], ... }\n```\n\n#### query\n\nQuery rows with scalar filter expression.\n\n```typescript\nconst results = await client.query({\n  collection_name: string;\n  filter: string;               // Boolean expression, e.g. 'age \u003e 18 AND status == \"active\"'\n  output_fields?: string[];     // Fields to return (default: all)\n  limit?: number;\n  offset?: number;\n  consistency_level?: ConsistencyLevelEnum;\n  partition_names?: string[];\n});\n// Returns: { data: Record\u003cstring, any\u003e[] }\n```\n\n#### get\n\nGet rows by primary key IDs.\n\n```typescript\nconst results = await client.get({\n  collection_name: string;\n  ids: (string | number)[];\n  output_fields?: string[];\n});\n```\n\n#### count\n\nCount rows matching a filter.\n\n```typescript\nconst result = await client.count({\n  collection_name: string;\n  filter?: string;\n});\n// Returns: { data: number }\n```\n\n#### searchIterator\n\nPaginated vector search using async iterator.\n\n```typescript\nconst iterator = await client.searchIterator({\n  collection_name: string;\n  data: number[];\n  batchSize: number;\n  limit: number;\n  output_fields?: string[];\n  filter?: string;\n  expr?: string;\n});\n\nfor await (const batch of iterator) {\n  console.log(batch);  // Array of results per batch\n}\n```\n\n#### queryIterator\n\nPaginated query using async iterator.\n\n```typescript\nconst iterator = await client.queryIterator({\n  collection_name: string;\n  filter?: string;\n  batchSize: number;\n  limit: number;\n  output_fields?: string[];\n  expr?: string;\n});\n\nfor await (const batch of iterator) {\n  console.log(batch);\n}\n```\n\n#### hybridSearch\n\nMulti-vector search combining results from multiple vector fields with reranking.\n\n```typescript\nconst results = await client.hybridSearch({\n  collection_name: string;\n  rerank: WeightedReranker | RRFReranker;  // Reranking strategy\n  requests: Array\u003c{\n    data: number[][];\n    anns_field: string;\n    params?: Record\u003cstring, any\u003e;\n    limit?: number;\n    filter?: string;\n  }\u003e;\n  limit: number;\n  output_fields?: string[];\n});\n```\n\n---\n\n### Collection Management\n\n#### createCollection\n\n```typescript\nawait client.createCollection({\n  collection_name: string;\n  fields: FieldType[];               // Define schema fields\n  index_params?: CreateIndexParam[];  // Create indexes at collection creation time\n  enable_dynamic_field?: boolean;     // Allow inserting fields not in schema\n  consistency_level?: ConsistencyLevelEnum;\n  num_partitions?: number;\n});\n// Note: call loadCollection() after creation before search/query\n```\n\n#### Other collection operations\n\n```typescript\nawait client.hasCollection({ collection_name });          // { value: boolean }\nawait client.describeCollection({ collection_name });     // Schema, fields, properties\nawait client.batchDescribeCollections({ collection_names: string[] });  // Describe multiple collections\nawait client.showCollections();                           // List all collections\nawait client.loadCollection({ collection_name });         // Load into memory\nawait client.releaseCollection({ collection_name });      // Release from memory\nawait client.refreshLoad({ collection_name });            // Refresh loaded collection\nawait client.dropCollection({ collection_name });         // Delete collection\nawait client.renameCollection({ collection_name, new_collection_name });\nawait client.truncateCollection({ collection_name });     // Clear all data\nawait client.getLoadState({ collection_name });           // Loading status\nawait client.getCollectionStatistics({ collection_name });\nawait client.alterCollectionProperties({ collection_name, properties });\nawait client.alterCollectionFieldProperties({ collection_name, field_name, properties });\nawait client.dropCollectionProperties({ collection_name, delete_keys: string[] });\nawait client.addCollectionFunction({ collection_name, functions });\nawait client.dropCollectionFunction({ collection_name, functions });\n```\n\n---\n\n### Index Management\n\n```typescript\n// Create index\nawait client.createIndex({\n  collection_name: string;\n  field_name: string;\n  index_type?: IndexType;       // Default: AUTOINDEX\n  metric_type?: MetricType;     // Default: COSINE\n  params?: Record\u003cstring, any\u003e; // e.g. { M: 16, efConstruction: 256 }\n  index_name?: string;\n});\n\n// Other index operations\nawait client.describeIndex({ collection_name, field_name? });\nawait client.listIndexes({ collection_name });\nawait client.getIndexStatistics({ collection_name, index_name? });\nawait client.dropIndex({ collection_name, field_name, index_name? });\nawait client.getIndexState({ collection_name, field_name? });\nawait client.getIndexBuildProgress({ collection_name, field_name? });\nawait client.alterIndexProperties({ collection_name, index_name, properties });\nawait client.dropIndexProperties({ collection_name, index_name, delete_keys: string[] });\n```\n\n---\n\n### Partition Management\n\n```typescript\nawait client.createPartition({ collection_name, partition_name });\nawait client.hasPartition({ collection_name, partition_name });\nawait client.listPartitions({ collection_name });\nawait client.loadPartitions({ collection_name, partition_names: string[] });\nawait client.releasePartitions({ collection_name, partition_names: string[] });\nawait client.dropPartition({ collection_name, partition_name });\n```\n\n---\n\n### Database Management\n\n```typescript\nawait client.createDatabase({ db_name });\nawait client.listDatabases();\nawait client.describeDatabase({ db_name });\nawait client.alterDatabaseProperties({ db_name, properties });\nawait client.dropDatabaseProperties({ db_name, delete_keys: string[] });\nawait client.dropDatabase({ db_name });\n```\n\n---\n\n### User \u0026 Role Management (RBAC)\n\n```typescript\n// Users\nawait client.createUser({ username, password });\nawait client.updateUser({ username, oldPassword, newPassword });\nawait client.deleteUser({ username });\nawait client.listUsers();\n\n// Roles\nawait client.createRole({ roleName });\nawait client.dropRole({ roleName });\nawait client.listRoles();\nawait client.addUserToRole({ username, roleName });\nawait client.removeUserFromRole({ username, roleName });\n\n// Privileges\nawait client.grantPrivilege({ roleName, object, objectName, privilegeName });\nawait client.revokePrivilege({ roleName, object, objectName, privilegeName });\nawait client.listGrants({ roleName });\n\n// V2 privilege API\nawait client.grantPrivilegeV2({ role, privilege, collection_name, db_name });\nawait client.revokePrivilegeV2({ role, privilege, collection_name, db_name });\n```\n\n---\n\n### Alias Management\n\n```typescript\nawait client.createAlias({ collection_name, alias });\nawait client.dropAlias({ alias });\nawait client.alterAlias({ collection_name, alias });\nawait client.describeAlias({ alias });\nawait client.listAliases({ collection_name });\n```\n\n---\n\n### Resource Group Management\n\n```typescript\nawait client.createResourceGroup({ resource_group, config });\nawait client.listResourceGroups();\nawait client.describeResourceGroup({ resource_group });\nawait client.dropResourceGroup({ resource_group });\nawait client.transferReplica({ source_resource_group, target_resource_group, collection_name, num_replica });\n```\n\n---\n\n### Bulk Import\n\n#### BulkWriter — Generate import files offline\n\n```typescript\nimport { BulkWriter, DataType } from '@zilliz/milvus2-sdk-node';\n\nconst writer = new BulkWriter({\n  schema: {\n    fields: [\n      { name: 'id', data_type: DataType.Int64, is_primary_key: true },\n      { name: 'vector', data_type: DataType.FloatVector, dim: 128 },\n      { name: 'title', data_type: DataType.VarChar, max_length: 256 },\n    ],\n  },\n  format: 'parquet',  // 'json' or 'parquet'\n  localPath: './bulk_data',\n  chunkSize: 128 * 1024 * 1024,  // 128 MB per file\n});\n\n// Append rows\nfor (const row of rows) {\n  await writer.append(row);\n}\n\n// Finalize and get file paths\nconst batchFiles = await writer.close();\n// batchFiles: [['./bulk_data/batch_0/1.parquet'], ...]\n```\n\n#### Server-side import\n\n```typescript\n// Trigger bulk import (files must be on Milvus-accessible storage)\nawait client.bulkInsert({ collection_name, files: ['data.json'] });\n\n// Check import status\nawait client.getImportState({ taskId });\nawait client.listImportTasks({ collection_name });\n```\n\n---\n\n### Flush \u0026 Compaction\n\n```typescript\nawait client.flush({ collection_names: string[] });\nawait client.flushSync({ collection_names: string[] });       // Wait for completion\nawait client.flushAll();                                       // Flush all collections\nawait client.flushAllSync();                                   // Flush all and wait for completion\nawait client.compact({ collection_name });\nawait client.getCompactionState({ compactionID });\n```\n\n---\n\n### System Operations\n\n```typescript\nawait client.getVersion();                        // Milvus server version\nawait client.checkHealth();                       // Server health status\nawait client.reconnectToPrimary();                // Force reconnect to primary node\nawait client.runAnalyzer({ text, analyzer });     // Test text analyzer tokenization\n```\n\n---\n\n## Data Types\n\n### Scalar Types\n\n| DataType enum        | TypeScript value  | Notes                                 |\n| -------------------- | ----------------- | ------------------------------------- |\n| `DataType.Bool`      | `boolean`         |                                       |\n| `DataType.Int8`      | `number`          |                                       |\n| `DataType.Int16`     | `number`          |                                       |\n| `DataType.Int32`     | `number`          |                                       |\n| `DataType.Int64`     | `number \\| string` | Use string for values \u003e 2^53         |\n| `DataType.Float`     | `number`          |                                       |\n| `DataType.Double`    | `number`          |                                       |\n| `DataType.VarChar`   | `string`          | Requires `max_length`                 |\n| `DataType.JSON`      | `object`          |                                       |\n| `DataType.Array`     | `any[]`           | Requires `element_type`, `max_capacity` |\n\n### Vector Types\n\n| DataType enum                | Data format                        | Field param   |\n| ---------------------------- | ---------------------------------- | ------------- |\n| `DataType.FloatVector`       | `number[]`                         | `dim: number` |\n| `DataType.BinaryVector`      | `number[]` (uint8 bytes)           | `dim: number` |\n| `DataType.Float16Vector`     | `number[]`                         | `dim: number` |\n| `DataType.BFloat16Vector`    | `number[]`                         | `dim: number` |\n| `DataType.Int8Vector`        | `number[]`                         | `dim: number` |\n| `DataType.SparseFloatVector` | `Record\u003cnumber, number\u003e` or array  | no dim needed |\n\n### Field Definition\n\n```typescript\ninterface FieldType {\n  name: string;\n  data_type: DataType;\n  is_primary_key?: boolean;\n  autoID?: boolean;\n  dim?: number;                    // Required for vector types\n  max_length?: number;             // Required for VarChar\n  element_type?: DataType;         // Required for Array\n  max_capacity?: number;           // Required for Array\n  default_value?: any;\n  is_partition_key?: boolean;\n  enable_analyzer?: boolean;       // For full-text search\n  analyzer_params?: object;\n}\n```\n\n---\n\n## Enums \u0026 Constants\n\n### MetricType\n\n```typescript\nMetricType.L2          // Euclidean distance (smaller = more similar)\nMetricType.IP          // Inner product (larger = more similar)\nMetricType.COSINE      // Cosine similarity (larger = more similar)\nMetricType.HAMMING     // Hamming distance (binary vectors)\nMetricType.JACCARD     // Jaccard distance (binary vectors)\nMetricType.BM25        // BM25 relevance (sparse/text)\n```\n\n### IndexType\n\n```typescript\nIndexType.AUTOINDEX    // Automatic selection (recommended)\nIndexType.HNSW         // High recall, in-memory\nIndexType.IVF_FLAT     // Balanced speed/recall\nIndexType.IVF_SQ8      // Compressed IVF\nIndexType.IVF_PQ       // High compression IVF\nIndexType.FLAT         // Brute-force (exact)\nIndexType.DISKANN      // On-disk index\nIndexType.BIN_FLAT     // Binary brute-force\nIndexType.BIN_IVF_FLAT // Binary IVF\nIndexType.SPARSE_INVERTED_INDEX  // Sparse vectors\nIndexType.SPARSE_WAND           // Sparse vectors (WAND)\n```\n\n### ConsistencyLevelEnum\n\n```typescript\nConsistencyLevelEnum.Strong      // Read-after-write guarantee\nConsistencyLevelEnum.Session     // Session-level consistency\nConsistencyLevelEnum.Bounded     // Bounded staleness\nConsistencyLevelEnum.Eventually  // Best performance\n```\n\n### ErrorCode\n\n```typescript\nErrorCode.SUCCESS             // Operation succeeded\nErrorCode.UnexpectedError     // Internal error\nErrorCode.CollectionNotExists // Collection not found\nErrorCode.IllegalArgument     // Invalid argument\nErrorCode.RateLimit           // Rate limited\n```\n\n---\n\n## Filter Expressions\n\nUsed in `search({ filter })`, `query({ filter })`, `delete({ filter })`.\n\n```\n# Comparison\nage \u003e 18\nprice \u003c= 99.9\nstatus == \"active\"\nname != \"test\"\n\n# Logical operators\nage \u003e 18 AND status == \"active\"\nprice \u003c 10 OR price \u003e 100\nNOT (status == \"deleted\")\n\n# IN operator\nid IN [1, 2, 3]\ncategory IN [\"books\", \"music\"]\n\n# String matching\ntitle LIKE \"hello%\"         # Starts with \"hello\"\ntitle LIKE \"%world\"         # Ends with \"world\"\n\n# Array operations\nARRAY_CONTAINS(tags, \"ai\")\nARRAY_LENGTH(tags) \u003e 3\n\n# JSON field access\nmetadata[\"key\"] == \"value\"\nmetadata[\"nested\"][\"field\"] \u003e 10\n\n# Template expressions (parameterized)\nawait client.query({\n  collection_name: 'test',\n  filter: 'age \u003e {min_age}',\n  filter_params: { min_age: 18 },\n});\n```\n\n---\n\n## HTTP Client\n\nFor environments where gRPC is not available (Cloudflare Workers, Vercel Edge, AWS Lambda).\n\n```typescript\nimport { HttpClient } from '@zilliz/milvus2-sdk-node';\n\nconst client = new HttpClient({\n  endpoint: 'localhost:19530',    // or Zilliz Cloud endpoint\n  username: 'root',               // optional\n  password: 'milvus',             // optional\n  token: 'your-api-key',          // optional (for Zilliz Cloud)\n  database: 'default',            // optional\n  timeout: 60000,                 // optional, ms\n});\n\n// Same API surface as MilvusClient for data operations\nawait client.createCollection({ ... });\nawait client.insert({ ... });\nawait client.search({ ... });\nawait client.query({ ... });\n```\n\n---\n\n## Error Handling\n\n```typescript\nimport { ErrorCode } from '@zilliz/milvus2-sdk-node';\n\ntry {\n  const res = await client.createCollection({ ... });\n  if (res.error_code !== ErrorCode.SUCCESS) {\n    console.error('Milvus error:', res.reason);\n  }\n} catch (err) {\n  console.error('Connection/transport error:', err.message);\n}\n```\n\n---\n\n## Common Patterns\n\n### Hybrid Search (vector + scalar filter)\n\n```typescript\nconst results = await client.search({\n  collection_name: 'products',\n  data: [queryVector],\n  limit: 20,\n  filter: 'category == \"electronics\" AND price \u003c 500',\n  output_fields: ['name', 'price', 'category'],\n});\n```\n\n### Dynamic Fields\n\n```typescript\n// Enable dynamic fields on collection\nawait client.createCollection({\n  collection_name: 'flexible',\n  fields: [\n    { name: 'id', data_type: DataType.Int64, is_primary_key: true, autoID: true },\n    { name: 'vector', data_type: DataType.FloatVector, dim: 128 },\n  ],\n  enable_dynamic_field: true,\n});\n\nawait client.loadCollection({ collection_name: 'flexible' });\n\n// Insert with arbitrary fields — extra fields stored dynamically\nawait client.insert({\n  collection_name: 'flexible',\n  data: [\n    { vector: [...], color: 'red', score: 0.95 },\n    { vector: [...], color: 'blue', tags: ['a', 'b'] },\n  ],\n});\n\n// Query dynamic fields\nawait client.query({\n  collection_name: 'flexible',\n  filter: 'color == \"red\"',\n  output_fields: ['color', 'score'],\n});\n```\n\n### Sparse Vector Search (e.g. BM25)\n\n```typescript\nawait client.createCollection({\n  collection_name: 'docs',\n  fields: [\n    { name: 'id', data_type: DataType.Int64, is_primary_key: true, autoID: true },\n    { name: 'sparse_vector', data_type: DataType.SparseFloatVector },\n  ],\n});\n\nawait client.insert({\n  collection_name: 'docs',\n  data: [\n    { sparse_vector: { 0: 0.5, 10: 0.3, 200: 0.8 } },   // dict format\n    { sparse_vector: { 1: 0.1, 50: 0.9 } },\n  ],\n});\n\nawait client.search({\n  collection_name: 'docs',\n  data: [{ 0: 0.5, 10: 0.3 }],\n  anns_field: 'sparse_vector',\n  limit: 10,\n});\n```\n\n### Partition Key (auto-routing)\n\n```typescript\nawait client.createCollection({\n  collection_name: 'multi_tenant',\n  fields: [\n    { name: 'id', data_type: DataType.Int64, is_primary_key: true, autoID: true },\n    { name: 'tenant', data_type: DataType.VarChar, max_length: 64, is_partition_key: true },\n    { name: 'vector', data_type: DataType.FloatVector, dim: 128 },\n  ],\n  num_partitions: 16,\n});\n\n// Milvus automatically routes by partition key\nawait client.search({\n  collection_name: 'multi_tenant',\n  data: [queryVector],\n  filter: 'tenant == \"user_123\"',   // Scoped to partition\n  limit: 10,\n});\n```\n\n---\n\n### Advanced Features\n\nFor detailed guides on advanced features, visit the documentation:\n\n- **[Hybrid Search](docs/content/operations/hybrid-search.mdx)** — Multi-vector search with reranking\n- **[Full-Text Search](docs/content/advanced/full-text-search.mdx)** — BM25 keyword search with text analyzers\n- **[Iterators](docs/content/operations/iterators.mdx)** — Paginate through large result sets\n- **[Global Cluster](docs/content/advanced/global-cluster.mdx)** — Multi-region failover support\n\n---\n\n## Links\n\n- [Full Documentation](https://milvus-io.github.io/milvus-sdk-node)\n- [Milvus Documentation](https://milvus.io/docs)\n- [GitHub Repository](https://github.com/milvus-io/milvus-sdk-node)\n- [Zilliz Cloud](https://cloud.zilliz.com/)\n- [Examples](https://github.com/milvus-io/milvus-sdk-node/tree/main/examples)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilvus-io%2Fmilvus-sdk-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmilvus-io%2Fmilvus-sdk-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilvus-io%2Fmilvus-sdk-node/lists"}