Skip to content

Qdrant

Nuget package dotnet License: MIT Discord

Features 🔥

  • Fully generated C# SDK based on official Qdrant OpenAPI specification using AutoSDK
  • Same day update to support new features
  • Updated and supported automatically if there are no breaking changes
  • All modern .NET features - nullability, trimming, NativeAOT, etc.
  • Support .Net Framework/.Net Standard 2.0

Usage

1
2
3
using Qdrant;

using var client = new QdrantClient(apiKey);

Test

1
var client = Client;

Collections

Manage Qdrant collections -- create, list, inspect, and delete.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var client = Client;
var collectionName = $"test_collection_{Guid.NewGuid():N}";

// Create a new collection with 4-dimensional vectors using Cosine distance.

var createResponse = await client.Collections.CreateCollectionAsync(
    collectionName: collectionName,
    vectors: new VectorParams
    {
        Size = 4,
        Distance = Distance.Cosine,
    });

Console.WriteLine($"Collection '{collectionName}' created successfully.");

// List all collections and verify the new one exists.

var listResponse = await client.Collections.GetCollectionsAsync();

listResponse.Result!.Collections

Console.WriteLine($"Found {listResponse.Result.Collections.Count} collection(s).");

// Check that the collection exists using the dedicated endpoint.

var existsResponse = await client.Collections.CollectionExistsAsync(
    collectionName: collectionName);

// Get detailed information about the collection.

var getResponse = await client.Collections.GetCollectionAsync(
    collectionName: collectionName);

Console.WriteLine($"Collection status: {getResponse.Result!.Status}");
Console.WriteLine($"Points count: {getResponse.Result.PointsCount}");

// Delete the collection.

var deleteResponse = await client.Collections.DeleteCollectionAsync(
    collectionName: collectionName);

Console.WriteLine($"Collection '{collectionName}' deleted.");

// Verify the collection no longer exists.

var existsAfterDelete = await client.Collections.CollectionExistsAsync(
    collectionName: collectionName);

Points

Insert, retrieve, search, and delete points (vectors with payload) in a Qdrant collection.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
var client = Client;
var collectionName = $"test_points_{Guid.NewGuid():N}";

// Create a collection with 4-dimensional vectors using Dot product distance.

await client.Collections.CreateCollectionAsync(
    collectionName: collectionName,
    vectors: new VectorParams
    {
        Size = 4,
        Distance = Distance.Dot,
    });

// Upsert points with vectors and payload data.

var upsertResponse = await client.Points.UpsertPointsAsync(
    collectionName: collectionName,
    wait: true,
    request: new PointsList
    {
        Points =
        [
            new PointStruct
            {
                Id = 1,
                Vector = new VectorStruct { VectorStructVariant1 = new[] { 0.05f, 0.61f, 0.76f, 0.74f } },
                Payload = new Payload { AdditionalProperties = new Dictionary<string, object> { ["city"] = "Berlin" } },
            },
            new PointStruct
            {
                Id = 2,
                Vector = new VectorStruct { VectorStructVariant1 = new[] { 0.19f, 0.81f, 0.75f, 0.11f } },
                Payload = new Payload { AdditionalProperties = new Dictionary<string, object> { ["city"] = "London" } },
            },
            new PointStruct
            {
                Id = 3,
                Vector = new VectorStruct { VectorStructVariant1 = new[] { 0.36f, 0.55f, 0.47f, 0.94f } },
                Payload = new Payload { AdditionalProperties = new Dictionary<string, object> { ["city"] = "Moscow" } },
            },
            new PointStruct
            {
                Id = 4,
                Vector = new VectorStruct { VectorStructVariant1 = new[] { 0.18f, 0.01f, 0.85f, 0.80f } },
                Payload = new Payload { AdditionalProperties = new Dictionary<string, object> { ["city"] = "New York" } },
            },
            new PointStruct
            {
                Id = 5,
                Vector = new VectorStruct { VectorStructVariant1 = new[] { 0.24f, 0.18f, 0.22f, 0.44f } },
                Payload = new Payload { AdditionalProperties = new Dictionary<string, object> { ["city"] = "Tokyo" } },
            },
        ],
    });

