UNPKG

@qdrant/js-client-rest

Version:

This repository contains the REST client for the [Qdrant](https://github.com/qdrant/qdrant) vector search engine.

1,149 lines (1,148 loc) 57 kB
import { Client } from '../api-client.js'; export declare function createCollectionsApi(client: Client): { /** * Get cluster information for a collection */ readonly collectionClusterInfo: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ parameters: { path: { collection_name: string; }; }; responses: { 200: { content: { "application/json": { time?: number | undefined; status?: string | undefined; result?: { peer_id: number; shard_count: number; local_shards: { shard_id: number; shard_key?: string | number | Record<string, unknown> | null | undefined; points_count: number; state: "Active" | "Dead" | "Partial" | "Initializing" | "Listener" | "PartialSnapshot" | "Recovery"; }[]; remote_shards: { shard_id: number; shard_key?: string | number | Record<string, unknown> | null | undefined; peer_id: number; state: "Active" | "Dead" | "Partial" | "Initializing" | "Listener" | "PartialSnapshot" | "Recovery"; }[]; shard_transfers: { shard_id: number; from: number; to: number; sync: boolean; method?: Record<string, unknown> | "stream_records" | "snapshot" | "wal_delta" | null | undefined; comment?: string | null | undefined; }[]; resharding_operations: { direction: "up" | "down"; shard_id: number; peer_id: number; shard_key?: string | number | Record<string, unknown> | null | undefined; comment?: string | null | undefined; }[]; } | undefined; }; }; }; default: { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; "4XX": { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; }; }>; /** * Create new collection with given parameters */ readonly createCollection: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ parameters: { query?: { timeout?: number | undefined; } | undefined; path: { collection_name: string; }; }; requestBody?: { content: { "application/json": { vectors?: { size: number; distance: "Cosine" | "Euclid" | "Dot" | "Manhattan"; hnsw_config?: Record<string, unknown> | { m?: number | null | undefined; ef_construct?: number | null | undefined; full_scan_threshold?: number | null | undefined; max_indexing_threads?: number | null | undefined; on_disk?: boolean | null | undefined; payload_m?: number | null | undefined; } | null | undefined; quantization_config?: Record<string, unknown> | { scalar: { type: "int8"; quantile?: number | null | undefined; always_ram?: boolean | null | undefined; }; } | { product: { compression: "x4" | "x8" | "x16" | "x32" | "x64"; always_ram?: boolean | null | undefined; }; } | { binary: { always_ram?: boolean | null | undefined; }; } | null | undefined; on_disk?: boolean | null | undefined; datatype?: Record<string, unknown> | "float32" | "uint8" | "float16" | null | undefined; multivector_config?: Record<string, unknown> | { comparator: "max_sim"; } | null | undefined; } | { [key: string]: { size: number; distance: "Cosine" | "Euclid" | "Dot" | "Manhattan"; hnsw_config?: Record<string, unknown> | { m?: number | null | undefined; ef_construct?: number | null | undefined; full_scan_threshold?: number | null | undefined; max_indexing_threads?: number | null | undefined; on_disk?: boolean | null | undefined; payload_m?: number | null | undefined; } | null | undefined; quantization_config?: Record<string, unknown> | { scalar: { type: "int8"; quantile?: number | null | undefined; always_ram?: boolean | null | undefined; }; } | { product: { compression: "x4" | "x8" | "x16" | "x32" | "x64"; always_ram?: boolean | null | undefined; }; } | { binary: { always_ram?: boolean | null | undefined; }; } | null | undefined; on_disk?: boolean | null | undefined; datatype?: Record<string, unknown> | "float32" | "uint8" | "float16" | null | undefined; multivector_config?: Record<string, unknown> | { comparator: "max_sim"; } | null | undefined; } | undefined; } | undefined; shard_number?: number | null | undefined; sharding_method?: Record<string, unknown> | "auto" | "custom" | null | undefined; replication_factor?: number | null | undefined; write_consistency_factor?: number | null | undefined; on_disk_payload?: boolean | null | undefined; hnsw_config?: Record<string, unknown> | { m?: number | null | undefined; ef_construct?: number | null | undefined; full_scan_threshold?: number | null | undefined; max_indexing_threads?: number | null | undefined; on_disk?: boolean | null | undefined; payload_m?: number | null | undefined; } | null | undefined; wal_config?: Record<string, unknown> | { wal_capacity_mb?: number | null | undefined; wal_segments_ahead?: number | null | undefined; } | null | undefined; optimizers_config?: Record<string, unknown> | { deleted_threshold?: number | null | undefined; vacuum_min_vector_number?: number | null | undefined; default_segment_number?: number | null | undefined; max_segment_size?: number | null | undefined; memmap_threshold?: number | null | undefined; indexing_threshold?: number | null | undefined; flush_interval_sec?: number | null | undefined; max_optimization_threads?: number | null | undefined; } | null | undefined; init_from?: Record<string, unknown> | { collection: string; } | null | undefined; quantization_config?: Record<string, unknown> | { scalar: { type: "int8"; quantile?: number | null | undefined; always_ram?: boolean | null | undefined; }; } | { product: { compression: "x4" | "x8" | "x16" | "x32" | "x64"; always_ram?: boolean | null | undefined; }; } | { binary: { always_ram?: boolean | null | undefined; }; } | null | undefined; sparse_vectors?: { [key: string]: { index?: Record<string, unknown> | { full_scan_threshold?: number | null | undefined; on_disk?: boolean | null | undefined; datatype?: Record<string, unknown> | "float32" | "uint8" | "float16" | null | undefined; } | null | undefined; modifier?: Record<string, unknown> | "none" | "idf" | null | undefined; } | undefined; } | null | undefined; }; }; } | undefined; responses: { 200: { content: { "application/json": { time?: number | undefined; status?: string | undefined; result?: boolean | undefined; }; }; }; default: { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; "4XX": { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; }; }>; /** * Create index for field in collection */ readonly createFieldIndex: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ parameters: { query?: { wait?: boolean | undefined; ordering?: "weak" | "medium" | "strong" | undefined; } | undefined; path: { collection_name: string; }; }; requestBody?: { content: { "application/json": { field_name: string; field_schema?: Record<string, unknown> | "keyword" | "integer" | "float" | "geo" | "text" | "bool" | "datetime" | "uuid" | { type: "keyword"; is_tenant?: boolean | null | undefined; on_disk?: boolean | null | undefined; } | { type: "integer"; lookup: boolean; range: boolean; is_principal?: boolean | null | undefined; on_disk?: boolean | null | undefined; } | { type: "float"; is_principal?: boolean | null | undefined; on_disk?: boolean | null | undefined; } | { type: "geo"; } | { type: "text"; tokenizer?: "prefix" | "whitespace" | "word" | "multilingual" | undefined; min_token_len?: number | null | undefined; max_token_len?: number | null | undefined; lowercase?: boolean | null | undefined; } | { type: "bool"; } | { type: "datetime"; is_principal?: boolean | null | undefined; on_disk?: boolean | null | undefined; } | { type: "uuid"; is_tenant?: boolean | null | undefined; on_disk?: boolean | null | undefined; } | null | undefined; }; }; } | undefined; responses: { 200: { content: { "application/json": { time?: number | undefined; status?: string | undefined; result?: { operation_id?: number | null | undefined; status: "acknowledged" | "completed"; } | undefined; }; }; }; default: { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; "4XX": { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; }; }>; /** * Create new snapshot for a collection */ readonly createSnapshot: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ parameters: { query?: { wait?: boolean | undefined; } | undefined; path: { collection_name: string; }; }; responses: { 200: { content: { "application/json": { time?: number | undefined; status?: string | undefined; result?: { name: string; creation_time?: string | null | undefined; size: number; checksum?: string | null | undefined; } | undefined; }; }; }; 202: { content: { "application/json": { time?: number | undefined; status?: string | undefined; }; }; }; default: { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; "4XX": { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; }; }>; /** * Drop collection and all associated data */ readonly deleteCollection: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ parameters: { query?: { timeout?: number | undefined; } | undefined; path: { collection_name: string; }; }; responses: { 200: { content: { "application/json": { time?: number | undefined; status?: string | undefined; result?: boolean | undefined; }; }; }; default: { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; "4XX": { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; }; }>; /** * Delete field index for collection */ readonly deleteFieldIndex: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ parameters: { query?: { wait?: boolean | undefined; ordering?: "weak" | "medium" | "strong" | undefined; } | undefined; path: { collection_name: string; field_name: string; }; }; responses: { 200: { content: { "application/json": { time?: number | undefined; status?: string | undefined; result?: { operation_id?: number | null | undefined; status: "acknowledged" | "completed"; } | undefined; }; }; }; default: { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; "4XX": { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; }; }>; /** * Delete snapshot for a collection */ readonly deleteSnapshots: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ parameters: { query?: { wait?: boolean | undefined; } | undefined; path: { collection_name: string; snapshot_name: string; }; }; responses: { 200: { content: { "application/json": { time?: number | undefined; status?: string | undefined; result?: boolean | undefined; }; }; }; 202: { content: { "application/json": { time?: number | undefined; status?: string | undefined; }; }; }; default: { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; "4XX": { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; }; }>; /** * Get detailed information about specified existing collection */ readonly getCollection: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ parameters: { path: { collection_name: string; }; }; responses: { 200: { content: { "application/json": { time?: number | undefined; status?: string | undefined; result?: { status: "green" | "yellow" | "grey" | "red"; optimizer_status: "ok" | { error: string; }; vectors_count?: number | null | undefined; indexed_vectors_count?: number | null | undefined; points_count?: number | null | undefined; segments_count: number; config: { params: { vectors?: { size: number; distance: "Cosine" | "Euclid" | "Dot" | "Manhattan"; hnsw_config?: Record<string, unknown> | { m?: number | null | undefined; ef_construct?: number | null | undefined; full_scan_threshold?: number | null | undefined; max_indexing_threads?: number | null | undefined; on_disk?: boolean | null | undefined; payload_m?: number | null | undefined; } | null | undefined; quantization_config?: Record<string, unknown> | { scalar: { type: "int8"; quantile?: number | null | undefined; always_ram?: boolean | null | undefined; }; } | { product: { compression: "x4" | "x8" | "x16" | "x32" | "x64"; always_ram?: boolean | null | undefined; }; } | { binary: { always_ram?: boolean | null | undefined; }; } | null | undefined; on_disk?: boolean | null | undefined; datatype?: Record<string, unknown> | "float32" | "uint8" | "float16" | null | undefined; multivector_config?: Record<string, unknown> | { comparator: "max_sim"; } | null | undefined; } | { [key: string]: { size: number; distance: "Cosine" | "Euclid" | "Dot" | "Manhattan"; hnsw_config?: Record<string, unknown> | { m?: number | null | undefined; ef_construct?: number | null | undefined; full_scan_threshold?: number | null | undefined; max_indexing_threads?: number | null | undefined; on_disk?: boolean | null | undefined; payload_m?: number | null | undefined; } | null | undefined; quantization_config?: Record<string, unknown> | { scalar: { type: "int8"; quantile?: number | null | undefined; always_ram?: boolean | null | undefined; }; } | { product: { compression: "x4" | "x8" | "x16" | "x32" | "x64"; always_ram?: boolean | null | undefined; }; } | { binary: { always_ram?: boolean | null | undefined; }; } | null | undefined; on_disk?: boolean | null | undefined; datatype?: Record<string, unknown> | "float32" | "uint8" | "float16" | null | undefined; multivector_config?: Record<string, unknown> | { comparator: "max_sim"; } | null | undefined; } | undefined; } | undefined; shard_number?: number | undefined; sharding_method?: Record<string, unknown> | "auto" | "custom" | null | undefined; replication_factor?: number | undefined; write_consistency_factor?: number | undefined; read_fan_out_factor?: number | null | undefined; on_disk_payload?: boolean | undefined; sparse_vectors?: { [key: string]: { index?: Record<string, unknown> | { full_scan_threshold?: number | null | undefined; on_disk?: boolean | null | undefined; datatype?: Record<string, unknown> | "float32" | "uint8" | "float16" | null | undefined; } | null | undefined; modifier?: Record<string, unknown> | "none" | "idf" | null | undefined; } | undefined; } | null | undefined; }; hnsw_config: { m: number; ef_construct: number; full_scan_threshold: number; max_indexing_threads?: number | undefined; on_disk?: boolean | null | undefined; payload_m?: number | null | undefined; }; optimizer_config: { deleted_threshold: number; vacuum_min_vector_number: number; default_segment_number: number; max_segment_size?: number | null | undefined; memmap_threshold?: number | null | undefined; indexing_threshold?: number | null | undefined; flush_interval_sec: number; max_optimization_threads?: number | null | undefined; }; wal_config: { wal_capacity_mb: number; wal_segments_ahead: number; }; quantization_config?: Record<string, unknown> | { scalar: { type: "int8"; quantile?: number | null | undefined; always_ram?: boolean | null | undefined; }; } | { product: { compression: "x4" | "x8" | "x16" | "x32" | "x64"; always_ram?: boolean | null | undefined; }; } | { binary: { always_ram?: boolean | null | undefined; }; } | null | undefined; }; payload_schema: { [key: string]: { data_type: "keyword" | "integer" | "float" | "geo" | "text" | "bool" | "datetime" | "uuid"; params?: Record<string, unknown> | { type: "keyword"; is_tenant?: boolean | null | undefined; on_disk?: boolean | null | undefined; } | { type: "integer"; lookup: boolean; range: boolean; is_principal?: boolean | null | undefined; on_disk?: boolean | null | undefined; } | { type: "float"; is_principal?: boolean | null | undefined; on_disk?: boolean | null | undefined; } | { type: "geo"; } | { type: "text"; tokenizer?: "prefix" | "whitespace" | "word" | "multilingual" | undefined; min_token_len?: number | null | undefined; max_token_len?: number | null | undefined; lowercase?: boolean | null | undefined; } | { type: "bool"; } | { type: "datetime"; is_principal?: boolean | null | undefined; on_disk?: boolean | null | undefined; } | { type: "uuid"; is_tenant?: boolean | null | undefined; on_disk?: boolean | null | undefined; } | null | undefined; points: number; } | undefined; }; } | undefined; }; }; }; default: { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; "4XX": { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; }; }>; /** * Get list of all aliases for a collection */ readonly getCollectionAliases: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ parameters: { path: { collection_name: string; }; }; responses: { 200: { content: { "application/json": { time?: number | undefined; status?: string | undefined; result?: { aliases: { alias_name: string; collection_name: string; }[]; } | undefined; }; }; }; default: { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; "4XX": { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; }; }>; /** * Get list name of all existing collections */ readonly getCollections: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ responses: { 200: { content: { "application/json": { time?: number | undefined; status?: string | undefined; result?: { collections: { name: string; }[]; } | undefined; }; }; }; default: { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; "4XX": { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; }; }>; /** * Get list of all existing collections aliases */ readonly getCollectionsAliases: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ responses: { 200: { content: { "application/json": { time?: number | undefined; status?: string | undefined; result?: { aliases: { alias_name: string; collection_name: string; }[]; } | undefined; }; }; }; default: { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; "4XX": { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; }; }>; /** * Check the existence of a collection */ readonly collectionExists: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ parameters: { path: { collection_name: string; }; }; responses: { 200: { content: { "application/json": { time?: number | undefined; status?: string | undefined; result?: { exists: boolean; } | undefined; }; }; }; default: { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; "4XX": { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; }; }>; /** * Download specified snapshot from a collection as a file * @todo Fetcher needs to handle Blob for file downloads */ readonly getSnapshot: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ parameters: { path: { collection_name: string; snapshot_name: string; }; }; responses: { 200: { content: { "application/octet-stream": string; }; }; default: { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; "4XX": { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; }; }>; /** * Get list of snapshots for a collection */ readonly listSnapshots: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ parameters: { path: { collection_name: string; }; }; responses: { 200: { content: { "application/json": { time?: number | undefined; status?: string | undefined; result?: { name: string; creation_time?: string | null | undefined; size: number; checksum?: string | null | undefined; }[] | undefined; }; }; }; default: { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; "4XX": { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; }; }>; readonly updateAliases: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ parameters: { query?: { timeout?: number | undefined; } | undefined; }; requestBody?: { content: { "application/json": { actions: ({ create_alias: { collection_name: string; alias_name: string; }; } | { delete_alias: { alias_name: string; }; } | { rename_alias: { old_alias_name: string; new_alias_name: string; }; })[]; }; }; } | undefined; responses: { 200: { content: { "application/json": { time?: number | undefined; status?: string | undefined; result?: boolean | undefined; }; }; }; default: { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; "4XX": { content: { "application/json": { time?: number | undefined; status?: { error?: string | undefined; } | undefined; result?: Record<string, unknown> | null | undefined; }; }; }; }; }>; /** * Update parameters of the existing collection */ readonly updateCollection: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ parameters: { query?: { timeout?: number | undefined; } | undefined; path: { collection_name: string; }; }; requestBody?: { content: { "application/json": { vectors?: Record<string, unknown> | { [key: string]: { hnsw_config?: Record<string, unknown> | { m?: number | null | undefined; ef_construct?: number | null | undefined; full_scan_threshold?: number | null | undefined; max_indexing_threads?: number | null | undefined; on_disk?: boolean | null | undefined; payload_m?: number | null | undefined; } | null | undefined; quantization_config?: Record<string, unknown> | { scalar: { type: "int8"; quantile?: number | null | undefined; always_ram?: boolean | null | undefined; }; } | { product: { compression: "x4" | "x8" | "x16" | "x32" | "x64"; always_ram?: boolean | null | undefined; }; } | { binary: { always_ram?: boolean | null | undefined; }; } | "Disabled" | null | undefined; on_disk?: boolean | null | undefined; } | undefined; } | null | undefined; optimizers_config?: Record<string, unknown> | { deleted_threshold?: number | null | undefined; vacuum_min_vector_number?: number | null | undefined; default_segment_number?: number | null | undefined; max_segment_size?: number | null | undefined; memmap_threshold?: number | null | undefined; indexing_threshold?: number | null | undefined; flush_interval_sec?: number | null | undefined; max_optimization_threads?: number | null | undefined;