UNPKG

@qdrant/js-client-rest

Version:

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

972 lines 88.5 kB
import { OpenApiClient } from './api-client.js'; import { SchemaFor } from './types.js'; export type QdrantClientParams = { port?: number | null; apiKey?: string; https?: boolean; prefix?: string; url?: string; host?: string; /** * Local timeout for requests (uses fetch's AbortSignal) - Default 300 seconds */ timeout?: number; /** * Additional HTTP Headers to send. */ headers?: Record<string, number | string | string[] | undefined>; /** * The Node.js fetch API (undici) uses HTTP/1.1 under the hood. * This indicates the maximum number of keep-alive connections * to open simultaneously while building a request pool in memory. */ maxConnections?: number; }; export declare class QdrantClient { private _https; private _scheme; private _port; private _prefix; private _host; private _restUri; private _openApiClient; constructor({ url, host, apiKey, https, prefix, port, timeout, ...args }?: QdrantClientParams); /** * API getter * * @param name Name of api * @returns An instance of a namespaced API, generated from OpenAPI schema. */ api<T extends keyof OpenApiClient>(name: T): OpenApiClient[T]; /** * Search for points in multiple collections * * @param collectionName Name of the collection * @param {object} args - * - searches: List of search requests * - consistency: Read consistency of the search. Defines how many replicas should be queried before returning the result. * Values: * number - number of replicas to query, values should present in all queried replicas * 'majority' - query all replicas, but return values present in the majority of replicas * 'quorum' - query the majority of replicas, return values present in all of them * 'all' - query all replicas, and return values present in all replicas * - timeout: If set, overrides global timeout setting for this request. Unit is seconds. * @returns List of search responses */ searchBatch(collection_name: string, { searches, consistency, timeout, }: Pick<SchemaFor<'SearchRequestBatch'>, 'searches'> & { consistency?: SchemaFor<'ReadConsistency'>; } & { timeout?: number; }): Promise<{ id: string | number; version: number; score: number; payload?: Record<string, unknown> | { [key: string]: unknown; } | null | undefined; vector?: Record<string, unknown> | number[] | number[][] | { [key: string]: number[] | number[][] | { indices: number[]; values: number[]; } | undefined; } | null | undefined; shard_key?: string | number | Record<string, unknown> | null | undefined; order_value?: number | Record<string, unknown> | null | undefined; }[][]>; /** * Search for closest vectors in collection taking into account filtering conditions * * @param collection_name Collection to search in * @param {object} args - * - shard_key: Specify in which shards to look for the points, if not specified - look in all shards * - vector: * Search for vectors closest to this. * Can be either a vector itself, or a named vector, or a tuple of vector name and vector itself * - filter: * - Exclude vectors which doesn't fit given conditions. * - If `None` - search among all vectors * - params: Additional search params * - limit: How many results return * - offset: * Offset of the first result to return. * May be used to paginate results. * Note: large offset values may cause performance issues. * - with_payload: * - Specify which stored payload should be attached to the result. * - If `True` - attach all payload * - If `False` - do not attach any payload * - If List of string - include only specified fields * - If `PayloadSelector` - use explicit rules * - with_vector: * - If `True` - Attach stored vector to the search result. * - If `False` - Do not attach vector. * - If List of string - include only specified fields * - Default: `False` * - score_threshold: * Define a minimal score threshold for the result. * If defined, less similar results will not be returned. * Score of the returned result might be higher or smaller than the threshold depending * on the Distance function used. * E.g. for cosine similarity only higher scores will be returned. * - consistency: * Read consistency of the search. Defines how many replicas should be queried before returning the result. * Values: * - int - number of replicas to query, values should present in all queried replicas * - 'majority' - query all replicas, but return values present in the majority of replicas * - 'quorum' - query the majority of replicas, return values present in all of them * - 'all' - query all replicas, and return values present in all replicas * - timeout: If set, overrides global timeout setting for this request. Unit is seconds. * @example * // Search with filter * client.search( * "test_collection", * { * vector: [1.0, 0.1, 0.2, 0.7], * filter: { * must: [ * { * key: 'color', * range: { * color: 'red' * } * } * ] * ) * } * ) * @returns List of found close points with similarity scores. */ search(collection_name: string, { shard_key, vector, limit, offset, filter, params, with_payload, with_vector, score_threshold, consistency, timeout, }: Partial<Pick<SchemaFor<'SearchRequest'>, 'limit'>> & Omit<SchemaFor<'SearchRequest'>, 'limit'> & { consistency?: SchemaFor<'ReadConsistency'>; } & { timeout?: number; }): Promise<{ id: string | number; version: number; score: number; payload?: Record<string, unknown> | { [key: string]: unknown; } | null | undefined; vector?: Record<string, unknown> | number[] | number[][] | { [key: string]: number[] | number[][] | { indices: number[]; values: number[]; } | undefined; } | null | undefined; shard_key?: string | number | Record<string, unknown> | null | undefined; order_value?: number | Record<string, unknown> | null | undefined; }[]>; /** * Perform multiple recommend requests in batch mode * @param collection_name Name of the collection * @param {object} args * - searches: List of recommend requests * - consistency: * Read consistency of the search. Defines how many replicas should be queried before returning the result. * Values: * - number - number of replicas to query, values should present in all queried replicas * - 'majority' - query all replicas, but return values present in the majority of replicas * - 'quorum' - query the majority of replicas, return values present in all of them * - 'all' - query all replicas, and return values present in all replicas * - timeout: If set, overrides global timeout setting for this request. Unit is seconds. * @returns List of recommend responses */ recommendBatch(collection_name: string, { searches, consistency, timeout, }: SchemaFor<'RecommendRequestBatch'> & { consistency?: SchemaFor<'ReadConsistency'>; } & { timeout?: number; }): Promise<{ id: string | number; version: number; score: number; payload?: Record<string, unknown> | { [key: string]: unknown; } | null | undefined; vector?: Record<string, unknown> | number[] | number[][] | { [key: string]: number[] | number[][] | { indices: number[]; values: number[]; } | undefined; } | null | undefined; shard_key?: string | number | Record<string, unknown> | null | undefined; order_value?: number | Record<string, unknown> | null | undefined; }[][]>; /** * @alias recommendBatch */ recommend_batch(collection_name: string, { searches, consistency, timeout, }: SchemaFor<'RecommendRequestBatch'> & { consistency?: SchemaFor<'ReadConsistency'>; } & { timeout?: number; }): Promise<{ id: string | number; version: number; score: number; payload?: Record<string, unknown> | { [key: string]: unknown; } | null | undefined; vector?: Record<string, unknown> | number[] | number[][] | { [key: string]: number[] | number[][] | { indices: number[]; values: number[]; } | undefined; } | null | undefined; shard_key?: string | number | Record<string, unknown> | null | undefined; order_value?: number | Record<string, unknown> | null | undefined; }[][]>; /** * Recommendation request. Provides positive and negative examples of the vectors, * which can be ids of points that are already stored in the collection, raw vectors, or even ids and vectors combined. * Service should look for the points which are closer to positive examples and at the same time further to negative examples. * The concrete way of how to compare negative and positive distances is up to the `strategy` chosen. * @param collection_name Collection to search in * @param {object} args * - shard_key: Specify in which shards to look for the points, if not specified - look in all shards * - positive: * List of stored point IDs, which should be used as reference for similarity search. * If there is only one ID provided - this request is equivalent to the regular search with vector of that point. * If there are more than one IDs, Qdrant will attempt to search for similar to all of them. * Recommendation for multiple vectors is experimental. Its behaviour may change in the future. * - negative: * List of stored point IDs, which should be dissimilar to the search result. * Negative examples is an experimental functionality. Its behaviour may change in the future. * - strategy: * How to use positive and negative examples to find the results. * - query_filter: * - Exclude vectors which doesn't fit given conditions. * - If `None` - search among all vectors * - search_params: Additional search params * - limit: How many results return * - Default: `10` * - offset: * Offset of the first result to return. * May be used to paginate results. * Note: large offset values may cause performance issues. * - Default: `0` * - with_payload: * - Specify which stored payload should be attached to the result. * - If `True` - attach all payload * - If `False` - do not attach any payload * - If List of string - include only specified fields * - If `PayloadSelector` - use explicit rules * - Default: `true` * - with_vector: * - If `True` - Attach stored vector to the search result. * - If `False` - Do not attach vector. * - If List of string - include only specified fields * - Default: `false` * - score_threshold: * Define a minimal score threshold for the result. * If defined, less similar results will not be returned. * Score of the returned result might be higher or smaller than the threshold depending * on the Distance function used. * E.g. for cosine similarity only higher scores will be returned. * - using: * Name of the vectors to use for recommendations. * If `None` - use default vectors. * - lookupFrom: * Defines a location (collection and vector field name), used to lookup vectors for recommendations. * If `None` - use current collection will be used. * - consistency: * Read consistency of the search. Defines how many replicas should be queried before returning the result. * Values: * - int - number of replicas to query, values should present in all queried replicas * - 'majority' - query all replicas, but return values present in the majority of replicas * - 'quorum' - query the majority of replicas, return values present in all of them * - 'all' - query all replicas, and return values present in all replicas * - timeout: If set, overrides global timeout setting for this request. Unit is seconds. * @returns List of recommended points with similarity scores. */ recommend(collection_name: string, { shard_key, positive, negative, strategy, filter, params, limit, offset, with_payload, with_vector, score_threshold, using, lookup_from, consistency, timeout, }: Omit<SchemaFor<'RecommendRequest'>, 'limit'> & Partial<Pick<SchemaFor<'RecommendRequest'>, 'limit'>> & { consistency?: SchemaFor<'ReadConsistency'>; } & { timeout?: number; }): Promise<{ id: string | number; version: number; score: number; payload?: Record<string, unknown> | { [key: string]: unknown; } | null | undefined; vector?: Record<string, unknown> | number[] | number[][] | { [key: string]: number[] | number[][] | { indices: number[]; values: number[]; } | undefined; } | null | undefined; shard_key?: string | number | Record<string, unknown> | null | undefined; order_value?: number | Record<string, unknown> | null | undefined; }[]>; /** * Scroll over all (matching) points in the collection. * @param collection_name Name of the collection * @param {object} args * - shard_key: Specify in which shards to look for the points, if not specified - look in all shards * - filter: If provided - only returns points matching filtering conditions * - limit: How many points to return * - offset: If provided - skip points with ids less than given `offset` * - with_payload: * - Specify which stored payload should be attached to the result. * - If `True` - attach all payload * - If `False` - do not attach any payload * - If List of string - include only specified fields * - If `PayloadSelector` - use explicit rules * - Default: `true` * - with_vector: * - If `True` - Attach stored vector to the search result. * - If `False` - Do not attach vector. * - If List of string - include only specified fields * - Default: `false` * - consistency: * Read consistency of the search. Defines how many replicas should be queried before returning the result. * Values: * - int - number of replicas to query, values should present in all queried replicas * - 'majority' - query all replicas, but return values present in the majority of replicas * - 'quorum' - query the majority of replicas, return values present in all of them * - 'all' - query all replicas, and return values present in all replicas * - order_by: * Order the records by a payload field. * @returns * A pair of (List of points) and (optional offset for the next scroll request). * If next page offset is `None` - there is no more points in the collection to scroll. */ scroll(collection_name: string, { shard_key, filter, consistency, timeout, limit, offset, with_payload, with_vector, order_by, }?: SchemaFor<'ScrollRequest'> & { timeout?: number; } & { consistency?: SchemaFor<'ReadConsistency'>; }): Promise<{ points: { id: string | number; payload?: Record<string, unknown> | { [key: string]: unknown; } | null | undefined; vector?: Record<string, unknown> | number[] | number[][] | { [key: string]: number[] | number[][] | { indices: number[]; values: number[]; } | undefined; } | null | undefined; shard_key?: string | number | Record<string, unknown> | null | undefined; order_value?: number | Record<string, unknown> | null | undefined; }[]; next_page_offset?: string | number | Record<string, unknown> | null | undefined; }>; /** * Count points in the collection. * Count points in the collection matching the given filter. * @param collection_name * @param {object} args * - shard_key: Specify in which shards to look for the points, if not specified - look in all shards * - filter: filtering conditions * - exact: * If `True` - provide the exact count of points matching the filter. * If `False` - provide the approximate count of points matching the filter. Works faster. * Default: `true` * @returns Amount of points in the collection matching the filter. */ count(collection_name: string, { shard_key, filter, exact, timeout }?: SchemaFor<'CountRequest'> & { timeout?: number; }): Promise<{ count: number; }>; /** * Get cluster information for a collection. * @param collection_name * @returns Operation result */ collectionClusterInfo(collection_name: string): Promise<{ 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; }[]; }>; /** * Update vectors * @param collection_name * @param {object} args * - wait: Await for the results to be processed. * - If `true`, result will be returned only when all changes are applied * - If `false`, result will be returned immediately after the confirmation of receiving. * - Default: `true` * - ordering: Define strategy for ordering of the points. Possible values: * - 'weak' - write operations may be reordered, works faster, default * - 'medium' - write operations go through dynamically selected leader, * may be inconsistent for a short period of time in case of leader change * - 'strong' - Write operations go through the permanent leader, * consistent, but may be unavailable if leader is down * - points: Points with named vectors * - shard_key: Specify in which shards to look for the points, if not specified - look in all shards * @returns Operation result */ updateVectors(collection_name: string, { wait, ordering, points, shard_key, }: { wait?: boolean; ordering?: SchemaFor<'WriteOrdering'>; } & SchemaFor<'UpdateVectors'>): Promise<{ operation_id?: number | null | undefined; status: "acknowledged" | "completed"; }>; /** * Delete vectors * @param collection_name * @param {object} args * - wait: Await for the results to be processed. * - If `true`, result will be returned only when all changes are applied * - If `false`, result will be returned immediately after the confirmation of receiving. * - Default: `true` * - ordering: Define strategy for ordering of the points. Possible values: * - 'weak' - write operations may be reordered, works faster, default * - 'medium' - write operations go through dynamically selected leader, * may be inconsistent for a short period of time in case of leader change * - 'strong' - Write operations go through the permanent leader, * consistent, but may be unavailable if leader is down * - points: Deletes values from each point in this list * - filter: Deletes values from points that satisfy this filter condition * - vector: Vector names * - shard_key: Specify in which shards to look for the points, if not specified - look in all shards * @returns Operation result */ deleteVectors(collection_name: string, { wait, ordering, points, filter, vector, shard_key, }: { wait?: boolean; ordering?: SchemaFor<'WriteOrdering'>; } & SchemaFor<'DeleteVectors'>): Promise<{ operation_id?: number | null | undefined; status: "acknowledged" | "completed"; }>; /** * Search point groups * @param collection_name * @param {object} args - * - consistency: Read consistency of the search. Defines how many replicas should be queried before returning the result. * Values: * number - number of replicas to query, values should present in all queried replicas * 'majority' - query all replicas, but return values present in the majority of replicas * 'quorum' - query the majority of replicas, return values present in all of them * 'all' - query all replicas, and return values present in all replicas * - timeout: If set, overrides global timeout setting for this request. Unit is seconds. * - shard_key: Specify in which shards to look for the points, if not specified - look in all shards * - vector: query search vector * - filter: Look only for points which satisfies this conditions * - params: Additional search params * - with_payload: Select which payload to return with the response * - with_vector: Whether to return the point vector with the result? * - score_threshold: Define a minimal score threshold for the result. If defined, less similar results will not be returned. Score of the returned result might be higher or smaller than the threshold depending on the Distance function used. E.g. for cosine similarity only higher scores will be returned. * - group_by: Payload field to group by, must be a string or number field. If the field contains more than 1 value, all values will be used for grouping. One point can be in multiple groups. * - group_size: Maximum amount of points to return per group * - limit: Maximum amount of groups to return * @returns Operation result */ searchPointGroups(collection_name: string, { consistency, timeout, shard_key, vector, filter, params, with_payload, with_vector, score_threshold, group_by, group_size, limit, }: { consistency?: SchemaFor<'ReadConsistency'>; } & { timeout?: number; } & SchemaFor<'SearchGroupsRequest'>): Promise<{ groups: { hits: { id: string | number; version: number; score: number; payload?: Record<string, unknown> | { [key: string]: unknown; } | null | undefined; vector?: Record<string, unknown> | number[] | number[][] | { [key: string]: number[] | number[][] | { indices: number[]; values: number[]; } | undefined; } | null | undefined; shard_key?: string | number | Record<string, unknown> | null | undefined; order_value?: number | Record<string, unknown> | null | undefined; }[]; id: string | number; lookup?: Record<string, unknown> | { id: string | number; payload?: Record<string, unknown> | { [key: string]: unknown; } | null | undefined; vector?: Record<string, unknown> | number[] | number[][] | { [key: string]: number[] | number[][] | { indices: number[]; values: number[]; } | undefined; } | null | undefined; shard_key?: string | number | Record<string, unknown> | null | undefined; order_value?: number | Record<string, unknown> | null | undefined; } | null | undefined; }[]; }>; /** * Recommend point groups * @param collection_name * @param {object} args - * - consistency: Read consistency of the search. Defines how many replicas should be queried before returning the result. * Values: * number - number of replicas to query, values should present in all queried replicas * 'majority' - query all replicas, but return values present in the majority of replicas * 'quorum' - query the majority of replicas, return values present in all of them * 'all' - query all replicas, and return values present in all replicas * - timeout: If set, overrides global timeout setting for this request. Unit is seconds. * - shard_key: Specify in which shards to look for the points, if not specified - look in all shards * - positive: Look for vectors closest to those * - negative: Try to avoid vectors like this * - strategy: How to use positive and negative examples to find the results * - filter: Look only for points which satisfies this conditions * - params: Additional search params * - with_payload: Select which payload to return with the response * - with_vector: Whether to return the point vector with the result? * - score_threshold: Define a minimal score threshold for the result. If defined, less similar results will not be returned. Score of the returned result might be higher or smaller than the threshold depending on the Distance function used. E.g. for cosine similarity only higher scores will be returned. * - using: Define which vector to use for recommendation, if not specified - try to use default vector * - lookup_from: The location used to lookup vectors. If not specified - use current collection. Note: the other collection should have the same vector size as the current collection * - group_by: Payload field to group by, must be a string or number field. If the field contains more than 1 value, all values will be used for grouping. One point can be in multiple groups. * - group_size: Maximum amount of points to return per group * - limit: Maximum amount of groups to return * @returns Operation result */ recommendPointGroups(collection_name: string, { consistency, timeout, shard_key, positive, strategy, negative, filter, params, with_payload, with_vector, score_threshold, using, lookup_from, group_by, group_size, limit, }: { consistency?: SchemaFor<'ReadConsistency'>; } & { timeout?: number; } & SchemaFor<'RecommendGroupsRequest'>): Promise<{ groups: { hits: { id: string | number; version: number; score: number; payload?: Record<string, unknown> | { [key: string]: unknown; } | null | undefined; vector?: Record<string, unknown> | number[] | number[][] | { [key: string]: number[] | number[][] | { indices: number[]; values: number[]; } | undefined; } | null | undefined; shard_key?: string | number | Record<string, unknown> | null | undefined; order_value?: number | Record<string, unknown> | null | undefined; }[]; id: string | number; lookup?: Record<string, unknown> | { id: string | number; payload?: Record<string, unknown> | { [key: string]: unknown; } | null | undefined; vector?: Record<string, unknown> | number[] | number[][] | { [key: string]: number[] | number[][] | { indices: number[]; values: number[]; } | undefined; } | null | undefined; shard_key?: string | number | Record<string, unknown> | null | undefined; order_value?: number | Record<string, unknown> | null | undefined; } | null | undefined; }[]; }>; /** * Update or insert a new point into the collection. * @param collection_name * @param {object} args * - wait: Await for the results to be processed. * - If `true`, result will be returned only when all changes are applied * - If `false`, result will be returned immediately after the confirmation of receiving. * - Default: `true` * - ordering: Define strategy for ordering of the points. Possible values: * - 'weak' - write operations may be reordered, works faster, default * - 'medium' - write operations go through dynamically selected leader, * may be inconsistent for a short period of time in case of leader change * - 'strong' - Write operations go through the permanent leader, * consistent, but may be unavailable if leader is down * - points: Batch or list of points to insert * @returns Operation result */ upsert(collection_name: string, { wait, ordering, ...points_or_batch }: { wait?: boolean; ordering?: SchemaFor<'WriteOrdering'>; } & SchemaFor<'PointInsertOperations'>): Promise<{ operation_id?: number | null | undefined; status: "acknowledged" | "completed"; }>; /** * Retrieve stored points by IDs * @param collection_name * @param {object} args * - shard_key: Specify in which shards to look for the points, if not specified - look in all shards * - ids: list of IDs to lookup * - with_payload: * - Specify which stored payload should be attached to the result. * - If `True` - attach all payload * - If `False` - do not attach any payload * - If List of string - include only specified fields * - If `PayloadSelector` - use explicit rules * - Default: `true` * - with_vector: * - If `True` - Attach stored vector to the search result. * - If `False` - Do not attach vector. * - If List of string - Attach only specified vectors. * - Default: `false` * - consistency: * Read consistency of the search. Defines how many replicas should be queried before returning the result. * Values: * - number - number of replicas to query, values should present in all queried replicas * - 'majority' - query all replicas, but return values present in the majority of replicas * - 'quorum' - query the majority of replicas, return values present in all of them * - 'all' - query all replicas, and return values present in all replicas * @returns List of points */ retrieve(collection_name: string, { shard_key, ids, with_payload, with_vector, consistency, timeout, }: SchemaFor<'PointRequest'> & { consistency?: SchemaFor<'ReadConsistency'>; } & { timeout?: number; }): Promise<{ id: string | number; payload?: Record<string, unknown> | { [key: string]: unknown; } | null | undefined; vector?: Record<string, unknown> | number[] | number[][] | { [key: string]: number[] | number[][] | { indices: number[]; values: number[]; } | undefined; } | null | undefined; shard_key?: string | number | Record<string, unknown> | null | undefined; order_value?: number | Record<string, unknown> | null | undefined; }[]>; /** * Deletes selected points from collection * @param collection_name Name of the collection * @param {object} args * - wait: Await for the results to be processed. * - If `true`, result will be returned only when all changes are applied * - If `false`, result will be returned immediately after the confirmation of receiving. * - ordering: Define strategy for ordering of the points. Possible values: * - 'weak' - write operations may be reordered, works faster, default * - 'medium' - write operations go through dynamically selected leader, * may be inconsistent for a short period of time in case of leader change * - 'strong' - Write operations go through the permanent leader, * consistent, but may be unavailable if leader is down * - points_selector: List of affected points, filter or points selector. * Example: * - `points: [ * 1, 2, 3, "cd3b53f0-11a7-449f-bc50-d06310e7ed90" * ]` * - `filter: { * must: [ * { * key: 'rand_number', * range: { * gte: 0.7 * } * } * ] * }` * @returns Operation result */ delete(collection_name: string, { wait, ordering, ...points_selector }: { wait?: boolean; ordering?: SchemaFor<'WriteOrdering'>; } & SchemaFor<'PointsSelector'>): Promise<{ operation_id?: number | null | undefined; status: "acknowledged" | "completed"; }>; /** * Sets payload values for specified points. * @param collection_name Name of the collection * @param {object} args * - wait: Await for the results to be processed. * - If `true`, result will be returned only when all changes are applied * - If `false`, result will be returned immediately after the confirmation of receiving. * - ordering: Define strategy for ordering of the points. Possible values: * - 'weak' - write operations may be reordered, works faster, default * - 'medium' - write operations go through dynamically selected leader, * may be inconsistent for a short period of time in case of leader change * - 'strong' - Write operations go through the permanent leader, * consistent, but may be unavailable if leader is down * - payload: Key-value pairs of payload to assign * - shard_key: Specify in which shards to look for the points, if not specified - look in all shards * - key: Assigns payload to each point that satisfy this path of property * - points|filter: List of affected points, filter or points selector. * Example: * - `points: [ * 1, 2, 3, "cd3b53f0-11a7-449f-bc50-d06310e7ed90" * ]` * - `filter: { * must: [ * { * key: 'rand_number', * range: { * gte: 0.7 * } * } * ] * }` * @returns Operation result */ setPayload(collection_name: string, { payload, points, filter, shard_key, key, ordering, wait, }: { wait?: boolean; ordering?: SchemaFor<'WriteOrdering'>; } & SchemaFor<'SetPayload'>): Promise<{ operation_id?: number | null | undefined; status: "acknowledged" | "completed"; }>; /** * Overwrites payload of the specified points * After this operation is applied, only the specified payload will be present in the point. * The existing payload, even if the key is not specified in the payload, will be deleted. * @param collection_name Name of the collection * @param {object} args * - wait: Await for the results to be processed. * - If `true`, result will be returned only when all changes are applied * - If `false`, result will be returned immediately after the confirmation of receiving. * - ordering: Define strategy for ordering of the points. Possible values: * - 'weak' - write operations may be reordered, works faster, default * - 'medium' - write operations go through dynamically selected leader, * may be inconsistent for a short period of time in case of leader change * - 'strong' - Write operations go through the permanent leader, * consistent, but may be unavailable if leader is down * - payload: Key-value pairs of payload to assign * - shard_key: Specify in which shards to look for the points, if not specified - look in all shards * - key: Assigns payload to each point that satisfy this path of property * - points|filter: List of affected points, filter or points selector. * Example: * - `points: [ * 1, 2, 3, "cd3b53f0-11a7-449f-bc50-d06310e7ed90" * ]` * - `filter: { * must: [ * { * key: 'rand_number', * range: { * gte: 0.7 * } * } * ] * }` * @returns Operation result */ overwritePayload(collection_name: string, { ordering, payload, points, filter, shard_key, key, wait, }: { wait?: boolean; ordering?: SchemaFor<'WriteOrdering'>; } & SchemaFor<'SetPayload'>): Promise<{ operation_id?: number | null | undefined; status: "acknowledged" | "completed"; }>; /** * Remove values from point's payload * @param collection_name Name of the collection * @param {object} args * - wait: Await for the results to be processed. * - If `true`, result will be returned only when all changes are applied * - If `false`, result will be returned immediately after the confirmation of receiving. * - ordering: Define strategy for ordering of the points. Possible values: * - 'weak' - write operations may be reordered, works faster, default * - 'medium' - write operations go through dynamically selected leader, * may be inconsistent for a short period of time in case of leader change * - 'strong' - Write operations go through the permanent leader, * consistent, but may be unavailable if leader is down * - keys: List of payload keys to remove. * - shard_key: Specify in which shards to look for the points, if not specified - look in all shards * - points|filter: List of affected points, filter or points selector. * Example: * - `points: [ * 1, 2, 3, "cd3b53f0-11a7-449f-bc50-d06310e7ed90" * ]` * - `filter: { * must: [ * { * key: 'rand_number', * range: { * gte: 0.7 * } * } * ] * }` * @returns Operation result */ deletePayload(collection_name: string, { ordering, keys, points, filter, shard_key, wait, }: { wait?: boolean; ordering?: SchemaFor<'WriteOrdering'>; } & SchemaFor<'PointsSelector'> & SchemaFor<'DeletePayload'>): Promise<{ operation_id?: number | null | undefined; status: "acknowledged" | "completed"; }>; /** * Delete all payload for selected points * @param collection_name Name of the collection * @param {object} args * - wait: Await for the results to be processed. * - If `true`, result will be returned only when all changes are applied * - If `false`, result will be returned immediately after the confirmation of receiving. * - ordering: Define strategy for ordering of the points. Possible values: * - 'weak' - write operations may be reordered, works faster, default * - 'medium' - write operations go through dynamically selected leader, * may be inconsistent for a short period of time in case of leader change * - 'strong' - Write operations go through the permanent leader, * consistent, but may be unavailable if leader is down * - points_selector: List of affected points, filter or points selector. * Example: * - `points: [ * 1, 2, 3, "cd3b53f0-11a7-449f-bc50-d06310e7ed90" * ]` * - `filter: { * must: [ * { * key: 'rand_number', * range: { * gte: 0.7 * } * } * ] * }` * @returns Operation result */ clearPayload(collection_name: string, { ordering, wait, ...points_selector }: { wait?: boolean; ordering?: SchemaFor<'WriteOrdering'>; } & SchemaFor<'PointsSelector'>): Promise<{ operation_id?: number | null | undefined; status: "acknowledged" | "completed"; }>; /** * Operation for performing changes of collection aliases. * Alias changes are atomic, meaning that no collection modifications can happen between alias operations. * @param {object} args * - actions: List of operations to perform * - timeout: Wait for operation commit timeout in seconds. If timeout is reached, request will return with service error. * @returns Operation result */ updateCollectionAliases({ actions, timeout }: { timeout?: number; } & SchemaFor<'ChangeAliasesOperation'>): Promise<boolean>; /** * Get collection aliases * @param collection_name Name of the collection * @returns Collection aliases */ getCollectionAliases(collection_name: string): Promise<{ aliases: { alias_name: string; collection_name: string; }[]; }>; /** * Get all aliases * @returns All aliases of all collections */ getAliases(): Promise<{ aliases: { alias_name: string; collection_name: string; }[]; }>; /** * Get list name of all existing collections * @returns List of the collections */ getCollections(): Promise<{ collections: { name: string; }[]; }>; /** * Get detailed information about specified existing collection * * @param collection_name Name of the collection * @returns Detailed information about the collection */ getCollection(collection_name: string): Promise<{ 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, unknow