Aerx.QdrantClient.Http 1.16.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Aerx.QdrantClient.Http --version 1.16.2
                    
NuGet\Install-Package Aerx.QdrantClient.Http -Version 1.16.2
                    
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="Aerx.QdrantClient.Http" Version="1.16.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aerx.QdrantClient.Http" Version="1.16.2" />
                    
Directory.Packages.props
<PackageReference Include="Aerx.QdrantClient.Http" />
                    
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 Aerx.QdrantClient.Http --version 1.16.2
                    
#r "nuget: Aerx.QdrantClient.Http, 1.16.2"
                    
#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 Aerx.QdrantClient.Http@1.16.2
                    
#: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=Aerx.QdrantClient.Http&version=1.16.2
                    
Install as a Cake Addin
#tool nuget:?package=Aerx.QdrantClient.Http&version=1.16.2
                    
Install as a Cake Tool

.NET SDK for Qdrant vector database HTTP API

Build Status Test Status NuGet Release

.NET SDK for Qdrant vector database.

Getting started

Creating a client

A client that will connect to Qdrant HTTP API on http://localhost:6334 can be instantiated as follows

var client = new QdrantHttpClient("localhost");

Additional constructor overloads provide more control over how the client is configured. The following example configures a client to use the different Qdrant port and an api key:

var client = new QdrantHttpClient(
    httpAddress: "localhost", 
    port: 1567, 
    apiKey : "my-secret-api-key"
);

Dependency Injection

To register Qdrant HTTP client in the dependency injection container use the following code:

services.AddQdrantHttpClient(options =>
{
    options.HttpAddress = "localhost";
    options.Port = 6334;
    options.ApiKey = "my-secret-api-key";
});

This will register QdrantHttpClient as a singleton service.

If you wish to register IQdrantHttpClient instead (supported from version 1.15.13 of this library), pass the registerAsInterface argument to the AddQdrantHttpClient method:

services.AddQdrantHttpClient(options =>
    {
        options.HttpAddress = "localhost";
        options.Port = 6334;
        options.ApiKey = "my-secret-api-key";
    },
    registerAsInterface: true
);
Register multiple clients

To register multiple Qdrant clients in the dependency injection container use named clients feature:

services.AddQdrantHttpClient(
    Configuration,
    clientConfigurationSectionName: "ConfigSecrtion_1",
    clientName: "My client 1"
);

services.AddQdrantHttpClient(
    Configuration,
    clientConfigurationSectionName: "ConfigSecrtion_2",
    clientName: "My client 2"
);

Note that you can use different configuration sections for each client.

Then inject IQdrantHttpClientFactory and create clients by name:

public class MyService
{
    private readonly IQdrantHttpClient _qdrantHttpClient;

    public MyService(IQdrantHttpClientFactory qdrantHttpClientFactory)
    {
        _qdrantHttpClient = qdrantHttpClientFactory.CreateClient("My client 1");
    }
}

Be sure to call services.AddQdrantHttpClient for each named client and use the same clientName when creating the client from the factory.

!!! When using multiple named clients feature don't inject IQdrantHttpClient or IQdrantHttpClientFactory directly as it will lead to ambiguity. !!!

Working with collections

Once a client has been created, create a new collection

var collectionCreationResult = await _qdrantHttpClient.CreateCollection(
    "my_collection",
    new CreateCollectionRequest(VectorDistanceMetric.Dot, vectorSize: 100, isServeVectorsFromDisk: true)
    {
        OnDiskPayload = true
    },
    cancellationToken
);
Insert vectors into a collection
var upsertPoints = Enumerable.Range(0, 100).Select(
    i => new UpsertPointsRequest.UpsertPoint(
        PointId.Integer((ulong) i),
        Enumerable.Range(0, 128)
            .Select(_ => float.CreateTruncating(Random.Shared.NextDouble()))
            .ToArray(),
        new TestPayload()
        {
            Integer = 123,
            Text = "test"
        }
    )
).ToList();

var upsertPointsResult = await _qdrantHttpClient.UpsertPoints(
    "my_collection",
    new UpsertPointsRequest()
    {
        Points = upsertPoints
    },
    cancellationToken
);
Search for similar vectors
var queryVector = Enumerable.Range(0, 128)
    .Select(_ => float.CreateTruncating(Random.Shared.NextDouble()))
    .ToArray()

