UNPKG

@qdrant/js-client-rest

Version:

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

1,014 lines 1.25 MB
import { Fetcher } from '@qdrant/openapi-typescript-fetch'; import { paths } from './openapi/generated_schema.js'; import { RestArgs } from './types.js'; export type Client = ReturnType<typeof Fetcher.for<paths>>; export declare function createApis(baseUrl: string, args: RestArgs): { readonly cluster: { readonly clusterStatus: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ responses: { 200: { content: { "application/json": { time?: number | undefined; status?: string | undefined; result?: ({} & { status: "enabled"; peer_id: number; peers: { [key: string]: { uri: string; } | undefined; }; raft_info: { term: number; commit: number; pending_operations: number; leader?: number | null | undefined; role?: Record<string, unknown> | "Follower" | "Candidate" | "Leader" | "PreCandidate" | null | undefined; is_voter: boolean; }; consensus_thread_status: ({ last_update?: undefined; } & { consensus_thread_status: "stopped_with_err"; err: string; }) | ({ err?: undefined; } & (({ last_update?: undefined; } & { consensus_thread_status: "stopped"; }) | ({} & { consensus_thread_status: "working"; last_update: string; }))); message_send_failures: { [key: string]: { count: number; latest_error?: string | null | undefined; latest_error_timestamp?: string | null | undefined; } | undefined; }; }) | ({ consensus_thread_status?: undefined; peer_id?: undefined; peers?: undefined; raft_info?: undefined; message_send_failures?: undefined; } & { status: "disabled"; }) | 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 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; }; }; }; }; }>; readonly recoverCurrentPeer: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ 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; }; }; }; }; }>; readonly removePeer: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ parameters: { query?: { force?: boolean | undefined; } | undefined; path: { peer_id: number; }; }; 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; }; }; }; }; }>; readonly updateCollectionCluster: import("@qdrant/openapi-typescript-fetch").TypedFetch<{ parameters: { query?: { timeout?: number | undefined; } | undefined; path: { collection_name: string; }; }; requestBody?: { content: { "application/json": { move_shard: { shard_id: number; to_peer_id: number; from_peer_id: number; method?: Record<string, unknown> | "stream_records" | "snapshot" | "wal_delta" | null | undefined; }; } | { replicate_shard: { shard_id: number; to_peer_id: number; from_peer_id: number; method?: Record<string, unknown> | "stream_records" | "snapshot" | "wal_delta" | null | undefined; }; } | { abort_transfer: { shard_id: number; to_peer_id: number; from_peer_id: number; }; } | { drop_replica: { shard_id: number; peer_id: number; }; } | { create_sharding_key: { shard_key: string | number; shards_number?: number | null | undefined; replication_factor?: number | null | undefined; placement?: number[] | null | undefined; }; } | { drop_sharding_key: { shard_key: string | number; }; } | { restart_transfer: { shard_id: number; from_peer_id: number; to_peer_id: number; method: "stream_records" | "snapshot" | "wal_delta"; }; }; }; } | 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; }; }; }; }; }>; }; readonly collections: { 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; }; }; }; }; }>; 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; }; }; }; }; }>; 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; }; }; }; }; }>; 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; }; }; }; }; }>; 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; }; }; }; }; }>; 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; }; }; }; }; }>; 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; }; }; }; }; }>; 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; i