Mythosia.VectorDb.Qdrant 2.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Mythosia.VectorDb.Qdrant --version 2.2.0
                    
NuGet\Install-Package Mythosia.VectorDb.Qdrant -Version 2.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Mythosia.VectorDb.Qdrant" Version="2.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mythosia.VectorDb.Qdrant" Version="2.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Mythosia.VectorDb.Qdrant" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Mythosia.VectorDb.Qdrant --version 2.2.0
                    
#r "nuget: Mythosia.VectorDb.Qdrant, 2.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Mythosia.VectorDb.Qdrant@2.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Mythosia.VectorDb.Qdrant&version=2.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Mythosia.VectorDb.Qdrant&version=2.2.0
                    
Install as a Cake Tool

Mythosia.VectorDb.Qdrant

Qdrant vector store implementation for the Mythosia VectorDb abstraction layer.

Uses a single Qdrant collection (physical container) with payload-based logical isolation:

  • _namespace — first-tier logical partition
  • _scope — second-tier logical partition

Migration from v1.0.0

v1.0.0 collections are dense-only. v2.0.0 uses hybrid-capable collections and writes a schema marker so the tooling can detect whether migration is needed.

Install the migration tool first:

Install-Package Mythosia.VectorDb.Tools

If docs is the collection you want to migrate, run:

mythosia-vectordb migrate qdrant --endpoint localhost:6334 --source docs --replace

This migrates through a staging collection, then recreates docs with the new schema and copies the migrated data back into docs.

If your Qdrant server is remote or authenticated, add --api-key your-api-key and use your remote endpoint URL.

Stop application writes before migration if consistency matters.

Installation

dotnet add package Mythosia.VectorDb.Qdrant

Current package version:

dotnet add package Mythosia.VectorDb.Qdrant --version 2.0.0

Quick Start

using Mythosia.VectorDb;
using Mythosia.VectorDb.Qdrant;

// 1. Configure — CollectionName is the physical Qdrant collection
var options = new QdrantOptions
{
    Host           = "localhost",
    Port           = 6334,
    CollectionName = "my_vectors",                  // physical collection
    Dimension      = 1536,                          // must match your embedding model
    DistanceStrategy = QdrantDistanceStrategy.Cosine
};

// 2. Create the store
using var store = new QdrantStore(options);

// 3. Upsert records — "documents" is a logical namespace within the collection
var record = new VectorRecord("doc-1", embedding, "Hello world");
await store.InNamespace("documents").UpsertAsync(record);

// 4. Search
var results = await store.InNamespace("documents")
    .SearchAsync(queryVector, topK: 5);

Options

Property Default Description
Host "localhost" Qdrant server host
Port 6334 Qdrant gRPC port
UseTls false Enable TLS for gRPC
ApiKey null Optional API key
CollectionName (required) Qdrant collection name (physical container)
Dimension (required) Embedding vector dimension
DistanceStrategy Cosine Cosine, Euclidean, or DotProduct
AutoCreateCollection true Auto-create the collection on first use

Hybrid Search (v2.0.0)

QdrantStore always provisions/uses hybrid-capable storage (dense + sparse) and supports native IVectorStore.HybridSearchAsync. Choose retrieval mode at query time (SearchAsync for vector-only, HybridSearchAsync for native hybrid):

var options = new QdrantOptions
{
    Host              = "localhost",
    Port              = 6334,
    CollectionName    = "my_vectors",
    Dimension         = 1536
};

var store = new QdrantStore(options);

On upsert, BM25 sparse vectors are automatically computed from the record's Content and stored alongside the dense embedding. Hybrid search uses Qdrant's built-in prefetch + fusion (RRF/DBSF) for server-side scoring.

When used via the RAG pipeline:

var store = await RagStore.BuildAsync(config => config
    .AddDocument("docs.txt")
    .UseOpenAIEmbedding(apiKey)
    .UseVectorStore(new QdrantStore(new QdrantOptions
    {
        Host = "localhost",
        Dimension = 1536
    }))
    .UseHybridSearch()
);

Scope & Metadata Filtering

// Scope isolation (2nd-tier within namespace)
await store.InNamespace("docs").InScope("tenant-1").UpsertAsync(record);
var results = await store.InNamespace("docs").InScope("tenant-1")
    .SearchAsync(queryVector, topK: 10);

// Metadata filtering
var filter = VectorFilter.ByMetadata("category", "science");
var results = await store.InNamespace("docs")
    .SearchAsync(queryVector, topK: 5, filter: filter);

// Minimum score threshold
var filter = new VectorFilter { MinScore = 0.7 };
var results = await store.InNamespace("docs")
    .SearchAsync(queryVector, topK: 5, filter: filter);

Advanced: Inject a Pre-configured Client

using Qdrant.Client;

var client = new QdrantClient("my-qdrant-cloud.example.com", 6334, https: true, apiKey: "my-key");
var store = new QdrantStore(options, client);
// The caller is responsible for disposing the QdrantClient.

Payload Layout

Records are stored as Qdrant points with the following payload keys:

Key Description
_id Original string record ID
_namespace Logical namespace for first-tier isolation (omitted if null)
_content Text content
_scope Scope value for second-tier isolation (omitted if null)
meta.<key> User metadata entries

ID Mapping

Point IDs are deterministic UUIDs derived from namespace + record Id (when namespace is set) or just record Id (when null) via MD5 hash. This ensures the same record Id in different namespaces produces distinct points within the shared collection. The original string ID is preserved in the _id payload field.

Vector Replacement

ReplaceByFilterAsync is available via the IVectorStore default interface method. It performs sequential DeleteByFilterAsyncUpsertBatchAsync. Qdrant does not support server-side transactions, so sequential execution is the best available behavior:

var filter = VectorFilter.ByMetadata("full_path", "/docs/file.md");
await store.InNamespace("documents").ReplaceByFilterAsync(filter, newRecords);

Connection Verification

Call VerifyConnectionAsync to test gRPC connectivity before running queries:

var store = new QdrantStore(new QdrantOptions
{
    Host = "localhost",
    Port = 6334,
    CollectionName = "my_vectors",
    Dimension = 1536
});

try
{
    await store.VerifyConnectionAsync();
    Console.WriteLine("Connected!");
}
catch (Exception ex)
{
    Console.WriteLine($"Connection failed: {ex.Message}");
}

License

See repository root for license information.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.1 26 4/1/2026
3.0.0 48 3/30/2026
2.3.0 46 3/29/2026
2.2.0 45 3/28/2026
2.1.0 82 3/22/2026
2.0.0 88 3/11/2026
1.0.0 82 3/6/2026

v2.2.0: Compatible with Abstractions v2.3.0. ReplaceByFilterAsync available via default interface method (sequential DeleteByFilterAsync then UpsertBatchAsync).