// return the 5 closest points
var searchResult = await _qdrantHttpClient.SearchPoints(
    "my_collection",
    new SearchPointsRequest(
        queryVector,
        limit: 5)
    {
        WithVector = false,
        WithPayload = PayloadPropertiesSelector.All
    },
    cancellationToken
);
Search for similar vectors with filtering condition
 var searchResult = await _qdrantHttpClient.SearchPoints(
    "my_collection",
    new SearchPointsRequest(
        queryVector,
        limit: 5)
    {
        WithVector = false,
        WithPayload = PayloadPropertiesSelector.All,
        Filter = 
            Q.Must(
                Q.BeInRange("int_field", greaterThanOrEqual: 0)
            )
            +
            !(
                Q.MatchValue("int_field_2", 1567)
                &
                Q.MatchValue("text_field", "test")
            )
    },
    cancellationToken
);
Search for similar vectors with filtering condition on typed payload

Here we are using typed builders for building filters for typed payload.

 var searchResult = await _qdrantHttpClient.SearchPoints(
    "my_collection",
    new SearchPointsRequest(
        queryVector,
        limit: 5)
    {
        WithVector = false,
        WithPayload = PayloadPropertiesSelector.All,
        Filter = 
            Q.Must(
                Q<TestPayload>.BeInRange(p => p.Integer, greaterThanOrEqual: 0)
            )
            |
            !Q.Must(
                Q<TestPayload>.MatchValue(p => p.Integer, 1)
            )
    },
    cancellationToken
);

Building collections

Conditions are built using Q (from Qdrant or Query) and Q<TPayload> condition builders. Top level filter should contain only Must, MustNot or Should condition groups. Result if any call on Q or Q<TPayload> is implicitly convertible to QdrantFilter, that is accepted everywhere the filter is expected, for ease of use. QdrantFilter can be created directly using QdrantFilter.Create() factory method.

Non-generic condition builder Q

Non-generic condition builder methods other than Must, MustNot, Should and Nested accept string payload field name as the first parameter.

Q.Must(
    Q.MatchValue("test_key", 123),
    Q.MatchValue("test_key_2", "test_value")
)

Filters can be nested.

Q.Should(
    Q.MustNot(Q.MatchValue("test_key", 123)),
    Q.MatchValue("test_key_2", "test_value")
)
Generic condition builder Q<T>

If the type of the payload is known beforehand the generic version of condition builder Q<TPayload> can be used to avoid typos in payload field names. Q<TPayload> has the same methods but with payload field selector expression as the first parameter.

If the payload is as defined as follows

public class TestPayload : Payload
{
    public string Text { get; set; }

    [JsonPropertyName("int")]
    public int? IntProperty { get; set; }

    public NestedClass Nested { get; set; }

    public class NestedClass
    {
        public string Name { get; set; }

        public double Double { set; get; }

        public int Integer { get; set; }
    }
}

Filter can access its structure to derive the payload filed names. Property renames in payload json are supported through standard JsonPropertyNameAttribute. Property nesting is also suppoerted in this case json dot-notation path will be constructed.

Q.Should(
    Q<TestPayload>.MatchValue(p=>p.IntProperty, 123),
    Q<TestPayload>.MatchValue(p=>p.Nested.Name, "test_value")
)
Filter combination operators

