Qdrant Vector Store
The QdrantVector class provides vector search using Qdrant, a vector similarity search engine. It provides a production-ready service with a convenient API to store, search, and manage vectors with additional payload and extended filtering support.
Constructor OptionsDirect link to Constructor Options
url:
apiKey:
https:
MethodsDirect link to Methods
createIndex()Direct link to createIndex()
indexName:
dimension:
metric?:
upsert()Direct link to upsert()
vectors:
metadata?:
ids?:
query()Direct link to query()
indexName:
queryVector:
topK?:
filter?:
includeVector?:
listIndexes()Direct link to listIndexes()
Returns an array of index names as strings.
describeIndex()Direct link to describeIndex()
indexName:
Returns:
interface IndexStats {
dimension: number;
count: number;
metric: "cosine" | "euclidean" | "dotproduct";
}
deleteIndex()Direct link to deleteIndex()
indexName:
updateVector()Direct link to updateVector()
Update a single vector by ID or by metadata filter. Either id or filter must be provided, but not both.
indexName:
id?:
filter?:
update:
Updates a vector and/or its metadata in the specified index. If both vector and metadata are provided, both will be updated. If only one is provided, only that will be updated.
deleteVector()Direct link to deleteVector()
indexName:
id:
Deletes a vector from the specified index by its ID.
deleteVectors()Direct link to deleteVectors()
Delete multiple vectors by IDs or by metadata filter. Either ids or filter must be provided, but not both.
indexName:
ids?:
filter?:
Response TypesDirect link to Response Types
Query results are returned in this format:
interface QueryResult {
id: string;
score: number;
metadata: Record<string, any>;
vector?: number[]; // Only included if includeVector is true
}
Error HandlingDirect link to Error Handling
The store throws typed errors that can be caught:
try {
await store.query({
indexName: "index_name",
queryVector: queryVector,
});
} catch (error) {
if (error instanceof VectorStoreError) {
console.log(error.code); // 'connection_failed' | 'invalid_dimension' | etc
console.log(error.details); // Additional error context
}
}