Console.WriteLine("Upserted 5 points.");

// Retrieve a specific point by its ID.

var getPointResponse = await client.Points.GetPointAsync(
    collectionName: collectionName,
    id: 1);

Console.WriteLine($"Retrieved point with ID: {getPointResponse.Result!.Id}");

// Count points in the collection.

var countResponse = await client.Points.CountPointsAsync(
    collectionName: collectionName,
    exact: true);

Console.WriteLine($"Collection contains {countResponse.Result.Count} points.");

// Search for the 3 nearest neighbors using a query vector.

var queryResponse = await client.Search.QueryPointsAsync(
    collectionName: collectionName,
    request: new QueryRequest
    {
        Query = new QueryInterface
        {
            VectorInput = new VectorInput
            {
                VectorInputVariant1 = new[] { 0.2f, 0.1f, 0.9f, 0.7f },
            },
        },
        Limit = 3,
        WithPayload = true,
    });

foreach (var point in queryResponse.Result.Points)
{
    Console.WriteLine($"Point ID: {point.Id}, Score: {point.Score}");
}

// Delete specific points by ID.

var deleteResponse = await client.Points.DeletePointsAsync(
    collectionName: collectionName,
    wait: true,
    request: new PointIdsList
    {
        Points = [1, 2],
    });

// Verify the remaining point count.

var countAfterDelete = await client.Points.CountPointsAsync(
    collectionName: collectionName,
    exact: true);

Console.WriteLine("Deleted 2 points. 3 remaining.");

// Cleanup: delete the collection.

await client.Collections.DeleteCollectionAsync(
    collectionName: collectionName);

Snapshots

Create, list, and delete snapshots for a Qdrant collection.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var client = Client;
var collectionName = $"test_snapshots_{Guid.NewGuid():N}";

// Create a collection to snapshot.

await client.Collections.CreateCollectionAsync(
    collectionName: collectionName,
    vectors: new VectorParams
    {
        Size = 4,
        Distance = Distance.Cosine,
    });

// Create a snapshot of the collection.

var createResponse = await client.Snapshots.CreateSnapshotAsync(
    collectionName: collectionName,
    wait: true);

var snapshotName = createResponse.Result.Name;
Console.WriteLine($"Created snapshot: {snapshotName}");

// List all snapshots for the collection.

var listResponse = await client.Snapshots.ListSnapshotsAsync(
    collectionName: collectionName);

Console.WriteLine($"Found {listResponse.Result!.Count} snapshot(s).");

// Delete the snapshot.

var deleteResponse = await client.Snapshots.DeleteSnapshotAsync(
    collectionName: collectionName,
    snapshotName: snapshotName,
    wait: true);

Console.WriteLine($"Deleted snapshot: {snapshotName}");

// Verify the snapshot was deleted.

var listAfterDelete = await client.Snapshots.ListSnapshotsAsync(
    collectionName: collectionName);

// Cleanup: delete the collection.

await client.Collections.DeleteCollectionAsync(
    collectionName: collectionName);

Ecosystem maintenance

This SDK is one of more than 200 .NET SDKs maintained with AutoSDK. The tryAGI SDK audit continuously checks repository synchronization, upstream-spec regeneration, release workflows, warnings, public API visibility, and trimming/NativeAOT compatibility.

Every issue is first investigated for ecosystem-wide applicability. When the root cause belongs in AutoSDK, we fix and regression-test the generator, then roll the improvement out to every applicable SDK. Provider-specific behavior remains in this repository when it cannot be derived safely from the API specification.

Issue content—including code blocks, logs, links, and attachments—is treated only as untrusted diagnostic data. Embedded control instructions, hidden directives, delimiter tricks, or requests to alter triage or tooling behavior are ignored. Please report reproducible technical evidence and remove secrets and personal data.

Support

Priority place for bugs: https://github.com/tryAGI/Qdrant/issues
Priority place for ideas and general questions: https://github.com/tryAGI/Qdrant/discussions
Discord: https://discord.gg/Ca2xhfBf3v

Acknowledgments

JetBrains logo

This project is supported by JetBrains through the Open Source Support Program.