In addition to combining filters explicitly, the more terse combination is possible through the use of operators + , |, & and !.

  • + - combines top level filter conditions to simplify filter building.

    Q.Must(
        Q.BeInRange("int_field", greaterThanOrEqual: 0)
    )
    +
    Q.MustNot(
        Q.MatchValue("int_field_2", 1567)
    )
    

    Which is equivalent to the following filter json

    {
        "must": [
            {
                "key": "int_field",
                "range": {
                    "gte": 0
                }
            }
        ],
        "must_not": [
            {
                "key": "int_field_2",
                "match": {
                    "value": 1567
                }
            }
        ]
    }
    
  • | combines two conditions using Should condition group. Nested Should groups are automatically unwrapped.

    Q.Must(
        Q.BeInRange("int_field", greaterThanOrEqual: 0)
    )
    |
    Q.Should(
        Q.MatchValue("int_field_2", 1567)
    )
    

    Which is equivalent to the following filter json

    {
        "should": [
            {
                "must": [
                    {
                        "key": "int_field",
                        "range": {
                            "gte": 0
                        }
                    }
                ]
            },
            {
                "key": "int_field_2",
                "match": {
                    "value": 1567
                }
            }
        ]
    }
    
  • & combines two conditions using Must condition group. Nested Must groups are automatically unwrapped.

    Q.MustNot(
        Q.BeInRange("int_field", greaterThanOrEqual: 0)
    )
    &
    Q.Must(
        Q.MatchValue("int_field_2", 1567)
    )
    

    Which is equivalent to the following filter json

    {
        "must": [
            {
                "must_not": [
                    {
                        "key": "int_field",
                        "range": {
                            "gte": 0
                        }
                    }
                ]
            },
            {
                "key": "int_field_2",
                "match": {
                    "value": 1567
                }
            }
        ]
    }
    
  • ! wraps condition in MustNot condition group. Negates nested Must and MustNot condition groups.

    Q.Should(
        Q<TestPayload>.MatchValue(p=>p.IntProperty, 123),
        !Q<TestPayload>.MatchValue(p=>p.Nested.Name, "test_value")
    )
    +
    !Q.Must(
        Q<TestPayload>.MatchValue(p=>p.IntProperty, 345)
    )
    

    Which is equivalent to the following filter json

    {
        "should": [
            {
                "key": "int_property",
                "match": {
                    "value": 123
                }
            },
            {
                "must_not": [
                    {
                        "key": "nested.name",
                        "match": {
                            "value": "test_value"
                        }
                    }
                ]
            }
        ],
        "must_not": [
            {
                "key": "int_property",
                "match": {
                    "value": 345
                }
            }
        ]
    }
    
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 is compatible.  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 is compatible.  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 is compatible.  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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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
1.16.12 36 1/28/2026
1.16.11 109 1/20/2026
1.16.10 90 1/15/2026
1.16.2 95 1/13/2026
1.16.1 362 12/16/2025
1.16.0 244 12/15/2025
1.16.0-pre9 585 12/1/2025
1.16.0-pre8 132 11/28/2025
1.16.0-pre7 141 11/28/2025
1.16.0-pre6 399 11/19/2025
1.16.0-pre3 282 11/13/2025
1.16.0-pre2 276 11/12/2025
1.16.0-pre14 421 12/11/2025
1.16.0-pre13 444 12/9/2025
1.16.0-pre12 437 12/9/2025
1.16.0-pre11 434 12/9/2025
1.16.0-pre10 436 12/9/2025
1.16.0-pre1 269 11/12/2025
1.15.18 340 11/13/2025
1.15.17 143 11/8/2025
1.15.16 208 11/5/2025
1.15.15 185 10/31/2025 1.15.15 is deprecated because it has critical bugs.
1.15.14 258 10/29/2025
1.15.13 209 10/28/2025
1.15.12 197 10/28/2025
1.15.11 165 10/24/2025
1.15.10 149 10/24/2025
1.15.9 151 10/10/2025
1.15.8 198 10/8/2025
1.15.7 296 9/24/2025
1.15.6 208 9/23/2025
1.15.5 357 9/16/2025
1.15.4 319 8/29/2025
1.15.3 226 8/29/2025
1.15.2 245 8/27/2025
1.15.1 158 8/15/2025
1.15.0 149 8/15/2025
1.14.11 200 8/11/2025
1.14.10 190 8/11/2025
1.14.9 212 8/8/2025
1.14.8 210 8/8/2025
1.14.7 295 8/5/2025
1.14.6 256 8/4/2025
1.14.5 140 8/1/2025
1.14.4 127 8/1/2025
1.14.3 175 7/28/2025
1.14.2 555 6/10/2025
1.14.1 253 6/5/2025
1.14.0 212 6/4/2025
1.13.12 783 5/16/2025
1.13.11 298 5/13/2025
1.13.10 419 5/7/2025
1.13.9 220 5/6/2025
1.13.8 221 4/30/2025
1.13.7 245 4/21/2025
1.13.6 226 4/21/2025
1.13.5 234 4/21/2025
1.13.4 225 3/31/2025
1.13.3 183 3/29/2025
1.13.2 198 3/28/2025
1.13.1 188 3/28/2025
1.13.0 208 3/14/2025
1.12.4 301 3/7/2025
1.12.3 240 2/20/2025
1.12.2 237 12/24/2024
1.12.1 196 12/10/2024
1.12.0 5,312 11/11/2024
1.11.0 262 11/2/2024
1.10.1 279 7/31/2024
1.10.0 180 7/30/2024
1.9.10 222 7/5/2024
1.9.9 253 6/21/2024
1.9.8 393 5/15/2024
1.9.7 183 5/15/2024
1.9.6 185 5/13/2024
1.9.5 6,411 5/13/2024
1.9.4 217 5/6/2024
1.9.3 171 5/2/2024
1.9.2 164 5/2/2024
1.9.1 211 4/27/2024
1.9.0 226 4/27/2024
1.8.0 203 4/26/2024
1.7.3 239 3/29/2024
1.7.2 232 2/26/2024
1.7.1 183 2/26/2024
1.7.0 227 2/19/2024
1.0.1 315 12/6/2023
1.0.0 197 12/6/2023