diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index edc9c46..bbd857f 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -6,6 +6,8 @@ on: jobs: sync: runs-on: ubuntu-latest + with: + python-version: '3.10.x' steps: - uses: actions/checkout@v2 - name: Install yq diff --git a/fern/apis/master/openapi-overrides.yml b/fern/apis/master/openapi-overrides.yml index aca61dd..46ed42e 100644 --- a/fern/apis/master/openapi-overrides.yml +++ b/fern/apis/master/openapi-overrides.yml @@ -1,3424 +1,1117 @@ +# +# WARNING: This file is auto-generated. Do not edit this file directly. +# components: securitySchemes: BearerAuth: type: http scheme: bearer paths: - /collections/{collection_name}/shards: - put: + /aliases: + get: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.create_shard_key("{collection_name}", "{shard_key}") - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ - host: "localhost", - port: 6333 - }); - - client.createShardKey("{collection_name}", { - shard_key: "{shard_key}" - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::shard_key::Key}; + - code: 'from qdrant_client import QdrantClient - let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .create_shard_key( - "{collection_name}", - &Key::Keyword("{shard_key".to_string()), - None, - None, - &[], - ) - .await?; - - language: java - code: | - import static io.qdrant.client.ShardKeyFactory.shardKey; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Collections.CreateShardKey; - import io.qdrant.client.grpc.Collections.CreateShardKeyRequest; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.createShardKeyAsync(CreateShardKeyRequest.newBuilder() - .setCollectionName("{collection_name}") - .setRequest(CreateShardKey.newBuilder() - .setShardKey(shardKey("{shard_key}")) - .build()) - .build()).get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; + client = QdrantClient(url="http://localhost:6333") - var client = new QdrantClient("localhost", 6334); - await client.CreateShardKeyAsync( - "{collection_name}", - new CreateShardKey { ShardKey = new ShardKey { Keyword = "{shard_key}", } } - ); + client.get_aliases() - /collections/{collection_name}/shards/delete: - post: - x-fern-examples: +' + language: python - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.delete_shard_key("{collection_name}", "{shard_key}") - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ - host: "localhost", - port: 6333 - }); - - client.deleteShardKey("{collection_name}", { - shard_key: "{shard_key}" - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::shard_key::Key}; + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.listAliasesAsync().get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .delete_shard_key("{collection_name}", &Key::Keyword("{shard_key".to_string())) - .await?; - - language: java - code: | - import static io.qdrant.client.ShardKeyFactory.shardKey; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Collections.DeleteShardKey; - import io.qdrant.client.grpc.Collections.DeleteShardKeyRequest; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.deleteShardKeyAsync(DeleteShardKeyRequest.newBuilder() - .setCollectionName("{collection_name}") - .setRequest(DeleteShardKey.newBuilder() - .setShardKey(shardKey("{shard_key}")) - .build()) - .build()).get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; + const client = new QdrantClient({ host: "localhost", port: 6333 }); - var client = new QdrantClient("localhost", 6334); - await client.DeleteShardKeyAsync( - "{collection_name}", - new DeleteShardKey { ShardKey = new ShardKey { Keyword = "shard_key", } } - ); + client.getAliases(); - /collections: - get: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: 'use qdrant_client::client::QdrantClient; - client = QdrantClient(url="http://localhost:6333") - - client.get_collections() - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.getCollections(); - - language: rust - code: | - use qdrant_client::client::QdrantClient; let client = QdrantClient::from_url("http://localhost:6334").build()?; - client.list_collections().await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + client.list_aliases().await?; + +' + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client.listCollectionsAsync().get(); - - language: csharp - code: | - using Qdrant.Client; var client = new QdrantClient("localhost", 6334); - await client.ListCollectionsAsync(); - /collections/{collection_name}: + await client.ListAliasesAsync(); + +' + language: csharp + /collections: get: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.get_collection("{collection_name}") - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.getCollection("{collection_name}"); - - language: rust - code: | - use qdrant_client::client::QdrantClient; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; - - client.collection_info("{collection_name}").await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; + - code: 'from qdrant_client import QdrantClient - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - client.getCollectionInfoAsync("{collection_name}").get(); - - language: csharp - code: | - using Qdrant.Client; + client = QdrantClient(url="http://localhost:6333") - var client = new QdrantClient("localhost", 6334); - await client.GetCollectionInfoAsync("{collection_name}"); + client.get_collections() - put: - x-fern-examples: +' + language: python - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models - - client = QdrantClient(url="http://localhost:6333") + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.listCollectionsAsync().get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - client.create_collection( - collection_name="{collection_name}", - vectors_config=models.VectorParams(size=100, distance=models.Distance.COSINE), - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; const client = new QdrantClient({ host: "localhost", port: 6333 }); - client.createCollection("{collection_name}", { - vectors: { size: 100, distance: "Cosine" }, - }); - - language: rust - code: | - use qdrant_client::{ - client::QdrantClient, - qdrant::{vectors_config::Config, CreateCollection, Distance, VectorParams, VectorsConfig}, - }; - let client = QdrantClient::from_url("http://localhost:6334").build()?; + client.getCollections(); - client - .create_collection(&CreateCollection { - collection_name: "{collection_name}".to_string(), - vectors_config: Some(VectorsConfig { - config: Some(Config::Params(VectorParams { - size: 100, - distance: Distance::Cosine.into(), - ..Default::default() - })), - }), - ..Default::default() - }) - .await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Collections.Distance; - import io.qdrant.client.grpc.Collections.VectorParams; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.createCollectionAsync("{collection_name}", - VectorParams.newBuilder().setDistance(Distance.Cosine).setSize(100).build()).get(); - - language: csharp - code: | - patch: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: 'use qdrant_client::client::QdrantClient; - client = QdrantClient(url="http://localhost:6333") - - client.update_collection( - collection_name="{collection_name}", - optimizer_config=models.OptimizersConfigDiff(indexing_threshold=10000), - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.updateCollection("{collection_name}", { - optimizers_config: { - indexing_threshold: 10000, - }, - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::OptimizersConfigDiff}; let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .update_collection( - "{collection_name}", - Some(&OptimizersConfigDiff { - indexing_threshold: Some(10000), - ..Default::default() - }), - None, - None, - None, - None, - None, - ) - .await?; - - language: java - code: | - import static io.qdrant.client.ShardKeyFactory.shardKey; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Collections.OptimizersConfigDiff; - import io.qdrant.client.grpc.Collections.UpdateCollection; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.updateCollectionAsync( - UpdateCollection.newBuilder() - .setCollectionName("{collection_name}") - .setOptimizersConfig( - OptimizersConfigDiff.newBuilder().setIndexingThreshold(10000).build()) - .build()); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; - var client = new QdrantClient("localhost", 6334); + client.list_collections().await?; - await client.UpdateCollectionAsync( - collectionName: "{collection_name}", - optimizersConfig: new OptimizersConfigDiff { IndexingThreshold = 10000 } - ); - delete: - x-fern-examples: +' + language: rust - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.delete_collection(collection_name="{collection_name}") - - language: typescript - code: | - import { QdrantClient } from '@qdrant/qdrant-js'; - - const client = new QdrantClient({url: 'http://127.0.0.1:6333'}); + - code: 'using Qdrant.Client; - client.deleteCollection("{collection_name}"); - - language: rust - code: | - use qdrant_client::client::QdrantClient; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; - - client.delete_collection("{collection_name}").await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = - new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.deleteCollectionAsync("{collection_name}").get(); - - language: csharp - code: | - using Qdrant.Client; var client = new QdrantClient("localhost", 6334); - await client.DeleteCollectionAsync("{collection_name}"); + await client.ListCollectionsAsync(); + +' + language: csharp /collections/aliases: post: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.update_collection_aliases( - change_aliases_operations=[ - models.CreateAliasOperation( - create_alias=models.CreateAlias( - collection_name="example_collection", alias_name="production_collection" - ) - ) - ] - ) - - client.update_collection_aliases( - change_aliases_operations=[ - models.DeleteAliasOperation( - delete_alias=models.DeleteAlias(alias_name="production_collection") - ), - ] - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.update_collection_aliases(\n change_aliases_operations=[\n models.CreateAliasOperation(\n create_alias=models.CreateAlias(\n collection_name=\"example_collection\", alias_name=\"production_collection\"\n )\n )\n ]\n)\n\nclient.update_collection_aliases(\n change_aliases_operations=[\n models.DeleteAliasOperation(\n delete_alias=models.DeleteAlias(alias_name=\"production_collection\")\n ),\n ]\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.ShardKeyFactory.shardKey;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Collections.DeleteShardKey;\nimport io.qdrant.client.grpc.Collections.DeleteShardKeyRequest;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.createAliasAsync(\"production_collection\", \"example_collection\").get();\n\nclient.deleteAliasAsync(\"production_collection\").get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.updateCollectionAliases({\n actions: [\n {\n create_alias: {\n collection_name: \"example_collection\",\n alias_name: \"production_collection\",\n },\n },\n ],\n});\n\nclient.updateCollectionAliases({\n actions: [\n {\n delete_alias: {\n alias_name: \"production_collection\",\n },\n },\n ],\n});\n" + language: typescript + - code-samples: + - code: 'use qdrant_client::client::QdrantClient; - client.updateCollectionAliases({ - actions: [ - { - create_alias: { - collection_name: "example_collection", - alias_name: "production_collection", - }, - }, - ], - }); - - client.updateCollectionAliases({ - actions: [ - { - delete_alias: { - alias_name: "production_collection", - }, - }, - ], - }); - - language: rust - code: | - use qdrant_client::client::QdrantClient; let client = QdrantClient::from_url("http://localhost:6334").build()?; - client.create_alias("example_collection", "production_collection").await?; - - client.delete_alias("production_collection").await?; - - language: java - code: | - import static io.qdrant.client.ShardKeyFactory.shardKey; - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; + client.create_alias("example_collection", "production_collection").await?; - import io.qdrant.client.grpc.Collections.DeleteShardKey; - import io.qdrant.client.grpc.Collections.DeleteShardKeyRequest; - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + client.delete_alias("production_collection").await?; - client.createAliasAsync("production_collection", "example_collection").get(); +' + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client.deleteAliasAsync("production_collection").get(); - - language: csharp - code: | - using Qdrant.Client; var client = new QdrantClient("localhost", 6334); + await client.CreateAliasAsync(aliasName: "production_collection", collectionName: "example_collection"); + await client.DeleteAliasAsync("production_collection"); - /collections/{collection_name}/index: - put: +' + language: csharp + /collections/{collection_name}: + delete: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: 'from qdrant_client import QdrantClient + client = QdrantClient(url="http://localhost:6333") - client.create_payload_index( - collection_name="{collection_name}", - field_name="name_of_the_field_to_index", - field_schema="keyword", - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - const client = new QdrantClient({ host: "localhost", port: 6333 }); + client.delete_collection(collection_name="{collection_name}") - client.createPayloadIndex("{collection_name}", { - field_name: "{field_name}", - field_schema: "keyword", - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::FieldType}; +' + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client =\n new QdrantClient(QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.deleteCollectionAsync(\"{collection_name}\").get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from ''@qdrant/qdrant-js''; - let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .create_field_index( - "{collection_name}", - "{field_name}", - FieldType::Keyword, - None, - None, - ) - .await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Collections.PayloadSchemaType; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.createPayloadIndexAsync( - "{collection_name}", - "{field_name}", - PayloadSchemaType.Keyword, - null, - true, - null, - null); - - language: csharp - code: | - using Qdrant.Client; + const client = new QdrantClient({url: ''http://127.0.0.1:6333''}); - var client = new QdrantClient("localhost", 6334); - await client.CreatePayloadIndexAsync( - collectionName: "{collection_name}", - fieldName: "name_of_the_field_to_index" - ); + client.deleteCollection("{collection_name}"); - /collections/{collection_name}/index/{field_name}: - delete: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: 'use qdrant_client::client::QdrantClient; - client = QdrantClient(url="http://localhost:6333") - - client.delete_payload_index("{collection_name}", "{field_name}"); - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.deletePayloadIndex("{collection_name}", "{field_name}"); - - language: rust - code: | - use qdrant_client::client::QdrantClient; let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .delete_field_index("{collection_name}", "{field_name}", None) - .await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + client.delete_collection("{collection_name}").await?; + +' + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client.deletePayloadIndexAsync("{collection_name}", "{field_name}", true, null, null).get(); - - language: csharp - code: | - using Qdrant.Client; var client = new QdrantClient("localhost", 6334); - await client.DeletePayloadIndexAsync( - collectionName: "{collection_name}", - fieldName: "name_of_the_field_to_index" - ); - /collections/{collection_name}/aliases: + await client.DeleteCollectionAsync("{collection_name}"); + +' + language: csharp get: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: 'from qdrant_client import QdrantClient - client = QdrantClient(url="http://localhost:6333") - client.get_collection_aliases("{collection_name}") - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; + client = QdrantClient(url="http://localhost:6333") - const client = new QdrantClient({ host: "localhost", port: 6333 }); - client.getCollectionAliases("{collection_name}"); - - language: rust - code: | - use qdrant_client::client::QdrantClient; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; + client.get_collection("{collection_name}") - client.list_collection_aliases("{collection_name}").await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; +' + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.getCollectionInfoAsync(\"{collection_name}\").get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - client.listCollectionAliasesAsync("{collection_name}").get(); - - language: csharp - code: | - using Qdrant.Client; + const client = new QdrantClient({ host: "localhost", port: 6333 }); - var client = new QdrantClient("localhost", 6334); - await client.ListCollectionAliasesAsync("{collection_name}"); + client.getCollection("{collection_name}"); - /aliases: - get: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: 'use qdrant_client::client::QdrantClient; - client = QdrantClient(url="http://localhost:6333") - - client.get_aliases() - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.getAliases(); - - language: rust - code: | - use qdrant_client::client::QdrantClient; let client = QdrantClient::from_url("http://localhost:6334").build()?; - client.list_aliases().await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + client.collection_info("{collection_name}").await?; + +' + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client.listAliasesAsync().get(); - - language: csharp - code: | - using Qdrant.Client; var client = new QdrantClient("localhost", 6334); - await client.ListAliasesAsync(); - /collections/{collection_name}/snapshots/recover: + await client.GetCollectionInfoAsync("{collection_name}"); + +' + language: csharp + patch: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.update_collection(\n collection_name=\"{collection_name}\",\n optimizer_config=models.OptimizersConfigDiff(indexing_threshold=10000),\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.ShardKeyFactory.shardKey;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Collections.OptimizersConfigDiff;\nimport io.qdrant.client.grpc.Collections.UpdateCollection;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.updateCollectionAsync(\n UpdateCollection.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .setOptimizersConfig(\n OptimizersConfigDiff.newBuilder().setIndexingThreshold(10000).build())\n .build());\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.updateCollection(\"{collection_name}\", {\n optimizers_config: {\n indexing_threshold: 10000,\n },\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::OptimizersConfigDiff};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .update_collection(\n \"{collection_name}\",\n Some(&OptimizersConfigDiff {\n indexing_threshold: Some(10000),\n ..Default::default()\n }),\n None,\n None,\n None,\n None,\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.UpdateCollectionAsync(\n collectionName: \"{collection_name}\",\n optimizersConfig: new OptimizersConfigDiff { IndexingThreshold = 10000 }\n);\n" + language: csharp put: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.recover_snapshot( - "{collection_name}", - "http://example.com/path/to/snapshot.shapshot", - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.recoverSnapshot("{collection_name}", { - location: "http://example.com/path/to/snapshot.shapshot", - }); - - /collections/{collection_name}/snapshots: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.create_collection(\n collection_name=\"{collection_name}\",\n vectors_config=models.VectorParams(size=100, distance=models.Distance.COSINE),\n)\n" + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Collections.Distance;\nimport io.qdrant.client.grpc.Collections.VectorParams;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.createCollectionAsync(\"{collection_name}\",\n VectorParams.newBuilder().setDistance(Distance.Cosine).setSize(100).build()).get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.createCollection(\"{collection_name}\", {\n vectors: { size: 100, distance: \"Cosine\" },\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{\n client::QdrantClient,\n qdrant::{vectors_config::Config, CreateCollection, Distance, VectorParams, VectorsConfig},\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .create_collection(&CreateCollection {\n collection_name: \"{collection_name}\".to_string(),\n vectors_config: Some(VectorsConfig {\n config: Some(Config::Params(VectorParams {\n size: 100,\n distance: Distance::Cosine.into(),\n ..Default::default()\n })),\n }),\n ..Default::default()\n })\n .await?;\n" + language: rust + /collections/{collection_name}/aliases: get: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: 'from qdrant_client import QdrantClient - client = QdrantClient(url="http://localhost:6333") - - client.list_snapshots(collection_name="{collection_name}") - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - const client = new QdrantClient({ host: "localhost", port: 6333 }); + client = QdrantClient(url="http://localhost:6333") - client.listSnapshots("{collection_name}"); - - language: rust - code: | - use qdrant_client::client::QdrantClient; - let client = QdrantClient::from_url("http://localhost:6334").build()?; + client.get_collection_aliases("{collection_name}") - client.list_snapshots("{collection_name}").await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; +' + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.listCollectionAliasesAsync(\"{collection_name}\").get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - client.listSnapshotAsync("{collection_name}").get(); - - language: csharp - code: | - using Qdrant.Client; + const client = new QdrantClient({ host: "localhost", port: 6333 }); - var client = new QdrantClient("localhost", 6334); - await client.ListSnapshotsAsync("{collection_name}"); + client.getCollectionAliases("{collection_name}"); - post: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: 'use qdrant_client::client::QdrantClient; - client = QdrantClient(url="http://localhost:6333") - - client.create_snapshot(collection_name="{collection_name}") - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.createSnapshot("{collection_name}"); - - language: rust - code: | - use qdrant_client::client::QdrantClient; let client = QdrantClient::from_url("http://localhost:6334").build()?; - client.create_snapshot("{collection_name}").await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + client.list_collection_aliases("{collection_name}").await?; + +' + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client.createSnapshotAsync("{collection_name}").get(); - - language: csharp - code: | - using Qdrant.Client; var client = new QdrantClient("localhost", 6334); - await client.CreateSnapshotAsync("{collection_name}"); - /collections/{collection_name}/snapshots/{snapshot_name}: + await client.ListCollectionAliasesAsync("{collection_name}"); + +' + language: csharp + /collections/{collection_name}/index: + put: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.create_payload_index(\n collection_name=\"{collection_name}\",\n field_name=\"name_of_the_field_to_index\",\n field_schema=\"keyword\",\n)\n" + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Collections.PayloadSchemaType;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.createPayloadIndexAsync(\n \"{collection_name}\",\n \"{field_name}\",\n PayloadSchemaType.Keyword,\n null,\n true,\n null,\n null);\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.createPayloadIndex(\"{collection_name}\", {\n field_name: \"{field_name}\",\n field_schema: \"keyword\",\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::FieldType};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n.create_field_index(\n \"{collection_name}\",\n \"{field_name}\",\n FieldType::Keyword,\n None,\n None,\n)\n.await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.CreatePayloadIndexAsync(\n collectionName: \"{collection_name}\",\n fieldName: \"name_of_the_field_to_index\"\n);\n" + language: csharp + /collections/{collection_name}/index/{field_name}: delete: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.delete_snapshot( - collection_name="{collection_name}", snapshot_name="{snapshot_name}" - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; + - code: 'from qdrant_client import QdrantClient - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.deleteSnapshot("{collection_name}", "{snapshot_name}"); - - language: rust - code: | - use qdrant_client::client::QdrantClient; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; - - client - .delete_snapshot("{collection_name}", "{snapshot_name}") - .await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - client.deleteSnapshotAsync("{collection_name}", "{snapshot_name}").get(); - - language: csharp - code: | - using Qdrant.Client; + client = QdrantClient(url="http://localhost:6333") - var client = new QdrantClient("localhost", 6334); - await client.DeleteSnapshotAsync("{collection_name}", "{snapshot_name}"); + client.delete_payload_index("{collection_name}", "{field_name}"); - /snapshots: - get: - x-fern-examples: +' + language: python - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.deletePayloadIndexAsync(\"{collection_name}\", \"{field_name}\", true, null, null).get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - client.list_full_snapshots() - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; const client = new QdrantClient({ host: "localhost", port: 6333 }); - client.listFullSnapshots(); - - language: rust - code: | - use qdrant_client::client::QdrantClient; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; - - client.list_full_snapshots().await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.listFullSnapshotAsync().get(); - - language: csharp - code: | - using Qdrant.Client; - var client = new QdrantClient("localhost", 6334); - - await client.ListFullSnapshotsAsync(); + client.deletePayloadIndex("{collection_name}", "{field_name}"); +' + language: typescript + - code-samples: + - code: "use qdrant_client::client::QdrantClient;\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .delete_field_index(\"{collection_name}\", \"{field_name}\", None)\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.DeletePayloadIndexAsync(\n collectionName: \"{collection_name}\",\n fieldName: \"name_of_the_field_to_index\"\n);\n" + language: csharp + /collections/{collection_name}/points: post: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.create_full_snapshot() - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.createFullSnapshot(); - - language: rust - code: | - use qdrant_client::client::QdrantClient; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; - - client.create_full_snapshot().await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.createFullSnapshotAsync().get(); - - language: csharp - code: | - using Qdrant.Client; - - var client = new QdrantClient("localhost", 6334); - - await client.CreateFullSnapshotAsync(); - - /snapshots/{snapshot_name}: - delete: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.retrieve(\n collection_name=\"{collection_name}\",\n ids=[0, 3, 100],\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.PointIdFactory.id;\n\nimport java.util.List;\n\nclient\n .retrieveAsync(\"{collection_name}\", List.of(id(0), id(30), id(100)), false, false, null)\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.retrieve(\"{collection_name}\", {\n ids: [0, 3, 100],\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::client::QdrantClient;\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .get_points(\n \"{collection_name}\",\n None,\n &[0.into(), 30.into(), 100.into()],\n Some(false),\n Some(false),\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.RetrieveAsync(\n collectionName: \"{collection_name}\",\n ids: [0, 30, 100],\n withPayload: false,\n withVectors: false\n);\n" + language: csharp + put: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.delete_full_snapshot(snapshot_name="{snapshot_name}") - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.deleteFullSnapshot("{snapshot_name}"); - - language: rust - code: | - use qdrant_client::client::QdrantClient; + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.upsert(\n collection_name=\"{collection_name}\",\n points=[\n models.PointStruct(\n id=1,\n payload={\n \"color\": \"red\",\n },\n vector=[0.9, 0.1, 0.1],\n ),\n models.PointStruct(\n id=2,\n payload={\n \"color\": \"green\",\n },\n vector=[0.1, 0.9, 0.1],\n ),\n models.PointStruct(\n id=3,\n payload={\n \"color\": \"blue\",\n },\n vector=[0.1, 0.1, 0.9],\n ),\n ],\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.PointIdFactory.id;\nimport static io.qdrant.client.VectorFactory.vector;\nimport static io.qdrant.client.VectorsFactory.namedVectors;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.PointStruct;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .upsertAsync(\n \"{collection_name}\",\n List.of(\n PointStruct.newBuilder()\n .setId(id(1))\n .setVectors(\n namedVectors(\n Map.of(\n \"image\",\n vector(List.of(0.9f, 0.1f, 0.1f, 0.2f)),\n \"text\",\n vector(List.of(0.4f, 0.7f, 0.1f, 0.8f, 0.1f, 0.1f, 0.9f, 0.2f)))))\n .build(),\n PointStruct.newBuilder()\n .setId(id(2))\n .setVectors(\n namedVectors(\n Map.of(\n \"image\",\n List.of(0.2f, 0.1f, 0.3f, 0.9f),\n \"text\",\n List.of(0.5f, 0.2f, 0.7f, 0.4f, 0.7f, 0.2f, 0.3f, 0.9f))))\n .build()))\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.upsert(\"{collection_name}\", {\n points: [\n {\n id: 1,\n payload: { color: \"red\" },\n vector: [0.9, 0.1, 0.1],\n },\n {\n id: 2,\n payload: { color: \"green\" },\n vector: [0.1, 0.9, 0.1],\n },\n {\n id: 3,\n payload: { color: \"blue\" },\n vector: [0.1, 0.1, 0.9],\n },\n ],\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::PointStruct};\nuse serde_json::json;\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .upsert_points_batch_blocking(\n \"{collection_name}\".to_string(),\n None,\n vec![\n PointStruct::new(\n 1,\n vec![0.9, 0.1, 0.1],\n json!(\n {\"color\": \"red\"}\n )\n .try_into()\n .unwrap(),\n ),\n PointStruct::new(\n 2,\n vec![0.1, 0.9, 0.1],\n json!(\n {\"color\": \"green\"}\n )\n .try_into()\n .unwrap(),\n ),\n PointStruct::new(\n 3,\n vec![0.1, 0.1, 0.9],\n json!(\n {\"color\": \"blue\"}\n )\n .try_into()\n .unwrap(),\n ),\n ],\n None,\n 100,\n )\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.UpsertAsync(\n collectionName: \"{collection_name}\",\n points: new List\n {\n new()\n {\n Id = 1,\n Vectors = new[] { 0.9f, 0.1f, 0.1f },\n Payload = { [\"city\"] = \"red\" }\n },\n new()\n {\n Id = 2,\n Vectors = new[] { 0.1f, 0.9f, 0.1f },\n Payload = { [\"city\"] = \"green\" }\n },\n new()\n {\n Id = 3,\n Vectors = new[] { 0.1f, 0.1f, 0.9f },\n Payload = { [\"city\"] = \"blue\" }\n }\n }\n);\n" + language: csharp + /collections/{collection_name}/points/batch: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.batch_update_points(\n collection_name=\"{collection_name}\",\n update_operations=[\n models.UpsertOperation(\n upsert=models.PointsList(\n points=[\n models.PointStruct(\n id=1,\n vector=[1.0, 2.0, 3.0, 4.0],\n payload={},\n ),\n ]\n )\n ),\n models.UpdateVectorsOperation(\n update_vectors=models.UpdateVectors(\n points=[\n models.PointVectors(\n id=1,\n vector=[1.0, 2.0, 3.0, 4.0],\n )\n ]\n )\n ),\n models.SetPayloadOperation(\n set_payload=models.SetPayload(\n payload={\n \"test_payload_2\": 2,\n \"test_payload_3\": 3,\n },\n points=[1],\n )\n ),\n ],\n)\n" + language: python + - code-samples: + - code: "import java.util.List;\nimport java.util.Map;\n\nimport static io.qdrant.client.PointIdFactory.id;\nimport static io.qdrant.client.ValueFactory.value;\nimport static io.qdrant.client.VectorsFactory.vectors;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.PointStruct;\nimport io.qdrant.client.grpc.Points.PointVectors;\nimport io.qdrant.client.grpc.Points.PointsIdsList;\nimport io.qdrant.client.grpc.Points.PointsSelector;\nimport io.qdrant.client.grpc.Points.PointsUpdateOperation;\nimport io.qdrant.client.grpc.Points.PointsUpdateOperation.PointStructList;\nimport io.qdrant.client.grpc.Points.PointsUpdateOperation.SetPayload;\nimport io.qdrant.client.grpc.Points.PointsUpdateOperation.UpdateVectors;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .batchUpdateAsync(\n \"{collection_name}\",\n List.of(\n PointsUpdateOperation.newBuilder()\n .setUpsert(\n PointStructList.newBuilder()\n .addPoints(\n PointStruct.newBuilder()\n .setId(id(1))\n .setVectors(vectors(\n 1.0 f,\n 2.0 f,\n 3.0 f,\n 4.0 f))\n .build())\n .build())\n .build(),\n PointsUpdateOperation.newBuilder()\n .setUpdateVectors(\n UpdateVectors.newBuilder()\n .addPoints(\n PointVectors.newBuilder()\n .setId(id(1))\n .setVectors(vectors(\n 1.0 f,\n 2.0 f,\n 3.0 f,\n 4.0 f))\n .build())\n .build())\n .build(),\n PointsUpdateOperation.newBuilder()\n .setSetPayload(\n SetPayload.newBuilder()\n .setPointsSelector(\n PointsSelector.newBuilder()\n .setPoints(PointsIdsList\n .newBuilder()\n .addIds(id(1))\n .build())\n .build())\n .putAllPayload(\n Map.of(\"test_payload_2\",\n value(2),\n \"test_payload_3\",\n value(3)))\n .build())\n .build()))\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.batchUpdate(\"{collection_name}\", {\n operations: [\n {\n upsert: {\n points: [\n {\n id: 1,\n vector: [1.0, 2.0, 3.0, 4.0],\n payload: {},\n },\n ],\n },\n },\n {\n update_vectors: {\n points: [\n {\n id: 1,\n vector: [1.0, 2.0, 3.0, 4.0],\n },\n ],\n },\n },\n {\n set_payload: {\n payload: {\n test_payload_2: 2,\n test_payload_3: 3,\n },\n points: [1],\n },\n },\n ],\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::qdrant::{\n points_selector::PointsSelectorOneOf,\n points_update_operation::{\n Operation, PointStructList, SetPayload, UpdateVectors,\n },\n PointStruct, PointVectors, PointsIdsList, PointsSelector, PointsUpdateOperation,\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .batch_updates_blocking(\n \"{collection_name}\",\n &[\n PointsUpdateOperation {\n operation: Some(Operation::Upsert(PointStructList {\n points: vec![PointStruct::new(\n 1,\n vec![1.0, 2.0, 3.0, 4.0],\n json!({}).try_into().unwrap(),\n )],\n ..Default::default()\n })),\n },\n PointsUpdateOperation {\n operation: Some(Operation::UpdateVectors(UpdateVectors {\n points: vec![PointVectors {\n id: Some(1.into()),\n vectors: Some(vec![1.0, 2.0, 3.0, 4.0].into()),\n }],\n ..Default::default()\n })),\n },\n PointsUpdateOperation {\n operation: Some(Operation::OverwritePayload(SetPayload {\n points_selector: Some(PointsSelector {\n points_selector_one_of: Some(PointsSelectorOneOf::Points(\n PointsIdsList {\n ids: vec![1.into()],\n },\n )),\n }),\n payload: HashMap::from([(\"test_payload\".to_string(), 1.into())]),\n ..Default::default()\n })),\n },\n ],\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.UpdateBatchAsync(\n \"{collection_name}\",\n [\n new()\n {\n Upsert = new()\n {\n Points =\n {\n new PointStruct { Id = 1, Vectors = new[] { 0.9f, 0.1f, 0.1f } },\n }\n }\n },\n new()\n {\n UpdateVectors = new()\n {\n Points =\n {\n new PointVectors { Id = 1, Vectors = new[] { 0.9f, 0.1f, 0.1f } },\n }\n }\n },\n new()\n {\n SetPayload = new()\n {\n PointsSelector = new PointsSelector { Points = new PointsIdsList { Ids = { 1 } } },\n Payload = { [\"test_payload_2\"] = 2, [\"test_payload_3\"] = 3 }\n }\n }\n ]\n);\n" + language: csharp + /collections/{collection_name}/points/count: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.count(\n collection_name=\"{collection_name}\",\n count_filter=models.Filter(\n must=[\n models.FieldCondition(key=\"color\", match=models.MatchValue(value=\"red\")),\n ]\n ),\n exact=True,\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.ConditionFactory.matchKeyword;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.Filter;\n\nQdrantClient client = new QdrantClient(QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .countAsync(\n \"{collection_name}\",\n Filter.newBuilder().addMust(matchKeyword(\"color\", \"red\")).build(),\n true)\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.count(\"{collection_name}\", {\n filter: {\n must: [\n {\n key: \"color\",\n match: {\n value: \"red\",\n },\n },\n ],\n },\n exact: true,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::{Condition, CountPoints, Filter}};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .count(&CountPoints {\n collection_name: \"{collection_name}\".to_string(),\n filter: Some(Filter::must([Condition::matches(\n \"color\",\n \"red\".to_string(),\n )])),\n exact: Some(true),\n ..Default::default()\n })\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing static Qdrant.Client.Grpc.Conditions;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.CountAsync(\n collectionName: \"{collection_name}\",\n filter: MatchKeyword(\"color\", \"red\"),\n exact: true\n);\n" + language: csharp + /collections/{collection_name}/points/delete: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.delete(\n collection_name=\"{collection_name}\",\n points_selector=models.PointIdsList(\n points=[0, 3, 100],\n ),\n)\n\nclient.delete(\n collection_name=\"{collection_name}\",\n points_selector=models.FilterSelector(\n filter=models.Filter(\n must=[\n models.FieldCondition(\n key=\"color\",\n match=models.MatchValue(value=\"red\"),\n ),\n ],\n )\n ),\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.PointIdFactory.id;\nimport static io.qdrant.client.ConditionFactory.matchKeyword;\n\nimport java.util.List;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.Filter;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.deleteAsync(\"{collection_name}\", List.of(id(0), id(3), id(100)));\n\nclient\n .deleteAsync(\n \"{collection_name}\",\n Filter.newBuilder().addMust(matchKeyword(\"color\", \"red\")).build())\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.delete(\"{collection_name}\", {\n points: [0, 3, 100],\n});\n\nclient.delete(\"{collection_name}\", {\n filter: {\n must: [\n {\n key: \"color\",\n match: {\n value: \"red\",\n },\n },\n ],\n },\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::{points_selector::PointsSelectorOneOf, Condition, Filter, PointsIdsList, PointsSelector}};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .delete_points_blocking(\n \"{collection_name}\",\n None,\n &PointsSelector {\n points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList {\n ids: vec![0.into(), 3.into(), 100.into()],\n })),\n },\n None,\n )\n .await?;\n\n client\n .delete_points_blocking(\n \"{collection_name}\",\n None,\n &PointsSelector {\n points_selector_one_of: Some(PointsSelectorOneOf::Filter(Filter::must([\n Condition::matches(\"color\", \"red\".to_string()),\n ]))),\n },\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: 'using Qdrant.Client; - let client = QdrantClient::from_url("http://localhost:6334").build()?; - client.delete_full_snapshot("{snapshot_name}").await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; + var client = new QdrantClient("localhost", 6334); - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - client.deleteFullSnapshotAsync("{snapshot_name}").get(); - - language: csharp - code: | - using Qdrant.Client; + await client.DeleteAsync(collectionName: "{collection_name}", ids: [0, 3, 100]); - var client = new QdrantClient("localhost", 6334); - await client.DeleteFullSnapshotAsync("{snapshot_name}"); + await client.DeleteAsync(collectionName: "{collection_name}", filter: MatchKeyword("color", "red")); - /collections/{collection_name}/points: +' + language: csharp + /collections/{collection_name}/points/discover: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.discover(\n \"{collection_name}\",\n target=[0.2, 0.1, 0.9, 0.7],\n context=[\n models.ContextExamplePair(positive=100, negative=718),\n models.ContextExamplePair(positive=200, negative=300),\n ],\n limit=10,\n)\n" + language: python + - code-samples: + - code: "import java.util.List;\n\nimport static io.qdrant.client.PointIdFactory.id;\nimport static io.qdrant.client.VectorFactory.vector;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.ContextExamplePair;\nimport io.qdrant.client.grpc.Points.DiscoverPoints;\nimport io.qdrant.client.grpc.Points.TargetVector;\nimport io.qdrant.client.grpc.Points.VectorExample;\n\nQdrantClient client =\n new QdrantClient(QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .discoverAsync(\n DiscoverPoints.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .setTarget(\n TargetVector.newBuilder()\n .setSingle(\n VectorExample.newBuilder()\n .setVector(vector(0.2f, 0.1f, 0.9f, 0.7f))\n .build()))\n .addAllContext(\n List.of(\n ContextExamplePair.newBuilder()\n .setPositive(VectorExample.newBuilder().setId(id(100)))\n .setNegative(VectorExample.newBuilder().setId(id(718)))\n .build(),\n ContextExamplePair.newBuilder()\n .setPositive(VectorExample.newBuilder().setId(id(200)))\n .setNegative(VectorExample.newBuilder().setId(id(300)))\n .build()))\n .setLimit(10)\n .build())\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.discover(\"{collection_name}\", {\n target: [0.2, 0.1, 0.9, 0.7],\n context: [\n {\n positive: 100,\n negative: 718,\n },\n {\n positive: 200,\n negative: 300,\n },\n ],\n limit: 10,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{\n client::QdrantClient,\n qdrant::{\n target_vector::Target, vector_example::Example, ContextExamplePair, DiscoverPoints,\n TargetVector, VectorExample,\n },\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .discover(&DiscoverPoints {\n collection_name: \"{collection_name}\".to_string(),\n target: Some(TargetVector {\n target: Some(Target::Single(VectorExample {\n example: Some(Example::Vector(vec![0.2, 0.1, 0.9, 0.7].into())),\n })),\n }),\n context: vec![\n ContextExamplePair {\n positive: Some(VectorExample {\n example: Some(Example::Id(100.into())),\n }),\n negative: Some(VectorExample {\n example: Some(Example::Id(718.into())),\n }),\n },\n ContextExamplePair {\n positive: Some(VectorExample {\n example: Some(Example::Id(200.into())),\n }),\n negative: Some(VectorExample {\n example: Some(Example::Id(300.into())),\n }),\n },\n ],\n limit: 10,\n ..Default::default()\n })\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.DiscoverAsync(\n collectionName: \"{collection_name}\",\n target: new TargetVector\n {\n Single = new VectorExample { Vector = new float[] { 0.2f, 0.1f, 0.9f, 0.7f }, }\n },\n context:\n [\n new()\n {\n Positive = new VectorExample { Id = 100 },\n Negative = new VectorExample { Id = 718 }\n },\n new()\n {\n Positive = new VectorExample { Id = 200 },\n Negative = new VectorExample { Id = 300 }\n }\n ],\n limit: 10\n);\n" + language: csharp + /collections/{collection_name}/points/discover/batch: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\ndiscover_queries = [\n models.DiscoverRequest(\n target=[0.2, 0.1, 0.9, 0.7],\n context=[\n models.ContextExamplePair(\n positive=100,\n negative=718,\n ),\n models.ContextExamplePair(\n positive=200,\n negative=300,\n ),\n ],\n limit=10,\n ),\n models.DiscoverRequest(\n target=[0.5, 0.3, 0.2, 0.3],\n context=[\n models.ContextExamplePair(\n positive=342,\n negative=213,\n ),\n models.ContextExamplePair(\n positive=100,\n negative=200,\n ),\n ],\n limit=5,\n ),\n]\n\nclient.discover_batch(\"{collection_name}\", discover_queries)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.PointIdFactory.id;\nimport static io.qdrant.client.VectorFactory.vector;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.ContextExamplePair;\nimport io.qdrant.client.grpc.Points.DiscoverPoints;\nimport io.qdrant.client.grpc.Points.TargetVector;\nimport io.qdrant.client.grpc.Points.VectorExample;\n\nQdrantClient client = new QdrantClient(QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nList discoverPoints = Arrays.asList(\n DiscoverPoints.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .setTarget(\n TargetVector.newBuilder()\n .setSingle(\n VectorExample.newBuilder()\n .setVector(vector(\n 0.2 f,\n 0.1 f,\n 0.9 f,\n 0.7 f))\n .build()))\n .addAllContext(\n List.of(\n ContextExamplePair.newBuilder()\n .setPositive(VectorExample\n .newBuilder()\n .setId(id(100)))\n .setNegative(VectorExample\n .newBuilder()\n .setId(id(718)))\n .build(),\n ContextExamplePair.newBuilder()\n .setPositive(VectorExample\n .newBuilder()\n .setId(id(200)))\n .setNegative(VectorExample\n .newBuilder()\n .setId(id(300)))\n .build()))\n .setLimit(10)\n .build(),\n DiscoverPoints.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .setTarget(\n TargetVector.newBuilder()\n .setSingle(\n VectorExample.newBuilder()\n .setVector(vector(\n 0.5 f, 0.3 f, 0.2 f, 0.3 f))\n .build()))\n .addAllContext(\n List.of(\n ContextExamplePair.newBuilder()\n .setPositive(VectorExample\n .newBuilder()\n .setId(id(342)))\n .setNegative(VectorExample\n .newBuilder()\n .setId(id(213)))\n .build(),\n ContextExamplePair.newBuilder()\n .setPositive(VectorExample\n .newBuilder()\n .setId(id(100)))\n .setNegative(VectorExample\n .newBuilder()\n .setId(id(200)))\n .build()))\n .setLimit(10)\n .build());\nclient.discoverBatchAsync(\"{collection_name}\", discoverPoints, null);\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nconst searches = [\n {\n target: [0.2, 0.1, 0.9, 0.7],\n context: [\n {\n positive: 100,\n negative: 718,\n },\n {\n positive: 200,\n negative: 300,\n },\n ],\n limit: 10,\n },\n {\n target: [0.5, 0.3, 0.2, 0.3],\n context: [\n {\n positive: 342,\n negative: 213,\n },\n {\n positive: 100,\n negative: 200,\n },\n ],\n limit: 5,\n },\n];\n\nclient.discoverBatchPoints(\"{collection_name}\", {\n searches,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{\n client::QdrantClient,\n qdrant::{\n target_vector::Target, vector_example::Example, ContextExamplePair, DiscoverBatchPoints,\n DiscoverPoints, TargetVector, VectorExample,\n },\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nlet discover_points = &DiscoverBatchPoints {\n collection_name: \"{collection_name}\".to_string(),\n discover_points: vec![\n DiscoverPoints {\n collection_name: \"{collection_name}\".to_string(),\n target: Some(TargetVector {\n target: Some(Target::Single(VectorExample {\n example: Some(Example::Vector(vec![0.2, 0.1, 0.9, 0.7].into())),\n })),\n }),\n context: vec![\n ContextExamplePair {\n positive: Some(VectorExample {\n example: Some(Example::Id(100.into())),\n }),\n negative: Some(VectorExample {\n example: Some(Example::Id(718.into())),\n }),\n },\n ContextExamplePair {\n positive: Some(VectorExample {\n example: Some(Example::Id(200.into())),\n }),\n negative: Some(VectorExample {\n example: Some(Example::Id(300.into())),\n }),\n },\n ],\n limit: 10,\n ..Default::default()\n },\n DiscoverPoints {\n collection_name: \"{collection_name}\".to_string(),\n target: Some(TargetVector {\n target: Some(Target::Single(VectorExample {\n example: Some(Example::Vector(vec![0.5, 0.3, 0.2, 0.3].into())),\n })),\n }),\n context: vec![\n ContextExamplePair {\n positive: Some(VectorExample {\n example: Some(Example::Id(342.into())),\n }),\n negative: Some(VectorExample {\n example: Some(Example::Id(213.into())),\n }),\n },\n ContextExamplePair {\n positive: Some(VectorExample {\n example: Some(Example::Id(100.into())),\n }),\n negative: Some(VectorExample {\n example: Some(Example::Id(200.into())),\n }),\n },\n ],\n limit: 10,\n ..Default::default()\n },\n ],\n ..Default::default()\n};\n\nclient.discover_batch(discover_points).await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nvar discoverPoints = new List\n{\n new DiscoverPoints\n {\n CollectionName = \"{collection_name}\",\n Target = new TargetVector\n {\n Single = new VectorExample { Vector = new float[] { 0.2f, 0.1f, 0.9f, 0.7f }, }\n },\n Context =\n {\n new ContextExamplePair()\n {\n Positive = new VectorExample { Id = 100 },\n Negative = new VectorExample { Id = 718 }\n },\n new ContextExamplePair()\n {\n Positive = new VectorExample { Id = 200 },\n Negative = new VectorExample { Id = 300 }\n }\n },\n Limit = 10\n },\n new DiscoverPoints\n {\n CollectionName = \"{collection_name}\",\n Target = new TargetVector\n {\n Single = new VectorExample { Vector = new float[] { 0.5f, 0.3f, 0.2f, 0.3f }, }\n },\n Context =\n {\n new ContextExamplePair()\n {\n Positive = new VectorExample { Id = 342 },\n Negative = new VectorExample { Id = 213 }\n },\n new ContextExamplePair()\n {\n Positive = new VectorExample { Id = 100 },\n Negative = new VectorExample { Id = 200 }\n }\n },\n Limit = 10\n }\n};\nawait client.DiscoverBatchAsync(\"{collection_name}\", discoverPoints);\n" + language: csharp + /collections/{collection_name}/points/payload: post: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.set_payload(\n collection_name=\"{collection_name}\",\n payload={\n \"property1\": \"string\",\n \"property2\": \"string\",\n },\n points=[0, 3, 10],\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.PointIdFactory.id;\nimport static io.qdrant.client.ValueFactory.value;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .setPayloadAsync(\n \"{collection_name}\",\n Map.of(\"property1\", value(\"string\"), \"property2\", value(\"string\")),\n List.of(id(0), id(3), id(10)),\n true,\n null,\n null)\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.setPayload(\"{collection_name}\", {\n payload: {\n property1: \"string\",\n property2: \"string\",\n },\n points: [0, 3, 10],\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::{\n points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector,\n}};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .set_payload_blocking(\n \"{collection_name}\",\n None,\n &PointsSelector {\n points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList {\n ids: vec![0.into(), 3.into(), 10.into()],\n })),\n },\n json!({\n \"property1\": \"string\",\n \"property2\": \"string\",\n })\n .try_into()\n .unwrap(),\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.SetPayloadAsync(\n collectionName: \"{collection_name}\",\n payload: new Dictionary { { \"property1\", \"string\" }, { \"property2\", \"string\" } },\n ids: new ulong[] { 0, 3, 10 }\n);\n" + language: csharp + put: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.overwrite_payload(\n collection_name=\"{collection_name}\",\n payload={\n \"property1\": \"string\",\n \"property2\": \"string\",\n },\n points=[0, 3, 10],\n)\n" + language: python + - code-samples: + - code: "import java.util.List;\n\nimport static io.qdrant.client.PointIdFactory.id;\nimport static io.qdrant.client.ValueFactory.value;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .overwritePayloadAsync(\n \"{collection_name}\",\n Map.of(\"property1\", value(\"string\"), \"property2\", value(\"string\")),\n List.of(id(0), id(3), id(10)),\n true,\n null,\n null)\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.overwritePayload(\"{collection_name}\", {\n payload: {\n property1: \"string\",\n property2: \"string\",\n },\n points: [0, 3, 10],\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::{\n points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector,\n}};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .overwrite_payload_blocking(\n \"{collection_name}\",\n None,\n &PointsSelector {\n points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList {\n ids: vec![0.into(), 3.into(), 10.into()],\n })),\n },\n json!({\n \"property1\": \"string\",\n \"property2\": \"string\",\n })\n .try_into()\n .unwrap(),\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.OverwritePayloadAsync(\n collectionName: \"{collection_name}\",\n payload: new Dictionary { { \"property1\", \"string\" }, { \"property2\", \"string\" } },\n ids: new ulong[] { 0, 3, 10 }\n);\n" + language: csharp + /collections/{collection_name}/points/payload/clear: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.clear_payload(\n collection_name=\"{collection_name}\",\n points_selector=[0, 3, 100],\n)\n" + language: python + - code-samples: + - code: "import java.util.List;\n\nimport static io.qdrant.client.PointIdFactory.id;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.clearPayloadAsync(\"{collection_name}\", List.of(id(0), id(3), id(100)), null, null, null)\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.clearPayload(\"{collection_name}\", {\n points: [0, 3, 100],\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::{\n points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector,\n}};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .clear_payload(\n \"{collection_name}\",\n None,\n Some(PointsSelector {\n points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList {\n ids: vec![0.into(), 3.into(), 100.into()],\n })),\n }),\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client = QdrantClient(url="http://localhost:6333") - client.retrieve( - collection_name="{collection_name}", - ids=[0, 3, 100], - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; + var client = new QdrantClient("localhost", 6334); - const client = new QdrantClient({ host: "localhost", port: 6333 }); - client.retrieve("{collection_name}", { - ids: [0, 3, 100], - }); - - language: rust - code: | - use qdrant_client::client::QdrantClient; + await client.ClearPayloadAsync("{collection_name}", [0, 3, 10]); - let client = QdrantClient::from_url("http://localhost:6334").build()?; +' + language: csharp + /collections/{collection_name}/points/payload/delete: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.delete_payload(\n collection_name=\"{collection_name}\",\n keys=[\"color\", \"price\"],\n points=[0, 3, 100],\n)\n" + language: python + - code-samples: + - code: "import java.util.List;\n\nimport static io.qdrant.client.PointIdFactory.id;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .deletePayloadAsync(\n \"{collection_name}\",\n List.of(\"color\", \"price\"),\n List.of(id(0), id(3), id(100)),\n true,\n null,\n null)\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.deletePayload(\"{collection_name}\", {\n keys: [\"color\", \"price\"],\n points: [0, 3, 100],\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::{\n points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector,\n}};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .delete_payload_blocking(\n \"{collection_name}\",\n None,\n &PointsSelector {\n points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList {\n ids: vec![0.into(), 3.into(), 100.into()],\n })),\n },\n vec![\"color\".to_string(), \"price\".to_string()],\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client - .get_points( - "{collection_name}", - None, - &[0.into(), 30.into(), 100.into()], - Some(false), - Some(false), - None, - ) - .await?; - - language: java - code: | - import static io.qdrant.client.PointIdFactory.id; - - import java.util.List; - - client - .retrieveAsync("{collection_name}", List.of(id(0), id(30), id(100)), false, false, null) - .get(); - - language: csharp - code: | - using Qdrant.Client; var client = new QdrantClient("localhost", 6334); - await client.RetrieveAsync( - collectionName: "{collection_name}", - ids: [0, 30, 100], - withPayload: false, - withVectors: false - ); + await client.DeletePayloadAsync("{collection_name}", ["color", "price"], [0, 3, 10]); + +' + language: csharp + /collections/{collection_name}/points/recommend: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.recommend(\n collection_name=\"{collection_name}\",\n positive=[100, 231],\n negative=[718, [0.2, 0.3, 0.4, 0.5]],\n strategy=models.RecommendStrategy.AVERAGE_VECTOR,\n query_filter=models.Filter(\n must=[\n models.FieldCondition(\n key=\"city\",\n match=models.MatchValue(\n value=\"London\",\n ),\n )\n ]\n ),\n limit=3,\n)\n" + language: python + - code-samples: + - code: "import java.util.List;\n\nimport static io.qdrant.client.ConditionFactory.matchKeyword;\nimport static io.qdrant.client.PointIdFactory.id;\nimport static io.qdrant.client.VectorFactory.vector;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.Filter;\nimport io.qdrant.client.grpc.Points.RecommendPoints;\nimport io.qdrant.client.grpc.Points.RecommendStrategy;\n\nQdrantClient client =\n new QdrantClient(QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .recommendAsync(\n RecommendPoints.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .addAllPositive(List.of(id(100), id(200)))\n .addAllPositiveVectors(List.of(vector(100.0f, 231.0f)))\n .addAllNegative(List.of(id(718)))\n .addAllPositiveVectors(List.of(vector(0.2f, 0.3f, 0.4f, 0.5f)))\n .setStrategy(RecommendStrategy.AverageVector)\n .setFilter(Filter.newBuilder().addMust(matchKeyword(\"city\", \"London\")))\n .setLimit(3)\n .build())\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.recommend(\"{collection_name}\", {\n positive: [100, 231],\n negative: [718, [0.2, 0.3, 0.4, 0.5]],\n strategy: \"average_vector\",\n filter: {\n must: [\n {\n key: \"city\",\n match: {\n value: \"London\",\n },\n },\n ],\n },\n limit: 3,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{\n client::QdrantClient,\n qdrant::{Condition, Filter, RecommendPoints, RecommendStrategy},\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .recommend(&RecommendPoints {\n collection_name: \"{collection_name}\".to_string(),\n positive: vec![100.into(), 200.into()],\n positive_vectors: vec![vec![100.0, 231.0].into()],\n negative: vec![718.into()],\n negative_vectors: vec![vec![0.2, 0.3, 0.4, 0.5].into()],\n strategy: Some(RecommendStrategy::AverageVector.into()),\n filter: Some(Filter::must([Condition::matches(\n \"city\",\n \"London\".to_string(),\n )])),\n limit: 3,\n ..Default::default()\n })\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\nusing static Qdrant.Client.Grpc.Conditions;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.RecommendAsync(\n \"{collection_name}\",\n positive: new ulong[] { 100, 231 },\n negative: new ulong[] { 718 },\n filter: MatchKeyword(\"city\", \"London\"),\n limit: 3\n);\n" + language: csharp + /collections/{collection_name}/points/recommend/batch: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nrecommend_queries = [\n models.RecommendRequest(\n positive=[100, 231], negative=[718], filter=filter_, limit=3\n ),\n models.RecommendRequest(positive=[200, 67], negative=[300], limit=3),\n]\n\nclient.recommend_batch(collection_name=\"{collection_name}\", requests=recommend_queries)\n" + language: python + - code-samples: + - code: "import java.util.List;\n\nimport static io.qdrant.client.ConditionFactory.matchKeyword;\nimport static io.qdrant.client.PointIdFactory.id;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.Filter;\nimport io.qdrant.client.grpc.Points.RecommendPoints;\n\nQdrantClient client =\n new QdrantClient(QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nFilter filter = Filter.newBuilder().addMust(matchKeyword(\"city\", \"London\")).build();\n\nList recommendQueries =\n List.of(\n RecommendPoints.newBuilder()\n .addAllPositive(List.of(id(100), id(231)))\n .addAllNegative(List.of(id(718)))\n .setFilter(filter)\n .setLimit(3)\n .build(),\n RecommendPoints.newBuilder()\n .addAllPositive(List.of(id(200), id(67)))\n .addAllNegative(List.of(id(300)))\n .setFilter(filter)\n .setLimit(3)\n .build());\n\nclient.recommendBatchAsync(\"{collection_name}\", recommendQueries, null).get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nconst searches = [\n {\n positive: [100, 231],\n negative: [718],\n limit: 3,\n },\n {\n positive: [200, 67],\n negative: [300],\n limit: 3,\n },\n];\n\nclient.recommend_batch(\"{collection_name}\", {\n searches,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{\n client::QdrantClient,\n qdrant::{Condition, Filter, RecommendBatchPoints, RecommendPoints},\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nlet filter = Filter::must([Condition::matches(\"city\", \"London\".to_string())]);\n\nlet recommend_queries = vec![\n RecommendPoints {\n collection_name: \"{collection_name}\".to_string(),\n positive: vec![100.into(), 231.into()],\n negative: vec![718.into()],\n filter: Some(filter.clone()),\n limit: 3,\n ..Default::default()\n },\n RecommendPoints {\n collection_name: \"{collection_name}\".to_string(),\n positive: vec![200.into(), 67.into()],\n negative: vec![300.into()],\n filter: Some(filter),\n limit: 3,\n ..Default::default()\n },\n];\n\nclient\n .recommend_batch(&RecommendBatchPoints {\n collection_name: \"{collection_name}\".to_string(),\n recommend_points: recommend_queries,\n ..Default::default()\n })\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\nusing static Qdrant.Client.Grpc.Conditions;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nvar filter = MatchKeyword(\"city\", \"london\");\n\nawait client.RecommendBatchAsync(\n collectionName: \"{collection_name}\",\n recommendSearches:\n [\n new()\n {\n CollectionName = \"{collection_name}\",\n Positive = { new PointId[] { 100, 231 } },\n Negative = { new PointId[] { 718 } },\n Limit = 3,\n Filter = filter,\n },\n new()\n {\n CollectionName = \"{collection_name}\",\n Positive = { new PointId[] { 200, 67 } },\n Negative = { new PointId[] { 300 } },\n Limit = 3,\n Filter = filter,\n }\n ]\n);\n" + language: csharp + /collections/{collection_name}/points/recommend/groups: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.recommend_groups(\n collection_name=\"{collection_name}\",\n positive=[100, 231],\n negative=[718],\n group_by=\"document_id\",\n limit=3,\n group_size=2,\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.PointIdFactory.id;\n\nimport java.util.List;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.RecommendPointGroups;\nimport io.qdrant.client.grpc.Points.RecommendStrategy;\n\nQdrantClient client =\n new QdrantClient(QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.recommendGroupsAsync(RecommendPointGroups.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .setGroupBy(\"document_id\")\n .setGroupSize(2)\n .addAllPositive(List.of(id(100), id(200)))\n .addAllNegative(List.of(id(718)))\n .setStrategy(RecommendStrategy.AverageVector)\n .setLimit(3)\n .build());\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.recommendPointGroups(\"{collection_name}\", {\n positive: [100, 231],\n negative: [718],\n group_by: \"document_id\",\n limit: 3,\n group_size: 2,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{\n client::QdrantClient,\n qdrant::{RecommendPointGroups, RecommendStrategy},\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .recommend_groups(&RecommendPointGroups {\n collection_name: \"{collection_name}\".to_string(),\n group_by: \"document_id\".to_string(),\n group_size: 2,\n positive: vec![100.into(), 200.into()],\n negative: vec![718.into()],\n strategy: Some(RecommendStrategy::AverageVector.into()),\n limit: 3,\n ..Default::default()\n })\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing static Qdrant.Client.Grpc.Conditions;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.RecommendGroupsAsync(\n \"{collection_name}\",\n \"document_id\",\n groupSize: 3,\n positive: new ulong[] { 100, 231 },\n negative: new ulong[] { 718 },\n filter: MatchKeyword(\"city\", \"London\"),\n limit: 3\n);\n" + language: csharp + /collections/{collection_name}/points/scroll: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.scroll(\n collection_name=\"{collection_name}\",\n scroll_filter=models.Filter(\n must=[\n models.FieldCondition(key=\"color\", match=models.MatchValue(value=\"red\")),\n ]\n ),\n limit=1,\n with_payload=True,\n with_vectors=False,\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.ConditionFactory.matchKeyword;\nimport static io.qdrant.client.WithPayloadSelectorFactory.enable;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.Filter;\nimport io.qdrant.client.grpc.Points.ScrollPoints;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .scrollAsync(\n ScrollPoints.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .setFilter(Filter.newBuilder().addMust(matchKeyword(\"color\", \"red\")).build())\n .setLimit(1)\n .setWithPayload(enable(true))\n .build())\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.scroll(\"{collection_name}\", {\n filter: {\n must: [\n {\n key: \"color\",\n match: {\n value: \"red\",\n },\n },\n ],\n },\n limit: 1,\n with_payload: true,\n with_vector: false,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::{Condition, Filter, ScrollPoints}};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .scroll(&ScrollPoints {\n collection_name: \"{collection_name}\".to_string(),\n filter: Some(Filter::must([Condition::matches(\n \"color\",\n \"red\".to_string(),\n )])),\n limit: Some(1),\n with_payload: Some(true.into()),\n with_vectors: Some(false.into()),\n ..Default::default()\n })\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing static Qdrant.Client.Grpc.Conditions;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.ScrollAsync(\n collectionName: \"{collection_name}\",\n filter: MatchKeyword(\"color\", \"red\"),\n limit: 1,\n payloadSelector: true\n);\n" + language: csharp + /collections/{collection_name}/points/search: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.search(\n collection_name=\"{collection_name}\",\n query_filter=models.Filter(\n must=[\n models.FieldCondition(\n key=\"city\",\n match=models.MatchValue(\n value=\"London\",\n ),\n )\n ]\n ),\n query_vector=[0.2, 0.1, 0.9, 0.7],\n limit=3,\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.ConditionFactory.matchKeyword;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.Filter;\nimport io.qdrant.client.grpc.Points.SearchPoints;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .searchAsync(\n SearchPoints.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .setFilter(Filter.newBuilder().addMust(matchKeyword(\"city\", \"London\")).build())\n .addAllVector(List.of(0.2f, 0.1f, 0.9f, 0.7f))\n .setLimit(3)\n .build())\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.search(\"{collection_name}\", {\n filter: {\n must: [\n {\n key: \"city\",\n match: {\n value: \"London\",\n },\n },\n ],\n },\n vector: [0.2, 0.1, 0.9, 0.7],\n limit: 3,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{\n client::QdrantClient,\n qdrant::{Condition, Filter, SearchParams, SearchPoints},\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .search_points(&SearchPoints {\n collection_name: \"{collection_name}\".to_string(),\n filter: Some(Filter::must([Condition::matches(\n \"city\",\n \"London\".to_string(),\n )])),\n params: Some(SearchParams {\n hnsw_ef: Some(128),\n exact: Some(false),\n ..Default::default()\n }),\n vector: vec![0.2, 0.1, 0.9, 0.7],\n limit: 3,\n ..Default::default()\n })\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing static Qdrant.Client.Grpc.Conditions;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.SearchAsync(\n collectionName: \"{collection_name}\",\n vector: new float[] { 0.2f, 0.1f, 0.9f, 0.7f },\n filter: MatchKeyword(\"city\", \"London\"),\n limit: 3\n);\n" + language: csharp + /collections/{collection_name}/points/search/batch: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nfilter_ = models.Filter(\n must=[\n models.FieldCondition(\n key=\"city\",\n match=models.MatchValue(\n value=\"London\",\n ),\n )\n ]\n)\n\nsearch_queries = [\n models.SearchRequest(vector=[0.2, 0.1, 0.9, 0.7], filter=filter_, limit=3),\n models.SearchRequest(vector=[0.5, 0.3, 0.2, 0.3], filter=filter_, limit=3),\n]\n\nclient.search_batch(collection_name=\"{collection_name}\", requests=search_queries)\n" + language: python + - code-samples: + - code: "import java.util.List;\n\nimport static io.qdrant.client.ConditionFactory.matchKeyword;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.Filter;\nimport io.qdrant.client.grpc.Points.SearchPoints;\n\nQdrantClient client =\n new QdrantClient(QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nFilter filter = Filter.newBuilder().addMust(matchKeyword(\"city\", \"London\")).build();\nList searches =\n List.of(\n SearchPoints.newBuilder()\n .addAllVector(List.of(0.2f, 0.1f, 0.9f, 0.7f))\n .setFilter(filter)\n .setLimit(3)\n .build(),\n SearchPoints.newBuilder()\n .addAllVector(List.of(0.5f, 0.3f, 0.2f, 0.3f))\n .setFilter(filter)\n .setLimit(3)\n .build());\nclient.searchBatchAsync(\"{collection_name}\", searches, null).get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nconst filter = {\n must: [\n {\n key: \"city\",\n match: {\n value: \"London\",\n },\n },\n ],\n};\n\nconst searches = [\n {\n vector: [0.2, 0.1, 0.9, 0.7],\n filter,\n limit: 3,\n },\n {\n vector: [0.5, 0.3, 0.2, 0.3],\n filter,\n limit: 3,\n },\n];\n\nclient.searchBatch(\"{collection_name}\", {\n searches,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{\n client::QdrantClient,\n qdrant::{Condition, Filter, SearchBatchPoints, SearchPoints},\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nlet filter = Filter::must([Condition::matches(\"city\", \"London\".to_string())]);\n\nlet searches = vec![\n SearchPoints {\n collection_name: \"{collection_name}\".to_string(),\n vector: vec![0.2, 0.1, 0.9, 0.7],\n filter: Some(filter.clone()),\n limit: 3,\n ..Default::default()\n },\n SearchPoints {\n collection_name: \"{collection_name}\".to_string(),\n vector: vec![0.5, 0.3, 0.2, 0.3],\n filter: Some(filter),\n limit: 3,\n ..Default::default()\n },\n];\n\nclient\n .search_batch_points(&SearchBatchPoints {\n collection_name: \"{collection_name}\".to_string(),\n search_points: searches,\n read_consistency: None,\n ..Default::default()\n })\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\nusing static Qdrant.Client.Grpc.Conditions;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nvar filter = MatchKeyword(\"city\", \"London\");\n\nvar searches = new List\n{\n new()\n {\n Vector = { new float[] { 0.2f, 0.1f, 0.9f, 0.7f } },\n Filter = filter,\n Limit = 3\n },\n new()\n {\n Vector = { new float[] { 0.5f, 0.3f, 0.2f, 0.3f } },\n Filter = filter,\n Limit = 3\n }\n};\n\nawait client.SearchBatchAsync(collectionName: \"{collection_name}\", searches: searches);\n" + language: csharp + /collections/{collection_name}/points/search/groups: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.search_groups(\n collection_name=\"{collection_name}\",\n query_vector=[1.1],\n group_by=\"document_id\",\n limit=4,\n group_size=2,\n)\n" + language: python + - code-samples: + - code: "import java.util.List;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.SearchPointGroups;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .searchGroupsAsync(\n SearchPointGroups.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .addAllVector(List.of(1.1f))\n .setGroupBy(\"document_id\")\n .setLimit(4)\n .setGroupSize(2)\n .build())\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.searchPointGroups(\"{collection_name}\", {\n vector: [1.1],\n group_by: \"document_id\",\n limit: 4,\n group_size: 2,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{\n client::QdrantClient,\n qdrant::SearchPointGroups,\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .search_groups(&SearchPointGroups {\n collection_name: \"{collection_name}\".to_string(),\n vector: vec![1.1],\n group_by: \"document_id\".to_string(),\n limit: 4,\n group_size: 2,\n ..Default::default()\n })\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.SearchGroupsAsync(\n collectionName: \"{collection_name}\",\n vector: new float[] { 1.1f },\n groupBy: \"document_id\",\n limit: 4,\n groupSize: 2\n);\n" + language: csharp + /collections/{collection_name}/points/vectors: put: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models - - client = QdrantClient(url="http://localhost:6333") - - client.upsert( - collection_name="{collection_name}", - points=[ - models.PointStruct( - id=1, - payload={ - "color": "red", - }, - vector=[0.9, 0.1, 0.1], - ), - models.PointStruct( - id=2, - payload={ - "color": "green", - }, - vector=[0.1, 0.9, 0.1], - ), - models.PointStruct( - id=3, - payload={ - "color": "blue", - }, - vector=[0.1, 0.1, 0.9], - ), - ], - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.upsert("{collection_name}", { - points: [ - { - id: 1, - payload: { color: "red" }, - vector: [0.9, 0.1, 0.1], - }, - { - id: 2, - payload: { color: "green" }, - vector: [0.1, 0.9, 0.1], - }, - { - id: 3, - payload: { color: "blue" }, - vector: [0.1, 0.1, 0.9], - }, - ], - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::PointStruct}; - use serde_json::json; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; - - client - .upsert_points_batch_blocking( - "{collection_name}".to_string(), - None, - vec![ - PointStruct::new( - 1, - vec![0.9, 0.1, 0.1], - json!( - {"color": "red"} - ) - .try_into() - .unwrap(), - ), - PointStruct::new( - 2, - vec![0.1, 0.9, 0.1], - json!( - {"color": "green"} - ) - .try_into() - .unwrap(), - ), - PointStruct::new( - 3, - vec![0.1, 0.1, 0.9], - json!( - {"color": "blue"} - ) - .try_into() - .unwrap(), - ), - ], - None, - 100, - ) - .await?; - - language: java - code: | - import static io.qdrant.client.PointIdFactory.id; - import static io.qdrant.client.VectorFactory.vector; - import static io.qdrant.client.VectorsFactory.namedVectors; - - import java.util.List; - import java.util.Map; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.PointStruct; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .upsertAsync( - "{collection_name}", - List.of( - PointStruct.newBuilder() - .setId(id(1)) - .setVectors( - namedVectors( - Map.of( - "image", - vector(List.of(0.9f, 0.1f, 0.1f, 0.2f)), - "text", - vector(List.of(0.4f, 0.7f, 0.1f, 0.8f, 0.1f, 0.1f, 0.9f, 0.2f))))) - .build(), - PointStruct.newBuilder() - .setId(id(2)) - .setVectors( - namedVectors( - Map.of( - "image", - List.of(0.2f, 0.1f, 0.3f, 0.9f), - "text", - List.of(0.5f, 0.2f, 0.7f, 0.4f, 0.7f, 0.2f, 0.3f, 0.9f)))) - .build())) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; - - var client = new QdrantClient("localhost", 6334); - - await client.UpsertAsync( - collectionName: "{collection_name}", - points: new List - { - new() - { - Id = 1, - Vectors = new[] { 0.9f, 0.1f, 0.1f }, - Payload = { ["city"] = "red" } - }, - new() - { - Id = 2, - Vectors = new[] { 0.1f, 0.9f, 0.1f }, - Payload = { ["city"] = "green" } - }, - new() - { - Id = 3, - Vectors = new[] { 0.1f, 0.1f, 0.9f }, - Payload = { ["city"] = "blue" } - } - } - ); - - /collections/{collection_name}/points/delete: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.update_vectors(\n collection_name=\"{collection_name}\",\n points=[\n models.PointVectors(\n id=1,\n vector={\n \"image\": [0.1, 0.2, 0.3, 0.4],\n },\n ),\n models.PointVectors(\n id=2,\n vector={\n \"text\": [0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2],\n },\n ),\n ],\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.PointIdFactory.id;\nimport static io.qdrant.client.VectorFactory.vector;\nimport static io.qdrant.client.VectorsFactory.namedVectors;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .updateVectorsAsync(\n \"{collection_name}\",\n List.of(\n PointVectors.newBuilder()\n .setId(id(1))\n .setVectors(namedVectors(Map.of(\"image\", vector(List.of(0.1f, 0.2f, 0.3f, 0.4f)))))\n .build(),\n PointVectors.newBuilder()\n .setId(id(2))\n .setVectors(\n namedVectors(\n Map.of(\n \"text\", vector(List.of(0.9f, 0.8f, 0.7f, 0.6f, 0.5f, 0.4f, 0.3f, 0.2f)))))\n .build()))\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.updateVectors(\"{collection_name}\", {\n points: [\n {\n id: 1,\n vector: {\n image: [0.1, 0.2, 0.3, 0.4],\n },\n },\n {\n id: 2,\n vector: {\n text: [0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2],\n },\n },\n ],\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::qdrant::PointVectors;\nuse std::collections::HashMap;\n\nclient\n .update_vectors_blocking(\n \"{collection_name}\",\n None,\n &[\n PointVectors {\n id: Some(1.into()),\n vectors: Some(\n HashMap::from([(\"image\".to_string(), vec![0.1, 0.2, 0.3, 0.4])]).into(),\n ),\n },\n PointVectors {\n id: Some(2.into()),\n vectors: Some(\n HashMap::from([(\n \"text\".to_string(),\n vec![0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2],\n )])\n .into(),\n ),\n },\n ],\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.UpdateVectorsAsync(\n collectionName: \"{collection_name}\",\n points: new List\n {\n new() { Id = 1, Vectors = (\"image\", new float[] { 0.1f, 0.2f, 0.3f, 0.4f }) },\n new()\n {\n Id = 2,\n Vectors = (\"text\", new float[] { 0.9f, 0.8f, 0.7f, 0.6f, 0.5f, 0.4f, 0.3f, 0.2f })\n }\n }\n);\n" + language: csharp + /collections/{collection_name}/points/vectors/delete: post: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.delete( - collection_name="{collection_name}", - points_selector=models.PointIdsList( - points=[0, 3, 100], - ), - ) - - client.delete( - collection_name="{collection_name}", - points_selector=models.FilterSelector( - filter=models.Filter( - must=[ - models.FieldCondition( - key="color", - match=models.MatchValue(value="red"), - ), - ], - ) - ), - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.delete("{collection_name}", { - points: [0, 3, 100], - }); - - client.delete("{collection_name}", { - filter: { - must: [ - { - key: "color", - match: { - value: "red", - }, - }, - ], - }, - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::{points_selector::PointsSelectorOneOf, Condition, Filter, PointsIdsList, PointsSelector}}; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.delete_vectors(\n collection_name=\"{collection_name}\",\n points=[0, 3, 100],\n vectors=[\"text\", \"image\"],\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.PointIdFactory.id;\n\nimport java.util.List;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .deleteVectorsAsync(\n \"{collection_name}\", List.of(\"text\", \"image\"), List.of(id(0), id(3), id(10)))\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.deleteVectors(\"{collection_name}\", {\n points: [0, 3, 10],\n vectors: [\"text\", \"image\"],\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::{\n points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector, VectorsSelector,\n}};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .delete_vectors_blocking(\n \"{collection_name}\",\n None,\n &PointsSelector {\n points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList {\n ids: vec![0.into(), 3.into(), 10.into()],\n })),\n },\n &VectorsSelector {\n names: vec![\"text\".into(), \"image\".into()],\n },\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client - .delete_points_blocking( - "{collection_name}", - None, - &PointsSelector { - points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList { - ids: vec![0.into(), 3.into(), 100.into()], - })), - }, - None, - ) - .await?; - - client - .delete_points_blocking( - "{collection_name}", - None, - &PointsSelector { - points_selector_one_of: Some(PointsSelectorOneOf::Filter(Filter::must([ - Condition::matches("color", "red".to_string()), - ]))), - }, - None, - ) - .await?; - - language: java - code: | - import static io.qdrant.client.PointIdFactory.id; - import static io.qdrant.client.ConditionFactory.matchKeyword; - - import java.util.List; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.Filter; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.deleteAsync("{collection_name}", List.of(id(0), id(3), id(100))); - - client - .deleteAsync( - "{collection_name}", - Filter.newBuilder().addMust(matchKeyword("color", "red")).build()) - .get(); - - language: csharp - code: | - using Qdrant.Client; var client = new QdrantClient("localhost", 6334); - await client.DeleteAsync(collectionName: "{collection_name}", ids: [0, 3, 100]); - await client.DeleteAsync(collectionName: "{collection_name}", filter: MatchKeyword("color", "red")); + await client.DeleteVectorsAsync("{collection_name}", ["text", "image"], [0, 3, 10]); - /collections/{collection_name}/points/vectors: +' + language: csharp + /collections/{collection_name}/shards: put: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models - - client = QdrantClient(url="http://localhost:6333") + - code: 'from qdrant_client import QdrantClient - client.update_vectors( - collection_name="{collection_name}", - points=[ - models.PointVectors( - id=1, - vector={ - "image": [0.1, 0.2, 0.3, 0.4], - }, - ), - models.PointVectors( - id=2, - vector={ - "text": [0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2], - }, - ), - ], - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.updateVectors("{collection_name}", { - points: [ - { - id: 1, - vector: { - image: [0.1, 0.2, 0.3, 0.4], - }, - }, - { - id: 2, - vector: { - text: [0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2], - }, - }, - ], - }); - - language: rust - code: | - use qdrant_client::qdrant::PointVectors; - use std::collections::HashMap; - - client - .update_vectors_blocking( - "{collection_name}", - None, - &[ - PointVectors { - id: Some(1.into()), - vectors: Some( - HashMap::from([("image".to_string(), vec![0.1, 0.2, 0.3, 0.4])]).into(), - ), - }, - PointVectors { - id: Some(2.into()), - vectors: Some( - HashMap::from([( - "text".to_string(), - vec![0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2], - )]) - .into(), - ), - }, - ], - None, - ) - .await?; - - language: java - code: | - import static io.qdrant.client.PointIdFactory.id; - import static io.qdrant.client.VectorFactory.vector; - import static io.qdrant.client.VectorsFactory.namedVectors; - - import java.util.List; - import java.util.Map; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .updateVectorsAsync( - "{collection_name}", - List.of( - PointVectors.newBuilder() - .setId(id(1)) - .setVectors(namedVectors(Map.of("image", vector(List.of(0.1f, 0.2f, 0.3f, 0.4f))))) - .build(), - PointVectors.newBuilder() - .setId(id(2)) - .setVectors( - namedVectors( - Map.of( - "text", vector(List.of(0.9f, 0.8f, 0.7f, 0.6f, 0.5f, 0.4f, 0.3f, 0.2f))))) - .build())) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; + client = QdrantClient(url="http://localhost:6333") - var client = new QdrantClient("localhost", 6334); - await client.UpdateVectorsAsync( - collectionName: "{collection_name}", - points: new List - { - new() { Id = 1, Vectors = ("image", new float[] { 0.1f, 0.2f, 0.3f, 0.4f }) }, - new() - { - Id = 2, - Vectors = ("text", new float[] { 0.9f, 0.8f, 0.7f, 0.6f, 0.5f, 0.4f, 0.3f, 0.2f }) - } - } - ); + client.create_shard_key("{collection_name}", "{shard_key}") - /collections/{collection_name}/points/vectors/delete: +' + language: python + - code-samples: + - code: "import static io.qdrant.client.ShardKeyFactory.shardKey;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Collections.CreateShardKey;\nimport io.qdrant.client.grpc.Collections.CreateShardKeyRequest;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.createShardKeyAsync(CreateShardKeyRequest.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .setRequest(CreateShardKey.newBuilder()\n .setShardKey(shardKey(\"{shard_key}\"))\n .build())\n .build()).get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({\n host: \"localhost\",\n port: 6333\n});\n\nclient.createShardKey(\"{collection_name}\", {\n shard_key: \"{shard_key}\"\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::shard_key::Key};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .create_shard_key(\n \"{collection_name}\",\n &Key::Keyword(\"{shard_key\".to_string()),\n None,\n None,\n &[],\n )\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.CreateShardKeyAsync(\n \"{collection_name}\",\n new CreateShardKey { ShardKey = new ShardKey { Keyword = \"{shard_key}\", } }\n);\n" + language: csharp + /collections/{collection_name}/shards/delete: post: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.delete_vectors( - collection_name="{collection_name}", - points=[0, 3, 100], - vectors=["text", "image"], - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); + - code: 'from qdrant_client import QdrantClient - client.deleteVectors("{collection_name}", { - points: [0, 3, 10], - vectors: ["text", "image"], - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::{ - points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector, VectorsSelector, - }}; - let client = QdrantClient::from_url("http://localhost:6334").build()?; - - client - .delete_vectors_blocking( - "{collection_name}", - None, - &PointsSelector { - points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList { - ids: vec![0.into(), 3.into(), 10.into()], - })), - }, - &VectorsSelector { - names: vec!["text".into(), "image".into()], - }, - None, - ) - .await?; - - language: java - code: | - import static io.qdrant.client.PointIdFactory.id; - - import java.util.List; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .deleteVectorsAsync( - "{collection_name}", List.of("text", "image"), List.of(id(0), id(3), id(10))) - .get(); - - language: csharp - code: | - using Qdrant.Client; + client = QdrantClient(url="http://localhost:6333") - var client = new QdrantClient("localhost", 6334); - await client.DeleteVectorsAsync("{collection_name}", ["text", "image"], [0, 3, 10]); + client.delete_shard_key("{collection_name}", "{shard_key}") - /collections/{collection_name}/points/payload: - post: +' + language: python + - code-samples: + - code: "import static io.qdrant.client.ShardKeyFactory.shardKey;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Collections.DeleteShardKey;\nimport io.qdrant.client.grpc.Collections.DeleteShardKeyRequest;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.deleteShardKeyAsync(DeleteShardKeyRequest.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .setRequest(DeleteShardKey.newBuilder()\n .setShardKey(shardKey(\"{shard_key}\"))\n .build())\n .build()).get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({\n host: \"localhost\",\n port: 6333\n});\n\nclient.deleteShardKey(\"{collection_name}\", {\n shard_key: \"{shard_key}\"\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::shard_key::Key};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .delete_shard_key(\"{collection_name}\", &Key::Keyword(\"{shard_key\".to_string()))\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.DeleteShardKeyAsync(\n \"{collection_name}\",\n new DeleteShardKey { ShardKey = new ShardKey { Keyword = \"shard_key\", } }\n);\n" + language: csharp + /collections/{collection_name}/snapshots: + get: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.set_payload( - collection_name="{collection_name}", - payload={ - "property1": "string", - "property2": "string", - }, - points=[0, 3, 10], - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.setPayload("{collection_name}", { - payload: { - property1: "string", - property2: "string", - }, - points: [0, 3, 10], - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::{ - points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector, - }}; + - code: 'from qdrant_client import QdrantClient - let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .set_payload_blocking( - "{collection_name}", - None, - &PointsSelector { - points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList { - ids: vec![0.into(), 3.into(), 10.into()], - })), - }, - json!({ - "property1": "string", - "property2": "string", - }) - .try_into() - .unwrap(), - None, - ) - .await?; - - language: java - code: | - import static io.qdrant.client.PointIdFactory.id; - import static io.qdrant.client.ValueFactory.value; - - import java.util.List; - import java.util.Map; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .setPayloadAsync( - "{collection_name}", - Map.of("property1", value("string"), "property2", value("string")), - List.of(id(0), id(3), id(10)), - true, - null, - null) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; + client = QdrantClient(url="http://localhost:6333") - var client = new QdrantClient("localhost", 6334); - await client.SetPayloadAsync( - collectionName: "{collection_name}", - payload: new Dictionary { { "property1", "string" }, { "property2", "string" } }, - ids: new ulong[] { 0, 3, 10 } - ); + client.list_snapshots(collection_name="{collection_name}") - put: - x-fern-examples: +' + language: python - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.listSnapshotAsync(\"{collection_name}\").get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - client.overwrite_payload( - collection_name="{collection_name}", - payload={ - "property1": "string", - "property2": "string", - }, - points=[0, 3, 10], - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; const client = new QdrantClient({ host: "localhost", port: 6333 }); - client.overwritePayload("{collection_name}", { - payload: { - property1: "string", - property2: "string", - }, - points: [0, 3, 10], - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::{ - points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector, - }}; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; - - client - .overwrite_payload_blocking( - "{collection_name}", - None, - &PointsSelector { - points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList { - ids: vec![0.into(), 3.into(), 10.into()], - })), - }, - json!({ - "property1": "string", - "property2": "string", - }) - .try_into() - .unwrap(), - None, - ) - .await?; - - language: java - code: | - import java.util.List; - - import static io.qdrant.client.PointIdFactory.id; - import static io.qdrant.client.ValueFactory.value; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .overwritePayloadAsync( - "{collection_name}", - Map.of("property1", value("string"), "property2", value("string")), - List.of(id(0), id(3), id(10)), - true, - null, - null) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; - var client = new QdrantClient("localhost", 6334); - - await client.OverwritePayloadAsync( - collectionName: "{collection_name}", - payload: new Dictionary { { "property1", "string" }, { "property2", "string" } }, - ids: new ulong[] { 0, 3, 10 } - ); + client.listSnapshots("{collection_name}"); - /collections/{collection_name}/points/payload/delete: - post: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") + - code: 'use qdrant_client::client::QdrantClient; - client.delete_payload( - collection_name="{collection_name}", - keys=["color", "price"], - points=[0, 3, 100], - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.deletePayload("{collection_name}", { - keys: ["color", "price"], - points: [0, 3, 100], - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::{ - points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector, - }}; let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .delete_payload_blocking( - "{collection_name}", - None, - &PointsSelector { - points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList { - ids: vec![0.into(), 3.into(), 100.into()], - })), - }, - vec!["color".to_string(), "price".to_string()], - None, - ) - .await?; - - language: java - code: | - import java.util.List; - - import static io.qdrant.client.PointIdFactory.id; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .deletePayloadAsync( - "{collection_name}", - List.of("color", "price"), - List.of(id(0), id(3), id(100)), - true, - null, - null) - .get(); - - language: csharp - code: | - using Qdrant.Client; - - var client = new QdrantClient("localhost", 6334); - await client.DeletePayloadAsync("{collection_name}", ["color", "price"], [0, 3, 10]); + client.list_snapshots("{collection_name}").await?; - /collections/{collection_name}/points/payload/clear: - post: - x-fern-examples: +' + language: rust - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") + - code: 'using Qdrant.Client; - client.clear_payload( - collection_name="{collection_name}", - points_selector=[0, 3, 100], - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.clearPayload("{collection_name}", { - points: [0, 3, 100], - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::{ - points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector, - }}; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; - - client - .clear_payload( - "{collection_name}", - None, - Some(PointsSelector { - points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList { - ids: vec![0.into(), 3.into(), 100.into()], - })), - }), - None, - ) - .await?; - - language: java - code: | - import java.util.List; - - import static io.qdrant.client.PointIdFactory.id; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.clearPayloadAsync("{collection_name}", List.of(id(0), id(3), id(100)), null, null, null) - .get(); - - language: csharp - code: | - using Qdrant.Client; var client = new QdrantClient("localhost", 6334); - await client.ClearPayloadAsync("{collection_name}", [0, 3, 10]); - /collections/{collection_name}/points/batch: + await client.ListSnapshotsAsync("{collection_name}"); + +' + language: csharp post: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models + - code: 'from qdrant_client import QdrantClient + client = QdrantClient(url="http://localhost:6333") - client.batch_update_points( - collection_name="{collection_name}", - update_operations=[ - models.UpsertOperation( - upsert=models.PointsList( - points=[ - models.PointStruct( - id=1, - vector=[1.0, 2.0, 3.0, 4.0], - payload={}, - ), - ] - ) - ), - models.UpdateVectorsOperation( - update_vectors=models.UpdateVectors( - points=[ - models.PointVectors( - id=1, - vector=[1.0, 2.0, 3.0, 4.0], - ) - ] - ) - ), - models.SetPayloadOperation( - set_payload=models.SetPayload( - payload={ - "test_payload_2": 2, - "test_payload_3": 3, - }, - points=[1], - ) - ), - ], - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - const client = new QdrantClient({ host: "localhost", port: 6333 }); + client.create_snapshot(collection_name="{collection_name}") - client.batchUpdate("{collection_name}", { - operations: [ - { - upsert: { - points: [ - { - id: 1, - vector: [1.0, 2.0, 3.0, 4.0], - payload: {}, - }, - ], - }, - }, - { - update_vectors: { - points: [ - { - id: 1, - vector: [1.0, 2.0, 3.0, 4.0], - }, - ], - }, - }, - { - set_payload: { - payload: { - test_payload_2: 2, - test_payload_3: 3, - }, - points: [1], - }, - }, - ], - }); - - language: rust - code: | - use qdrant_client::qdrant::{ - points_selector::PointsSelectorOneOf, - points_update_operation::{ - Operation, PointStructList, SetPayload, UpdateVectors, - }, - PointStruct, PointVectors, PointsIdsList, PointsSelector, PointsUpdateOperation, - }; +' + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.createSnapshotAsync(\"{collection_name}\").get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .batch_updates_blocking( - "{collection_name}", - &[ - PointsUpdateOperation { - operation: Some(Operation::Upsert(PointStructList { - points: vec![PointStruct::new( - 1, - vec![1.0, 2.0, 3.0, 4.0], - json!({}).try_into().unwrap(), - )], - ..Default::default() - })), - }, - PointsUpdateOperation { - operation: Some(Operation::UpdateVectors(UpdateVectors { - points: vec![PointVectors { - id: Some(1.into()), - vectors: Some(vec![1.0, 2.0, 3.0, 4.0].into()), - }], - ..Default::default() - })), - }, - PointsUpdateOperation { - operation: Some(Operation::OverwritePayload(SetPayload { - points_selector: Some(PointsSelector { - points_selector_one_of: Some(PointsSelectorOneOf::Points( - PointsIdsList { - ids: vec![1.into()], - }, - )), - }), - payload: HashMap::from([("test_payload".to_string(), 1.into())]), - ..Default::default() - })), - }, - ], - None, - ) - .await?; - - language: java - code: | - import java.util.List; - import java.util.Map; - - import static io.qdrant.client.PointIdFactory.id; - import static io.qdrant.client.ValueFactory.value; - import static io.qdrant.client.VectorsFactory.vectors; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.PointStruct; - import io.qdrant.client.grpc.Points.PointVectors; - import io.qdrant.client.grpc.Points.PointsIdsList; - import io.qdrant.client.grpc.Points.PointsSelector; - import io.qdrant.client.grpc.Points.PointsUpdateOperation; - import io.qdrant.client.grpc.Points.PointsUpdateOperation.PointStructList; - import io.qdrant.client.grpc.Points.PointsUpdateOperation.SetPayload; - import io.qdrant.client.grpc.Points.PointsUpdateOperation.UpdateVectors; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .batchUpdateAsync( - "{collection_name}", - List.of( - PointsUpdateOperation.newBuilder() - .setUpsert( - PointStructList.newBuilder() - .addPoints( - PointStruct.newBuilder() - .setId(id(1)) - .setVectors(vectors( - 1.0 f, - 2.0 f, - 3.0 f, - 4.0 f)) - .build()) - .build()) - .build(), - PointsUpdateOperation.newBuilder() - .setUpdateVectors( - UpdateVectors.newBuilder() - .addPoints( - PointVectors.newBuilder() - .setId(id(1)) - .setVectors(vectors( - 1.0 f, - 2.0 f, - 3.0 f, - 4.0 f)) - .build()) - .build()) - .build(), - PointsUpdateOperation.newBuilder() - .setSetPayload( - SetPayload.newBuilder() - .setPointsSelector( - PointsSelector.newBuilder() - .setPoints(PointsIdsList - .newBuilder() - .addIds(id(1)) - .build()) - .build()) - .putAllPayload( - Map.of("test_payload_2", - value(2), - "test_payload_3", - value(3))) - .build()) - .build())) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; + const client = new QdrantClient({ host: "localhost", port: 6333 }); - var client = new QdrantClient("localhost", 6334); - await client.UpdateBatchAsync( - "{collection_name}", - [ - new() - { - Upsert = new() - { - Points = - { - new PointStruct { Id = 1, Vectors = new[] { 0.9f, 0.1f, 0.1f } }, - } - } - }, - new() - { - UpdateVectors = new() - { - Points = - { - new PointVectors { Id = 1, Vectors = new[] { 0.9f, 0.1f, 0.1f } }, - } - } - }, - new() - { - SetPayload = new() - { - PointsSelector = new PointsSelector { Points = new PointsIdsList { Ids = { 1 } } }, - Payload = { ["test_payload_2"] = 2, ["test_payload_3"] = 3 } - } - } - ] - ); + client.createSnapshot("{collection_name}"); - /collections/{collection_name}/points/scroll: - post: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models - - client = QdrantClient(url="http://localhost:6333") + - code: 'use qdrant_client::client::QdrantClient; - client.scroll( - collection_name="{collection_name}", - scroll_filter=models.Filter( - must=[ - models.FieldCondition(key="color", match=models.MatchValue(value="red")), - ] - ), - limit=1, - with_payload=True, - with_vectors=False, - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.scroll("{collection_name}", { - filter: { - must: [ - { - key: "color", - match: { - value: "red", - }, - }, - ], - }, - limit: 1, - with_payload: true, - with_vector: false, - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::{Condition, Filter, ScrollPoints}}; let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .scroll(&ScrollPoints { - collection_name: "{collection_name}".to_string(), - filter: Some(Filter::must([Condition::matches( - "color", - "red".to_string(), - )])), - limit: Some(1), - with_payload: Some(true.into()), - with_vectors: Some(false.into()), - ..Default::default() - }) - .await?; - - language: java - code: | - import static io.qdrant.client.ConditionFactory.matchKeyword; - import static io.qdrant.client.WithPayloadSelectorFactory.enable; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.Filter; - import io.qdrant.client.grpc.Points.ScrollPoints; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .scrollAsync( - ScrollPoints.newBuilder() - .setCollectionName("{collection_name}") - .setFilter(Filter.newBuilder().addMust(matchKeyword("color", "red")).build()) - .setLimit(1) - .setWithPayload(enable(true)) - .build()) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using static Qdrant.Client.Grpc.Conditions; - - var client = new QdrantClient("localhost", 6334); - await client.ScrollAsync( - collectionName: "{collection_name}", - filter: MatchKeyword("color", "red"), - limit: 1, - payloadSelector: true - ); + client.create_snapshot("{collection_name}").await?; - /collections/{collection_name}/points/search: - post: - x-fern-examples: +' + language: rust - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models - - client = QdrantClient(url="http://localhost:6333") - - client.search( - collection_name="{collection_name}", - query_filter=models.Filter( - must=[ - models.FieldCondition( - key="city", - match=models.MatchValue( - value="London", - ), - ) - ] - ), - query_vector=[0.2, 0.1, 0.9, 0.7], - limit=3, - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; + - code: 'using Qdrant.Client; - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.search("{collection_name}", { - filter: { - must: [ - { - key: "city", - match: { - value: "London", - }, - }, - ], - }, - vector: [0.2, 0.1, 0.9, 0.7], - limit: 3, - }); - - language: rust - code: | - use qdrant_client::{ - client::QdrantClient, - qdrant::{Condition, Filter, SearchParams, SearchPoints}, - }; - let client = QdrantClient::from_url("http://localhost:6334").build()?; + var client = new QdrantClient("localhost", 6334); - client - .search_points(&SearchPoints { - collection_name: "{collection_name}".to_string(), - filter: Some(Filter::must([Condition::matches( - "city", - "London".to_string(), - )])), - params: Some(SearchParams { - hnsw_ef: Some(128), - exact: Some(false), - ..Default::default() - }), - vector: vec![0.2, 0.1, 0.9, 0.7], - limit: 3, - ..Default::default() - }) - .await?; - - language: java - code: | - import static io.qdrant.client.ConditionFactory.matchKeyword; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.Filter; - import io.qdrant.client.grpc.Points.SearchPoints; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .searchAsync( - SearchPoints.newBuilder() - .setCollectionName("{collection_name}") - .setFilter(Filter.newBuilder().addMust(matchKeyword("city", "London")).build()) - .addAllVector(List.of(0.2f, 0.1f, 0.9f, 0.7f)) - .setLimit(3) - .build()) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using static Qdrant.Client.Grpc.Conditions; - var client = new QdrantClient("localhost", 6334); + await client.CreateSnapshotAsync("{collection_name}"); - await client.SearchAsync( - collectionName: "{collection_name}", - vector: new float[] { 0.2f, 0.1f, 0.9f, 0.7f }, - filter: MatchKeyword("city", "London"), - limit: 3 - ); - - /collections/{collection_name}/points/search/batch: - post: +' + language: csharp + /collections/{collection_name}/snapshots/recover: + put: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models - - client = QdrantClient(url="http://localhost:6333") + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.recover_snapshot(\n \"{collection_name}\",\n \"http://example.com/path/to/snapshot.shapshot\",\n)\n" + language: python + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.recoverSnapshot(\"{collection_name}\", {\n location: \"http://example.com/path/to/snapshot.shapshot\",\n});\n" + language: typescript + /collections/{collection_name}/snapshots/{snapshot_name}: + delete: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.delete_snapshot(\n collection_name=\"{collection_name}\", snapshot_name=\"{snapshot_name}\"\n)\n" + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.deleteSnapshotAsync(\"{collection_name}\", \"{snapshot_name}\").get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - filter_ = models.Filter( - must=[ - models.FieldCondition( - key="city", - match=models.MatchValue( - value="London", - ), - ) - ] - ) - - search_queries = [ - models.SearchRequest(vector=[0.2, 0.1, 0.9, 0.7], filter=filter_, limit=3), - models.SearchRequest(vector=[0.5, 0.3, 0.2, 0.3], filter=filter_, limit=3), - ] - - client.search_batch(collection_name="{collection_name}", requests=search_queries) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; const client = new QdrantClient({ host: "localhost", port: 6333 }); - const filter = { - must: [ - { - key: "city", - match: { - value: "London", - }, - }, - ], - }; - - const searches = [ - { - vector: [0.2, 0.1, 0.9, 0.7], - filter, - limit: 3, - }, - { - vector: [0.5, 0.3, 0.2, 0.3], - filter, - limit: 3, - }, - ]; - - client.searchBatch("{collection_name}", { - searches, - }); - - language: rust - code: | - use qdrant_client::{ - client::QdrantClient, - qdrant::{Condition, Filter, SearchBatchPoints, SearchPoints}, - }; - let client = QdrantClient::from_url("http://localhost:6334").build()?; + client.deleteSnapshot("{collection_name}", "{snapshot_name}"); + +' + language: typescript + - code-samples: + - code: "use qdrant_client::client::QdrantClient;\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .delete_snapshot(\"{collection_name}\", \"{snapshot_name}\")\n .await?;\n" + language: rust + - code-samples: + - code: 'using Qdrant.Client; - let filter = Filter::must([Condition::matches("city", "London".to_string())]); - - let searches = vec![ - SearchPoints { - collection_name: "{collection_name}".to_string(), - vector: vec![0.2, 0.1, 0.9, 0.7], - filter: Some(filter.clone()), - limit: 3, - ..Default::default() - }, - SearchPoints { - collection_name: "{collection_name}".to_string(), - vector: vec![0.5, 0.3, 0.2, 0.3], - filter: Some(filter), - limit: 3, - ..Default::default() - }, - ]; - - client - .search_batch_points(&SearchBatchPoints { - collection_name: "{collection_name}".to_string(), - search_points: searches, - read_consistency: None, - ..Default::default() - }) - .await?; - - language: java - code: | - import java.util.List; - - import static io.qdrant.client.ConditionFactory.matchKeyword; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.Filter; - import io.qdrant.client.grpc.Points.SearchPoints; - - QdrantClient client = - new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - Filter filter = Filter.newBuilder().addMust(matchKeyword("city", "London")).build(); - List searches = - List.of( - SearchPoints.newBuilder() - .addAllVector(List.of(0.2f, 0.1f, 0.9f, 0.7f)) - .setFilter(filter) - .setLimit(3) - .build(), - SearchPoints.newBuilder() - .addAllVector(List.of(0.5f, 0.3f, 0.2f, 0.3f)) - .setFilter(filter) - .setLimit(3) - .build()); - client.searchBatchAsync("{collection_name}", searches, null).get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; - using static Qdrant.Client.Grpc.Conditions; var client = new QdrantClient("localhost", 6334); - var filter = MatchKeyword("city", "London"); - - var searches = new List - { - new() - { - Vector = { new float[] { 0.2f, 0.1f, 0.9f, 0.7f } }, - Filter = filter, - Limit = 3 - }, - new() - { - Vector = { new float[] { 0.5f, 0.3f, 0.2f, 0.3f } }, - Filter = filter, - Limit = 3 - } - }; - - await client.SearchBatchAsync(collectionName: "{collection_name}", searches: searches); - /collections/{collection_name}/points/search/groups: - post: + await client.DeleteSnapshotAsync("{collection_name}", "{snapshot_name}"); + +' + language: csharp + /snapshots: + get: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: 'from qdrant_client import QdrantClient + client = QdrantClient(url="http://localhost:6333") - client.search_groups( - collection_name="{collection_name}", - query_vector=[1.1], - group_by="document_id", - limit=4, - group_size=2, - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - const client = new QdrantClient({ host: "localhost", port: 6333 }); + client.list_full_snapshots() - client.searchPointGroups("{collection_name}", { - vector: [1.1], - group_by: "document_id", - limit: 4, - group_size: 2, - }); - - language: rust - code: | - use qdrant_client::{ - client::QdrantClient, - qdrant::SearchPointGroups, - }; +' + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.listFullSnapshotAsync().get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .search_groups(&SearchPointGroups { - collection_name: "{collection_name}".to_string(), - vector: vec![1.1], - group_by: "document_id".to_string(), - limit: 4, - group_size: 2, - ..Default::default() - }) - .await?; - - language: java - code: | - import java.util.List; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.SearchPointGroups; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .searchGroupsAsync( - SearchPointGroups.newBuilder() - .setCollectionName("{collection_name}") - .addAllVector(List.of(1.1f)) - .setGroupBy("document_id") - .setLimit(4) - .setGroupSize(2) - .build()) - .get(); - - language: csharp - code: | - using Qdrant.Client; + const client = new QdrantClient({ host: "localhost", port: 6333 }); - var client = new QdrantClient("localhost", 6334); - await client.SearchGroupsAsync( - collectionName: "{collection_name}", - vector: new float[] { 1.1f }, - groupBy: "document_id", - limit: 4, - groupSize: 2 - ); + client.listFullSnapshots(); - /collections/{collection_name}/points/recommend: - post: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models + - code: 'use qdrant_client::client::QdrantClient; - client = QdrantClient(url="http://localhost:6333") - client.recommend( - collection_name="{collection_name}", - positive=[100, 231], - negative=[718, [0.2, 0.3, 0.4, 0.5]], - strategy=models.RecommendStrategy.AVERAGE_VECTOR, - query_filter=models.Filter( - must=[ - models.FieldCondition( - key="city", - match=models.MatchValue( - value="London", - ), - ) - ] - ), - limit=3, - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; + let client = QdrantClient::from_url("http://localhost:6334").build()?; - const client = new QdrantClient({ host: "localhost", port: 6333 }); - client.recommend("{collection_name}", { - positive: [100, 231], - negative: [718, [0.2, 0.3, 0.4, 0.5]], - strategy: "average_vector", - filter: { - must: [ - { - key: "city", - match: { - value: "London", - }, - }, - ], - }, - limit: 3, - }); - - language: rust - code: | - use qdrant_client::{ - client::QdrantClient, - qdrant::{Condition, Filter, RecommendPoints, RecommendStrategy}, - }; + client.list_full_snapshots().await?; - let client = QdrantClient::from_url("http://localhost:6334").build()?; +' + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client - .recommend(&RecommendPoints { - collection_name: "{collection_name}".to_string(), - positive: vec![100.into(), 200.into()], - positive_vectors: vec![vec![100.0, 231.0].into()], - negative: vec![718.into()], - negative_vectors: vec![vec![0.2, 0.3, 0.4, 0.5].into()], - strategy: Some(RecommendStrategy::AverageVector.into()), - filter: Some(Filter::must([Condition::matches( - "city", - "London".to_string(), - )])), - limit: 3, - ..Default::default() - }) - .await?; - - language: java - code: | - import java.util.List; - - import static io.qdrant.client.ConditionFactory.matchKeyword; - import static io.qdrant.client.PointIdFactory.id; - import static io.qdrant.client.VectorFactory.vector; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.Filter; - import io.qdrant.client.grpc.Points.RecommendPoints; - import io.qdrant.client.grpc.Points.RecommendStrategy; - - QdrantClient client = - new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .recommendAsync( - RecommendPoints.newBuilder() - .setCollectionName("{collection_name}") - .addAllPositive(List.of(id(100), id(200))) - .addAllPositiveVectors(List.of(vector(100.0f, 231.0f))) - .addAllNegative(List.of(id(718))) - .addAllPositiveVectors(List.of(vector(0.2f, 0.3f, 0.4f, 0.5f))) - .setStrategy(RecommendStrategy.AverageVector) - .setFilter(Filter.newBuilder().addMust(matchKeyword("city", "London"))) - .setLimit(3) - .build()) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; - using static Qdrant.Client.Grpc.Conditions; var client = new QdrantClient("localhost", 6334); - await client.RecommendAsync( - "{collection_name}", - positive: new ulong[] { 100, 231 }, - negative: new ulong[] { 718 }, - filter: MatchKeyword("city", "London"), - limit: 3 - ); - /collections/{collection_name}/points/recommend/batch: + await client.ListFullSnapshotsAsync(); + +' + language: csharp post: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models + - code: 'from qdrant_client import QdrantClient - client = QdrantClient(url="http://localhost:6333") - recommend_queries = [ - models.RecommendRequest( - positive=[100, 231], negative=[718], filter=filter_, limit=3 - ), - models.RecommendRequest(positive=[200, 67], negative=[300], limit=3), - ] + client = QdrantClient(url="http://localhost:6333") - client.recommend_batch(collection_name="{collection_name}", requests=recommend_queries) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - const client = new QdrantClient({ host: "localhost", port: 6333 }); + client.create_full_snapshot() - const searches = [ - { - positive: [100, 231], - negative: [718], - limit: 3, - }, - { - positive: [200, 67], - negative: [300], - limit: 3, - }, - ]; - - client.recommend_batch("{collection_name}", { - searches, - }); - - language: rust - code: | - use qdrant_client::{ - client::QdrantClient, - qdrant::{Condition, Filter, RecommendBatchPoints, RecommendPoints}, - }; +' + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.createFullSnapshotAsync().get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - let client = QdrantClient::from_url("http://localhost:6334").build()?; - let filter = Filter::must([Condition::matches("city", "London".to_string())]); - - let recommend_queries = vec![ - RecommendPoints { - collection_name: "{collection_name}".to_string(), - positive: vec![100.into(), 231.into()], - negative: vec![718.into()], - filter: Some(filter.clone()), - limit: 3, - ..Default::default() - }, - RecommendPoints { - collection_name: "{collection_name}".to_string(), - positive: vec![200.into(), 67.into()], - negative: vec![300.into()], - filter: Some(filter), - limit: 3, - ..Default::default() - }, - ]; - - client - .recommend_batch(&RecommendBatchPoints { - collection_name: "{collection_name}".to_string(), - recommend_points: recommend_queries, - ..Default::default() - }) - .await?; - - language: java - code: | - import java.util.List; - - import static io.qdrant.client.ConditionFactory.matchKeyword; - import static io.qdrant.client.PointIdFactory.id; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.Filter; - import io.qdrant.client.grpc.Points.RecommendPoints; - - QdrantClient client = - new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - Filter filter = Filter.newBuilder().addMust(matchKeyword("city", "London")).build(); - - List recommendQueries = - List.of( - RecommendPoints.newBuilder() - .addAllPositive(List.of(id(100), id(231))) - .addAllNegative(List.of(id(718))) - .setFilter(filter) - .setLimit(3) - .build(), - RecommendPoints.newBuilder() - .addAllPositive(List.of(id(200), id(67))) - .addAllNegative(List.of(id(300))) - .setFilter(filter) - .setLimit(3) - .build()); - - client.recommendBatchAsync("{collection_name}", recommendQueries, null).get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; - using static Qdrant.Client.Grpc.Conditions; + const client = new QdrantClient({ host: "localhost", port: 6333 }); - var client = new QdrantClient("localhost", 6334); - var filter = MatchKeyword("city", "london"); - - await client.RecommendBatchAsync( - collectionName: "{collection_name}", - recommendSearches: - [ - new() - { - CollectionName = "{collection_name}", - Positive = { new PointId[] { 100, 231 } }, - Negative = { new PointId[] { 718 } }, - Limit = 3, - Filter = filter, - }, - new() - { - CollectionName = "{collection_name}", - Positive = { new PointId[] { 200, 67 } }, - Negative = { new PointId[] { 300 } }, - Limit = 3, - Filter = filter, - } - ] - ); + client.createFullSnapshot(); - /collections/{collection_name}/points/recommend/groups: - post: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models + - code: 'use qdrant_client::client::QdrantClient; - client = QdrantClient(url="http://localhost:6333") - client.recommend_groups( - collection_name="{collection_name}", - positive=[100, 231], - negative=[718], - group_by="document_id", - limit=3, - group_size=2, - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; + let client = QdrantClient::from_url("http://localhost:6334").build()?; - const client = new QdrantClient({ host: "localhost", port: 6333 }); - client.recommendPointGroups("{collection_name}", { - positive: [100, 231], - negative: [718], - group_by: "document_id", - limit: 3, - group_size: 2, - }); - - language: rust - code: | - use qdrant_client::{ - client::QdrantClient, - qdrant::{RecommendPointGroups, RecommendStrategy}, - }; + client.create_full_snapshot().await?; - let client = QdrantClient::from_url("http://localhost:6334").build()?; +' + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client - .recommend_groups(&RecommendPointGroups { - collection_name: "{collection_name}".to_string(), - group_by: "document_id".to_string(), - group_size: 2, - positive: vec![100.into(), 200.into()], - negative: vec![718.into()], - strategy: Some(RecommendStrategy::AverageVector.into()), - limit: 3, - ..Default::default() - }) - .await?; - - language: java - code: | - import static io.qdrant.client.PointIdFactory.id; - - import java.util.List; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.RecommendPointGroups; - import io.qdrant.client.grpc.Points.RecommendStrategy; - - QdrantClient client = - new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.recommendGroupsAsync(RecommendPointGroups.newBuilder() - .setCollectionName("{collection_name}") - .setGroupBy("document_id") - .setGroupSize(2) - .addAllPositive(List.of(id(100), id(200))) - .addAllNegative(List.of(id(718))) - .setStrategy(RecommendStrategy.AverageVector) - .setLimit(3) - .build()); - - language: csharp - code: | - using Qdrant.Client; - using static Qdrant.Client.Grpc.Conditions; var client = new QdrantClient("localhost", 6334); - await client.RecommendGroupsAsync( - "{collection_name}", - "document_id", - groupSize: 3, - positive: new ulong[] { 100, 231 }, - negative: new ulong[] { 718 }, - filter: MatchKeyword("city", "London"), - limit: 3 - ); - /collections/{collection_name}/points/discover: - post: + await client.CreateFullSnapshotAsync(); + +' + language: csharp + /snapshots/{snapshot_name}: + delete: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models + - code: 'from qdrant_client import QdrantClient + client = QdrantClient(url="http://localhost:6333") - client.discover( - "{collection_name}", - target=[0.2, 0.1, 0.9, 0.7], - context=[ - models.ContextExamplePair(positive=100, negative=718), - models.ContextExamplePair(positive=200, negative=300), - ], - limit=10, - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - const client = new QdrantClient({ host: "localhost", port: 6333 }); + client.delete_full_snapshot(snapshot_name="{snapshot_name}") - client.discover("{collection_name}", { - target: [0.2, 0.1, 0.9, 0.7], - context: [ - { - positive: 100, - negative: 718, - }, - { - positive: 200, - negative: 300, - }, - ], - limit: 10, - }); - - language: rust - code: | - use qdrant_client::{ - client::QdrantClient, - qdrant::{ - target_vector::Target, vector_example::Example, ContextExamplePair, DiscoverPoints, - TargetVector, VectorExample, - }, - }; +' + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.deleteFullSnapshotAsync(\"{snapshot_name}\").get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .discover(&DiscoverPoints { - collection_name: "{collection_name}".to_string(), - target: Some(TargetVector { - target: Some(Target::Single(VectorExample { - example: Some(Example::Vector(vec![0.2, 0.1, 0.9, 0.7].into())), - })), - }), - context: vec![ - ContextExamplePair { - positive: Some(VectorExample { - example: Some(Example::Id(100.into())), - }), - negative: Some(VectorExample { - example: Some(Example::Id(718.into())), - }), - }, - ContextExamplePair { - positive: Some(VectorExample { - example: Some(Example::Id(200.into())), - }), - negative: Some(VectorExample { - example: Some(Example::Id(300.into())), - }), - }, - ], - limit: 10, - ..Default::default() - }) - .await?; - - language: java - code: | - import java.util.List; - - import static io.qdrant.client.PointIdFactory.id; - import static io.qdrant.client.VectorFactory.vector; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.ContextExamplePair; - import io.qdrant.client.grpc.Points.DiscoverPoints; - import io.qdrant.client.grpc.Points.TargetVector; - import io.qdrant.client.grpc.Points.VectorExample; - - QdrantClient client = - new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .discoverAsync( - DiscoverPoints.newBuilder() - .setCollectionName("{collection_name}") - .setTarget( - TargetVector.newBuilder() - .setSingle( - VectorExample.newBuilder() - .setVector(vector(0.2f, 0.1f, 0.9f, 0.7f)) - .build())) - .addAllContext( - List.of( - ContextExamplePair.newBuilder() - .setPositive(VectorExample.newBuilder().setId(id(100))) - .setNegative(VectorExample.newBuilder().setId(id(718))) - .build(), - ContextExamplePair.newBuilder() - .setPositive(VectorExample.newBuilder().setId(id(200))) - .setNegative(VectorExample.newBuilder().setId(id(300))) - .build())) - .setLimit(10) - .build()) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; + const client = new QdrantClient({ host: "localhost", port: 6333 }); - var client = new QdrantClient("localhost", 6334); - await client.DiscoverAsync( - collectionName: "{collection_name}", - target: new TargetVector - { - Single = new VectorExample { Vector = new float[] { 0.2f, 0.1f, 0.9f, 0.7f }, } - }, - context: - [ - new() - { - Positive = new VectorExample { Id = 100 }, - Negative = new VectorExample { Id = 718 } - }, - new() - { - Positive = new VectorExample { Id = 200 }, - Negative = new VectorExample { Id = 300 } - } - ], - limit: 10 - ); + client.deleteFullSnapshot("{snapshot_name}"); - /collections/{collection_name}/points/discover/batch: - post: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models - - client = QdrantClient(url="http://localhost:6333") - - discover_queries = [ - models.DiscoverRequest( - target=[0.2, 0.1, 0.9, 0.7], - context=[ - models.ContextExamplePair( - positive=100, - negative=718, - ), - models.ContextExamplePair( - positive=200, - negative=300, - ), - ], - limit=10, - ), - models.DiscoverRequest( - target=[0.5, 0.3, 0.2, 0.3], - context=[ - models.ContextExamplePair( - positive=342, - negative=213, - ), - models.ContextExamplePair( - positive=100, - negative=200, - ), - ], - limit=5, - ), - ] - - client.discover_batch("{collection_name}", discover_queries) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); + - code: 'use qdrant_client::client::QdrantClient; - const searches = [ - { - target: [0.2, 0.1, 0.9, 0.7], - context: [ - { - positive: 100, - negative: 718, - }, - { - positive: 200, - negative: 300, - }, - ], - limit: 10, - }, - { - target: [0.5, 0.3, 0.2, 0.3], - context: [ - { - positive: 342, - negative: 213, - }, - { - positive: 100, - negative: 200, - }, - ], - limit: 5, - }, - ]; - - client.discoverBatchPoints("{collection_name}", { - searches, - }); - - language: rust - code: | - use qdrant_client::{ - client::QdrantClient, - qdrant::{ - target_vector::Target, vector_example::Example, ContextExamplePair, DiscoverBatchPoints, - DiscoverPoints, TargetVector, VectorExample, - }, - }; let client = QdrantClient::from_url("http://localhost:6334").build()?; - let discover_points = &DiscoverBatchPoints { - collection_name: "{collection_name}".to_string(), - discover_points: vec![ - DiscoverPoints { - collection_name: "{collection_name}".to_string(), - target: Some(TargetVector { - target: Some(Target::Single(VectorExample { - example: Some(Example::Vector(vec![0.2, 0.1, 0.9, 0.7].into())), - })), - }), - context: vec![ - ContextExamplePair { - positive: Some(VectorExample { - example: Some(Example::Id(100.into())), - }), - negative: Some(VectorExample { - example: Some(Example::Id(718.into())), - }), - }, - ContextExamplePair { - positive: Some(VectorExample { - example: Some(Example::Id(200.into())), - }), - negative: Some(VectorExample { - example: Some(Example::Id(300.into())), - }), - }, - ], - limit: 10, - ..Default::default() - }, - DiscoverPoints { - collection_name: "{collection_name}".to_string(), - target: Some(TargetVector { - target: Some(Target::Single(VectorExample { - example: Some(Example::Vector(vec![0.5, 0.3, 0.2, 0.3].into())), - })), - }), - context: vec![ - ContextExamplePair { - positive: Some(VectorExample { - example: Some(Example::Id(342.into())), - }), - negative: Some(VectorExample { - example: Some(Example::Id(213.into())), - }), - }, - ContextExamplePair { - positive: Some(VectorExample { - example: Some(Example::Id(100.into())), - }), - negative: Some(VectorExample { - example: Some(Example::Id(200.into())), - }), - }, - ], - limit: 10, - ..Default::default() - }, - ], - ..Default::default() - }; - - client.discover_batch(discover_points).await?; - - language: java - code: | - import static io.qdrant.client.PointIdFactory.id; - import static io.qdrant.client.VectorFactory.vector; - - import java.util.Arrays; - import java.util.List; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.ContextExamplePair; - import io.qdrant.client.grpc.Points.DiscoverPoints; - import io.qdrant.client.grpc.Points.TargetVector; - import io.qdrant.client.grpc.Points.VectorExample; - - QdrantClient client = new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - List discoverPoints = Arrays.asList( - DiscoverPoints.newBuilder() - .setCollectionName("{collection_name}") - .setTarget( - TargetVector.newBuilder() - .setSingle( - VectorExample.newBuilder() - .setVector(vector( - 0.2 f, - 0.1 f, - 0.9 f, - 0.7 f)) - .build())) - .addAllContext( - List.of( - ContextExamplePair.newBuilder() - .setPositive(VectorExample - .newBuilder() - .setId(id(100))) - .setNegative(VectorExample - .newBuilder() - .setId(id(718))) - .build(), - ContextExamplePair.newBuilder() - .setPositive(VectorExample - .newBuilder() - .setId(id(200))) - .setNegative(VectorExample - .newBuilder() - .setId(id(300))) - .build())) - .setLimit(10) - .build(), - DiscoverPoints.newBuilder() - .setCollectionName("{collection_name}") - .setTarget( - TargetVector.newBuilder() - .setSingle( - VectorExample.newBuilder() - .setVector(vector( - 0.5 f, 0.3 f, 0.2 f, 0.3 f)) - .build())) - .addAllContext( - List.of( - ContextExamplePair.newBuilder() - .setPositive(VectorExample - .newBuilder() - .setId(id(342))) - .setNegative(VectorExample - .newBuilder() - .setId(id(213))) - .build(), - ContextExamplePair.newBuilder() - .setPositive(VectorExample - .newBuilder() - .setId(id(100))) - .setNegative(VectorExample - .newBuilder() - .setId(id(200))) - .build())) - .setLimit(10) - .build()); - client.discoverBatchAsync("{collection_name}", discoverPoints, null); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; - - var client = new QdrantClient("localhost", 6334); - var discoverPoints = new List - { - new DiscoverPoints - { - CollectionName = "{collection_name}", - Target = new TargetVector - { - Single = new VectorExample { Vector = new float[] { 0.2f, 0.1f, 0.9f, 0.7f }, } - }, - Context = - { - new ContextExamplePair() - { - Positive = new VectorExample { Id = 100 }, - Negative = new VectorExample { Id = 718 } - }, - new ContextExamplePair() - { - Positive = new VectorExample { Id = 200 }, - Negative = new VectorExample { Id = 300 } - } - }, - Limit = 10 - }, - new DiscoverPoints - { - CollectionName = "{collection_name}", - Target = new TargetVector - { - Single = new VectorExample { Vector = new float[] { 0.5f, 0.3f, 0.2f, 0.3f }, } - }, - Context = - { - new ContextExamplePair() - { - Positive = new VectorExample { Id = 342 }, - Negative = new VectorExample { Id = 213 } - }, - new ContextExamplePair() - { - Positive = new VectorExample { Id = 100 }, - Negative = new VectorExample { Id = 200 } - } - }, - Limit = 10 - } - }; - await client.DiscoverBatchAsync("{collection_name}", discoverPoints); + client.delete_full_snapshot("{snapshot_name}").await?; - /collections/{collection_name}/points/count: - post: - x-fern-examples: +' + language: rust - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.count( - collection_name="{collection_name}", - count_filter=models.Filter( - must=[ - models.FieldCondition(key="color", match=models.MatchValue(value="red")), - ] - ), - exact=True, - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); + - code: 'using Qdrant.Client; - client.count("{collection_name}", { - filter: { - must: [ - { - key: "color", - match: { - value: "red", - }, - }, - ], - }, - exact: true, - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::{Condition, CountPoints, Filter}}; - let client = QdrantClient::from_url("http://localhost:6334").build()?; + var client = new QdrantClient("localhost", 6334); - client - .count(&CountPoints { - collection_name: "{collection_name}".to_string(), - filter: Some(Filter::must([Condition::matches( - "color", - "red".to_string(), - )])), - exact: Some(true), - ..Default::default() - }) - .await?; - - language: java - code: | - import static io.qdrant.client.ConditionFactory.matchKeyword; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.Filter; - - QdrantClient client = new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .countAsync( - "{collection_name}", - Filter.newBuilder().addMust(matchKeyword("color", "red")).build(), - true) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using static Qdrant.Client.Grpc.Conditions; - var client = new QdrantClient("localhost", 6334); + await client.DeleteFullSnapshotAsync("{snapshot_name}"); - await client.CountAsync( - collectionName: "{collection_name}", - filter: MatchKeyword("color", "red"), - exact: true - ); +' + language: csharp diff --git a/fern/apis/v1.9.x/openapi-overrides.yml b/fern/apis/v1.9.x/openapi-overrides.yml index aca61dd..46ed42e 100644 --- a/fern/apis/v1.9.x/openapi-overrides.yml +++ b/fern/apis/v1.9.x/openapi-overrides.yml @@ -1,3424 +1,1117 @@ +# +# WARNING: This file is auto-generated. Do not edit this file directly. +# components: securitySchemes: BearerAuth: type: http scheme: bearer paths: - /collections/{collection_name}/shards: - put: + /aliases: + get: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.create_shard_key("{collection_name}", "{shard_key}") - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ - host: "localhost", - port: 6333 - }); - - client.createShardKey("{collection_name}", { - shard_key: "{shard_key}" - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::shard_key::Key}; + - code: 'from qdrant_client import QdrantClient - let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .create_shard_key( - "{collection_name}", - &Key::Keyword("{shard_key".to_string()), - None, - None, - &[], - ) - .await?; - - language: java - code: | - import static io.qdrant.client.ShardKeyFactory.shardKey; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Collections.CreateShardKey; - import io.qdrant.client.grpc.Collections.CreateShardKeyRequest; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.createShardKeyAsync(CreateShardKeyRequest.newBuilder() - .setCollectionName("{collection_name}") - .setRequest(CreateShardKey.newBuilder() - .setShardKey(shardKey("{shard_key}")) - .build()) - .build()).get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; + client = QdrantClient(url="http://localhost:6333") - var client = new QdrantClient("localhost", 6334); - await client.CreateShardKeyAsync( - "{collection_name}", - new CreateShardKey { ShardKey = new ShardKey { Keyword = "{shard_key}", } } - ); + client.get_aliases() - /collections/{collection_name}/shards/delete: - post: - x-fern-examples: +' + language: python - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.delete_shard_key("{collection_name}", "{shard_key}") - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ - host: "localhost", - port: 6333 - }); - - client.deleteShardKey("{collection_name}", { - shard_key: "{shard_key}" - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::shard_key::Key}; + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.listAliasesAsync().get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .delete_shard_key("{collection_name}", &Key::Keyword("{shard_key".to_string())) - .await?; - - language: java - code: | - import static io.qdrant.client.ShardKeyFactory.shardKey; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Collections.DeleteShardKey; - import io.qdrant.client.grpc.Collections.DeleteShardKeyRequest; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.deleteShardKeyAsync(DeleteShardKeyRequest.newBuilder() - .setCollectionName("{collection_name}") - .setRequest(DeleteShardKey.newBuilder() - .setShardKey(shardKey("{shard_key}")) - .build()) - .build()).get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; + const client = new QdrantClient({ host: "localhost", port: 6333 }); - var client = new QdrantClient("localhost", 6334); - await client.DeleteShardKeyAsync( - "{collection_name}", - new DeleteShardKey { ShardKey = new ShardKey { Keyword = "shard_key", } } - ); + client.getAliases(); - /collections: - get: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: 'use qdrant_client::client::QdrantClient; - client = QdrantClient(url="http://localhost:6333") - - client.get_collections() - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.getCollections(); - - language: rust - code: | - use qdrant_client::client::QdrantClient; let client = QdrantClient::from_url("http://localhost:6334").build()?; - client.list_collections().await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + client.list_aliases().await?; + +' + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client.listCollectionsAsync().get(); - - language: csharp - code: | - using Qdrant.Client; var client = new QdrantClient("localhost", 6334); - await client.ListCollectionsAsync(); - /collections/{collection_name}: + await client.ListAliasesAsync(); + +' + language: csharp + /collections: get: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.get_collection("{collection_name}") - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.getCollection("{collection_name}"); - - language: rust - code: | - use qdrant_client::client::QdrantClient; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; - - client.collection_info("{collection_name}").await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; + - code: 'from qdrant_client import QdrantClient - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - client.getCollectionInfoAsync("{collection_name}").get(); - - language: csharp - code: | - using Qdrant.Client; + client = QdrantClient(url="http://localhost:6333") - var client = new QdrantClient("localhost", 6334); - await client.GetCollectionInfoAsync("{collection_name}"); + client.get_collections() - put: - x-fern-examples: +' + language: python - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models - - client = QdrantClient(url="http://localhost:6333") + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.listCollectionsAsync().get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - client.create_collection( - collection_name="{collection_name}", - vectors_config=models.VectorParams(size=100, distance=models.Distance.COSINE), - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; const client = new QdrantClient({ host: "localhost", port: 6333 }); - client.createCollection("{collection_name}", { - vectors: { size: 100, distance: "Cosine" }, - }); - - language: rust - code: | - use qdrant_client::{ - client::QdrantClient, - qdrant::{vectors_config::Config, CreateCollection, Distance, VectorParams, VectorsConfig}, - }; - let client = QdrantClient::from_url("http://localhost:6334").build()?; + client.getCollections(); - client - .create_collection(&CreateCollection { - collection_name: "{collection_name}".to_string(), - vectors_config: Some(VectorsConfig { - config: Some(Config::Params(VectorParams { - size: 100, - distance: Distance::Cosine.into(), - ..Default::default() - })), - }), - ..Default::default() - }) - .await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Collections.Distance; - import io.qdrant.client.grpc.Collections.VectorParams; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.createCollectionAsync("{collection_name}", - VectorParams.newBuilder().setDistance(Distance.Cosine).setSize(100).build()).get(); - - language: csharp - code: | - patch: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: 'use qdrant_client::client::QdrantClient; - client = QdrantClient(url="http://localhost:6333") - - client.update_collection( - collection_name="{collection_name}", - optimizer_config=models.OptimizersConfigDiff(indexing_threshold=10000), - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.updateCollection("{collection_name}", { - optimizers_config: { - indexing_threshold: 10000, - }, - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::OptimizersConfigDiff}; let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .update_collection( - "{collection_name}", - Some(&OptimizersConfigDiff { - indexing_threshold: Some(10000), - ..Default::default() - }), - None, - None, - None, - None, - None, - ) - .await?; - - language: java - code: | - import static io.qdrant.client.ShardKeyFactory.shardKey; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Collections.OptimizersConfigDiff; - import io.qdrant.client.grpc.Collections.UpdateCollection; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.updateCollectionAsync( - UpdateCollection.newBuilder() - .setCollectionName("{collection_name}") - .setOptimizersConfig( - OptimizersConfigDiff.newBuilder().setIndexingThreshold(10000).build()) - .build()); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; - var client = new QdrantClient("localhost", 6334); + client.list_collections().await?; - await client.UpdateCollectionAsync( - collectionName: "{collection_name}", - optimizersConfig: new OptimizersConfigDiff { IndexingThreshold = 10000 } - ); - delete: - x-fern-examples: +' + language: rust - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.delete_collection(collection_name="{collection_name}") - - language: typescript - code: | - import { QdrantClient } from '@qdrant/qdrant-js'; - - const client = new QdrantClient({url: 'http://127.0.0.1:6333'}); + - code: 'using Qdrant.Client; - client.deleteCollection("{collection_name}"); - - language: rust - code: | - use qdrant_client::client::QdrantClient; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; - - client.delete_collection("{collection_name}").await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = - new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.deleteCollectionAsync("{collection_name}").get(); - - language: csharp - code: | - using Qdrant.Client; var client = new QdrantClient("localhost", 6334); - await client.DeleteCollectionAsync("{collection_name}"); + await client.ListCollectionsAsync(); + +' + language: csharp /collections/aliases: post: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.update_collection_aliases( - change_aliases_operations=[ - models.CreateAliasOperation( - create_alias=models.CreateAlias( - collection_name="example_collection", alias_name="production_collection" - ) - ) - ] - ) - - client.update_collection_aliases( - change_aliases_operations=[ - models.DeleteAliasOperation( - delete_alias=models.DeleteAlias(alias_name="production_collection") - ), - ] - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.update_collection_aliases(\n change_aliases_operations=[\n models.CreateAliasOperation(\n create_alias=models.CreateAlias(\n collection_name=\"example_collection\", alias_name=\"production_collection\"\n )\n )\n ]\n)\n\nclient.update_collection_aliases(\n change_aliases_operations=[\n models.DeleteAliasOperation(\n delete_alias=models.DeleteAlias(alias_name=\"production_collection\")\n ),\n ]\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.ShardKeyFactory.shardKey;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Collections.DeleteShardKey;\nimport io.qdrant.client.grpc.Collections.DeleteShardKeyRequest;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.createAliasAsync(\"production_collection\", \"example_collection\").get();\n\nclient.deleteAliasAsync(\"production_collection\").get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.updateCollectionAliases({\n actions: [\n {\n create_alias: {\n collection_name: \"example_collection\",\n alias_name: \"production_collection\",\n },\n },\n ],\n});\n\nclient.updateCollectionAliases({\n actions: [\n {\n delete_alias: {\n alias_name: \"production_collection\",\n },\n },\n ],\n});\n" + language: typescript + - code-samples: + - code: 'use qdrant_client::client::QdrantClient; - client.updateCollectionAliases({ - actions: [ - { - create_alias: { - collection_name: "example_collection", - alias_name: "production_collection", - }, - }, - ], - }); - - client.updateCollectionAliases({ - actions: [ - { - delete_alias: { - alias_name: "production_collection", - }, - }, - ], - }); - - language: rust - code: | - use qdrant_client::client::QdrantClient; let client = QdrantClient::from_url("http://localhost:6334").build()?; - client.create_alias("example_collection", "production_collection").await?; - - client.delete_alias("production_collection").await?; - - language: java - code: | - import static io.qdrant.client.ShardKeyFactory.shardKey; - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; + client.create_alias("example_collection", "production_collection").await?; - import io.qdrant.client.grpc.Collections.DeleteShardKey; - import io.qdrant.client.grpc.Collections.DeleteShardKeyRequest; - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + client.delete_alias("production_collection").await?; - client.createAliasAsync("production_collection", "example_collection").get(); +' + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client.deleteAliasAsync("production_collection").get(); - - language: csharp - code: | - using Qdrant.Client; var client = new QdrantClient("localhost", 6334); + await client.CreateAliasAsync(aliasName: "production_collection", collectionName: "example_collection"); + await client.DeleteAliasAsync("production_collection"); - /collections/{collection_name}/index: - put: +' + language: csharp + /collections/{collection_name}: + delete: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: 'from qdrant_client import QdrantClient + client = QdrantClient(url="http://localhost:6333") - client.create_payload_index( - collection_name="{collection_name}", - field_name="name_of_the_field_to_index", - field_schema="keyword", - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - const client = new QdrantClient({ host: "localhost", port: 6333 }); + client.delete_collection(collection_name="{collection_name}") - client.createPayloadIndex("{collection_name}", { - field_name: "{field_name}", - field_schema: "keyword", - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::FieldType}; +' + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client =\n new QdrantClient(QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.deleteCollectionAsync(\"{collection_name}\").get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from ''@qdrant/qdrant-js''; - let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .create_field_index( - "{collection_name}", - "{field_name}", - FieldType::Keyword, - None, - None, - ) - .await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Collections.PayloadSchemaType; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.createPayloadIndexAsync( - "{collection_name}", - "{field_name}", - PayloadSchemaType.Keyword, - null, - true, - null, - null); - - language: csharp - code: | - using Qdrant.Client; + const client = new QdrantClient({url: ''http://127.0.0.1:6333''}); - var client = new QdrantClient("localhost", 6334); - await client.CreatePayloadIndexAsync( - collectionName: "{collection_name}", - fieldName: "name_of_the_field_to_index" - ); + client.deleteCollection("{collection_name}"); - /collections/{collection_name}/index/{field_name}: - delete: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: 'use qdrant_client::client::QdrantClient; - client = QdrantClient(url="http://localhost:6333") - - client.delete_payload_index("{collection_name}", "{field_name}"); - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.deletePayloadIndex("{collection_name}", "{field_name}"); - - language: rust - code: | - use qdrant_client::client::QdrantClient; let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .delete_field_index("{collection_name}", "{field_name}", None) - .await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + client.delete_collection("{collection_name}").await?; + +' + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client.deletePayloadIndexAsync("{collection_name}", "{field_name}", true, null, null).get(); - - language: csharp - code: | - using Qdrant.Client; var client = new QdrantClient("localhost", 6334); - await client.DeletePayloadIndexAsync( - collectionName: "{collection_name}", - fieldName: "name_of_the_field_to_index" - ); - /collections/{collection_name}/aliases: + await client.DeleteCollectionAsync("{collection_name}"); + +' + language: csharp get: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: 'from qdrant_client import QdrantClient - client = QdrantClient(url="http://localhost:6333") - client.get_collection_aliases("{collection_name}") - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; + client = QdrantClient(url="http://localhost:6333") - const client = new QdrantClient({ host: "localhost", port: 6333 }); - client.getCollectionAliases("{collection_name}"); - - language: rust - code: | - use qdrant_client::client::QdrantClient; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; + client.get_collection("{collection_name}") - client.list_collection_aliases("{collection_name}").await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; +' + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.getCollectionInfoAsync(\"{collection_name}\").get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - client.listCollectionAliasesAsync("{collection_name}").get(); - - language: csharp - code: | - using Qdrant.Client; + const client = new QdrantClient({ host: "localhost", port: 6333 }); - var client = new QdrantClient("localhost", 6334); - await client.ListCollectionAliasesAsync("{collection_name}"); + client.getCollection("{collection_name}"); - /aliases: - get: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: 'use qdrant_client::client::QdrantClient; - client = QdrantClient(url="http://localhost:6333") - - client.get_aliases() - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.getAliases(); - - language: rust - code: | - use qdrant_client::client::QdrantClient; let client = QdrantClient::from_url("http://localhost:6334").build()?; - client.list_aliases().await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + client.collection_info("{collection_name}").await?; + +' + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client.listAliasesAsync().get(); - - language: csharp - code: | - using Qdrant.Client; var client = new QdrantClient("localhost", 6334); - await client.ListAliasesAsync(); - /collections/{collection_name}/snapshots/recover: + await client.GetCollectionInfoAsync("{collection_name}"); + +' + language: csharp + patch: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.update_collection(\n collection_name=\"{collection_name}\",\n optimizer_config=models.OptimizersConfigDiff(indexing_threshold=10000),\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.ShardKeyFactory.shardKey;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Collections.OptimizersConfigDiff;\nimport io.qdrant.client.grpc.Collections.UpdateCollection;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.updateCollectionAsync(\n UpdateCollection.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .setOptimizersConfig(\n OptimizersConfigDiff.newBuilder().setIndexingThreshold(10000).build())\n .build());\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.updateCollection(\"{collection_name}\", {\n optimizers_config: {\n indexing_threshold: 10000,\n },\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::OptimizersConfigDiff};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .update_collection(\n \"{collection_name}\",\n Some(&OptimizersConfigDiff {\n indexing_threshold: Some(10000),\n ..Default::default()\n }),\n None,\n None,\n None,\n None,\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.UpdateCollectionAsync(\n collectionName: \"{collection_name}\",\n optimizersConfig: new OptimizersConfigDiff { IndexingThreshold = 10000 }\n);\n" + language: csharp put: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.recover_snapshot( - "{collection_name}", - "http://example.com/path/to/snapshot.shapshot", - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.recoverSnapshot("{collection_name}", { - location: "http://example.com/path/to/snapshot.shapshot", - }); - - /collections/{collection_name}/snapshots: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.create_collection(\n collection_name=\"{collection_name}\",\n vectors_config=models.VectorParams(size=100, distance=models.Distance.COSINE),\n)\n" + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Collections.Distance;\nimport io.qdrant.client.grpc.Collections.VectorParams;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.createCollectionAsync(\"{collection_name}\",\n VectorParams.newBuilder().setDistance(Distance.Cosine).setSize(100).build()).get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.createCollection(\"{collection_name}\", {\n vectors: { size: 100, distance: \"Cosine\" },\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{\n client::QdrantClient,\n qdrant::{vectors_config::Config, CreateCollection, Distance, VectorParams, VectorsConfig},\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .create_collection(&CreateCollection {\n collection_name: \"{collection_name}\".to_string(),\n vectors_config: Some(VectorsConfig {\n config: Some(Config::Params(VectorParams {\n size: 100,\n distance: Distance::Cosine.into(),\n ..Default::default()\n })),\n }),\n ..Default::default()\n })\n .await?;\n" + language: rust + /collections/{collection_name}/aliases: get: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: 'from qdrant_client import QdrantClient - client = QdrantClient(url="http://localhost:6333") - - client.list_snapshots(collection_name="{collection_name}") - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - const client = new QdrantClient({ host: "localhost", port: 6333 }); + client = QdrantClient(url="http://localhost:6333") - client.listSnapshots("{collection_name}"); - - language: rust - code: | - use qdrant_client::client::QdrantClient; - let client = QdrantClient::from_url("http://localhost:6334").build()?; + client.get_collection_aliases("{collection_name}") - client.list_snapshots("{collection_name}").await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; +' + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.listCollectionAliasesAsync(\"{collection_name}\").get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - client.listSnapshotAsync("{collection_name}").get(); - - language: csharp - code: | - using Qdrant.Client; + const client = new QdrantClient({ host: "localhost", port: 6333 }); - var client = new QdrantClient("localhost", 6334); - await client.ListSnapshotsAsync("{collection_name}"); + client.getCollectionAliases("{collection_name}"); - post: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: 'use qdrant_client::client::QdrantClient; - client = QdrantClient(url="http://localhost:6333") - - client.create_snapshot(collection_name="{collection_name}") - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.createSnapshot("{collection_name}"); - - language: rust - code: | - use qdrant_client::client::QdrantClient; let client = QdrantClient::from_url("http://localhost:6334").build()?; - client.create_snapshot("{collection_name}").await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + client.list_collection_aliases("{collection_name}").await?; + +' + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client.createSnapshotAsync("{collection_name}").get(); - - language: csharp - code: | - using Qdrant.Client; var client = new QdrantClient("localhost", 6334); - await client.CreateSnapshotAsync("{collection_name}"); - /collections/{collection_name}/snapshots/{snapshot_name}: + await client.ListCollectionAliasesAsync("{collection_name}"); + +' + language: csharp + /collections/{collection_name}/index: + put: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.create_payload_index(\n collection_name=\"{collection_name}\",\n field_name=\"name_of_the_field_to_index\",\n field_schema=\"keyword\",\n)\n" + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Collections.PayloadSchemaType;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.createPayloadIndexAsync(\n \"{collection_name}\",\n \"{field_name}\",\n PayloadSchemaType.Keyword,\n null,\n true,\n null,\n null);\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.createPayloadIndex(\"{collection_name}\", {\n field_name: \"{field_name}\",\n field_schema: \"keyword\",\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::FieldType};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n.create_field_index(\n \"{collection_name}\",\n \"{field_name}\",\n FieldType::Keyword,\n None,\n None,\n)\n.await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.CreatePayloadIndexAsync(\n collectionName: \"{collection_name}\",\n fieldName: \"name_of_the_field_to_index\"\n);\n" + language: csharp + /collections/{collection_name}/index/{field_name}: delete: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.delete_snapshot( - collection_name="{collection_name}", snapshot_name="{snapshot_name}" - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; + - code: 'from qdrant_client import QdrantClient - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.deleteSnapshot("{collection_name}", "{snapshot_name}"); - - language: rust - code: | - use qdrant_client::client::QdrantClient; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; - - client - .delete_snapshot("{collection_name}", "{snapshot_name}") - .await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - client.deleteSnapshotAsync("{collection_name}", "{snapshot_name}").get(); - - language: csharp - code: | - using Qdrant.Client; + client = QdrantClient(url="http://localhost:6333") - var client = new QdrantClient("localhost", 6334); - await client.DeleteSnapshotAsync("{collection_name}", "{snapshot_name}"); + client.delete_payload_index("{collection_name}", "{field_name}"); - /snapshots: - get: - x-fern-examples: +' + language: python - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.deletePayloadIndexAsync(\"{collection_name}\", \"{field_name}\", true, null, null).get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - client.list_full_snapshots() - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; const client = new QdrantClient({ host: "localhost", port: 6333 }); - client.listFullSnapshots(); - - language: rust - code: | - use qdrant_client::client::QdrantClient; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; - - client.list_full_snapshots().await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.listFullSnapshotAsync().get(); - - language: csharp - code: | - using Qdrant.Client; - var client = new QdrantClient("localhost", 6334); - - await client.ListFullSnapshotsAsync(); + client.deletePayloadIndex("{collection_name}", "{field_name}"); +' + language: typescript + - code-samples: + - code: "use qdrant_client::client::QdrantClient;\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .delete_field_index(\"{collection_name}\", \"{field_name}\", None)\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.DeletePayloadIndexAsync(\n collectionName: \"{collection_name}\",\n fieldName: \"name_of_the_field_to_index\"\n);\n" + language: csharp + /collections/{collection_name}/points: post: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.create_full_snapshot() - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.createFullSnapshot(); - - language: rust - code: | - use qdrant_client::client::QdrantClient; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; - - client.create_full_snapshot().await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.createFullSnapshotAsync().get(); - - language: csharp - code: | - using Qdrant.Client; - - var client = new QdrantClient("localhost", 6334); - - await client.CreateFullSnapshotAsync(); - - /snapshots/{snapshot_name}: - delete: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.retrieve(\n collection_name=\"{collection_name}\",\n ids=[0, 3, 100],\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.PointIdFactory.id;\n\nimport java.util.List;\n\nclient\n .retrieveAsync(\"{collection_name}\", List.of(id(0), id(30), id(100)), false, false, null)\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.retrieve(\"{collection_name}\", {\n ids: [0, 3, 100],\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::client::QdrantClient;\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .get_points(\n \"{collection_name}\",\n None,\n &[0.into(), 30.into(), 100.into()],\n Some(false),\n Some(false),\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.RetrieveAsync(\n collectionName: \"{collection_name}\",\n ids: [0, 30, 100],\n withPayload: false,\n withVectors: false\n);\n" + language: csharp + put: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.delete_full_snapshot(snapshot_name="{snapshot_name}") - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.deleteFullSnapshot("{snapshot_name}"); - - language: rust - code: | - use qdrant_client::client::QdrantClient; + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.upsert(\n collection_name=\"{collection_name}\",\n points=[\n models.PointStruct(\n id=1,\n payload={\n \"color\": \"red\",\n },\n vector=[0.9, 0.1, 0.1],\n ),\n models.PointStruct(\n id=2,\n payload={\n \"color\": \"green\",\n },\n vector=[0.1, 0.9, 0.1],\n ),\n models.PointStruct(\n id=3,\n payload={\n \"color\": \"blue\",\n },\n vector=[0.1, 0.1, 0.9],\n ),\n ],\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.PointIdFactory.id;\nimport static io.qdrant.client.VectorFactory.vector;\nimport static io.qdrant.client.VectorsFactory.namedVectors;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.PointStruct;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .upsertAsync(\n \"{collection_name}\",\n List.of(\n PointStruct.newBuilder()\n .setId(id(1))\n .setVectors(\n namedVectors(\n Map.of(\n \"image\",\n vector(List.of(0.9f, 0.1f, 0.1f, 0.2f)),\n \"text\",\n vector(List.of(0.4f, 0.7f, 0.1f, 0.8f, 0.1f, 0.1f, 0.9f, 0.2f)))))\n .build(),\n PointStruct.newBuilder()\n .setId(id(2))\n .setVectors(\n namedVectors(\n Map.of(\n \"image\",\n List.of(0.2f, 0.1f, 0.3f, 0.9f),\n \"text\",\n List.of(0.5f, 0.2f, 0.7f, 0.4f, 0.7f, 0.2f, 0.3f, 0.9f))))\n .build()))\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.upsert(\"{collection_name}\", {\n points: [\n {\n id: 1,\n payload: { color: \"red\" },\n vector: [0.9, 0.1, 0.1],\n },\n {\n id: 2,\n payload: { color: \"green\" },\n vector: [0.1, 0.9, 0.1],\n },\n {\n id: 3,\n payload: { color: \"blue\" },\n vector: [0.1, 0.1, 0.9],\n },\n ],\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::PointStruct};\nuse serde_json::json;\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .upsert_points_batch_blocking(\n \"{collection_name}\".to_string(),\n None,\n vec![\n PointStruct::new(\n 1,\n vec![0.9, 0.1, 0.1],\n json!(\n {\"color\": \"red\"}\n )\n .try_into()\n .unwrap(),\n ),\n PointStruct::new(\n 2,\n vec![0.1, 0.9, 0.1],\n json!(\n {\"color\": \"green\"}\n )\n .try_into()\n .unwrap(),\n ),\n PointStruct::new(\n 3,\n vec![0.1, 0.1, 0.9],\n json!(\n {\"color\": \"blue\"}\n )\n .try_into()\n .unwrap(),\n ),\n ],\n None,\n 100,\n )\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.UpsertAsync(\n collectionName: \"{collection_name}\",\n points: new List\n {\n new()\n {\n Id = 1,\n Vectors = new[] { 0.9f, 0.1f, 0.1f },\n Payload = { [\"city\"] = \"red\" }\n },\n new()\n {\n Id = 2,\n Vectors = new[] { 0.1f, 0.9f, 0.1f },\n Payload = { [\"city\"] = \"green\" }\n },\n new()\n {\n Id = 3,\n Vectors = new[] { 0.1f, 0.1f, 0.9f },\n Payload = { [\"city\"] = \"blue\" }\n }\n }\n);\n" + language: csharp + /collections/{collection_name}/points/batch: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.batch_update_points(\n collection_name=\"{collection_name}\",\n update_operations=[\n models.UpsertOperation(\n upsert=models.PointsList(\n points=[\n models.PointStruct(\n id=1,\n vector=[1.0, 2.0, 3.0, 4.0],\n payload={},\n ),\n ]\n )\n ),\n models.UpdateVectorsOperation(\n update_vectors=models.UpdateVectors(\n points=[\n models.PointVectors(\n id=1,\n vector=[1.0, 2.0, 3.0, 4.0],\n )\n ]\n )\n ),\n models.SetPayloadOperation(\n set_payload=models.SetPayload(\n payload={\n \"test_payload_2\": 2,\n \"test_payload_3\": 3,\n },\n points=[1],\n )\n ),\n ],\n)\n" + language: python + - code-samples: + - code: "import java.util.List;\nimport java.util.Map;\n\nimport static io.qdrant.client.PointIdFactory.id;\nimport static io.qdrant.client.ValueFactory.value;\nimport static io.qdrant.client.VectorsFactory.vectors;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.PointStruct;\nimport io.qdrant.client.grpc.Points.PointVectors;\nimport io.qdrant.client.grpc.Points.PointsIdsList;\nimport io.qdrant.client.grpc.Points.PointsSelector;\nimport io.qdrant.client.grpc.Points.PointsUpdateOperation;\nimport io.qdrant.client.grpc.Points.PointsUpdateOperation.PointStructList;\nimport io.qdrant.client.grpc.Points.PointsUpdateOperation.SetPayload;\nimport io.qdrant.client.grpc.Points.PointsUpdateOperation.UpdateVectors;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .batchUpdateAsync(\n \"{collection_name}\",\n List.of(\n PointsUpdateOperation.newBuilder()\n .setUpsert(\n PointStructList.newBuilder()\n .addPoints(\n PointStruct.newBuilder()\n .setId(id(1))\n .setVectors(vectors(\n 1.0 f,\n 2.0 f,\n 3.0 f,\n 4.0 f))\n .build())\n .build())\n .build(),\n PointsUpdateOperation.newBuilder()\n .setUpdateVectors(\n UpdateVectors.newBuilder()\n .addPoints(\n PointVectors.newBuilder()\n .setId(id(1))\n .setVectors(vectors(\n 1.0 f,\n 2.0 f,\n 3.0 f,\n 4.0 f))\n .build())\n .build())\n .build(),\n PointsUpdateOperation.newBuilder()\n .setSetPayload(\n SetPayload.newBuilder()\n .setPointsSelector(\n PointsSelector.newBuilder()\n .setPoints(PointsIdsList\n .newBuilder()\n .addIds(id(1))\n .build())\n .build())\n .putAllPayload(\n Map.of(\"test_payload_2\",\n value(2),\n \"test_payload_3\",\n value(3)))\n .build())\n .build()))\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.batchUpdate(\"{collection_name}\", {\n operations: [\n {\n upsert: {\n points: [\n {\n id: 1,\n vector: [1.0, 2.0, 3.0, 4.0],\n payload: {},\n },\n ],\n },\n },\n {\n update_vectors: {\n points: [\n {\n id: 1,\n vector: [1.0, 2.0, 3.0, 4.0],\n },\n ],\n },\n },\n {\n set_payload: {\n payload: {\n test_payload_2: 2,\n test_payload_3: 3,\n },\n points: [1],\n },\n },\n ],\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::qdrant::{\n points_selector::PointsSelectorOneOf,\n points_update_operation::{\n Operation, PointStructList, SetPayload, UpdateVectors,\n },\n PointStruct, PointVectors, PointsIdsList, PointsSelector, PointsUpdateOperation,\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .batch_updates_blocking(\n \"{collection_name}\",\n &[\n PointsUpdateOperation {\n operation: Some(Operation::Upsert(PointStructList {\n points: vec![PointStruct::new(\n 1,\n vec![1.0, 2.0, 3.0, 4.0],\n json!({}).try_into().unwrap(),\n )],\n ..Default::default()\n })),\n },\n PointsUpdateOperation {\n operation: Some(Operation::UpdateVectors(UpdateVectors {\n points: vec![PointVectors {\n id: Some(1.into()),\n vectors: Some(vec![1.0, 2.0, 3.0, 4.0].into()),\n }],\n ..Default::default()\n })),\n },\n PointsUpdateOperation {\n operation: Some(Operation::OverwritePayload(SetPayload {\n points_selector: Some(PointsSelector {\n points_selector_one_of: Some(PointsSelectorOneOf::Points(\n PointsIdsList {\n ids: vec![1.into()],\n },\n )),\n }),\n payload: HashMap::from([(\"test_payload\".to_string(), 1.into())]),\n ..Default::default()\n })),\n },\n ],\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.UpdateBatchAsync(\n \"{collection_name}\",\n [\n new()\n {\n Upsert = new()\n {\n Points =\n {\n new PointStruct { Id = 1, Vectors = new[] { 0.9f, 0.1f, 0.1f } },\n }\n }\n },\n new()\n {\n UpdateVectors = new()\n {\n Points =\n {\n new PointVectors { Id = 1, Vectors = new[] { 0.9f, 0.1f, 0.1f } },\n }\n }\n },\n new()\n {\n SetPayload = new()\n {\n PointsSelector = new PointsSelector { Points = new PointsIdsList { Ids = { 1 } } },\n Payload = { [\"test_payload_2\"] = 2, [\"test_payload_3\"] = 3 }\n }\n }\n ]\n);\n" + language: csharp + /collections/{collection_name}/points/count: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.count(\n collection_name=\"{collection_name}\",\n count_filter=models.Filter(\n must=[\n models.FieldCondition(key=\"color\", match=models.MatchValue(value=\"red\")),\n ]\n ),\n exact=True,\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.ConditionFactory.matchKeyword;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.Filter;\n\nQdrantClient client = new QdrantClient(QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .countAsync(\n \"{collection_name}\",\n Filter.newBuilder().addMust(matchKeyword(\"color\", \"red\")).build(),\n true)\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.count(\"{collection_name}\", {\n filter: {\n must: [\n {\n key: \"color\",\n match: {\n value: \"red\",\n },\n },\n ],\n },\n exact: true,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::{Condition, CountPoints, Filter}};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .count(&CountPoints {\n collection_name: \"{collection_name}\".to_string(),\n filter: Some(Filter::must([Condition::matches(\n \"color\",\n \"red\".to_string(),\n )])),\n exact: Some(true),\n ..Default::default()\n })\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing static Qdrant.Client.Grpc.Conditions;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.CountAsync(\n collectionName: \"{collection_name}\",\n filter: MatchKeyword(\"color\", \"red\"),\n exact: true\n);\n" + language: csharp + /collections/{collection_name}/points/delete: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.delete(\n collection_name=\"{collection_name}\",\n points_selector=models.PointIdsList(\n points=[0, 3, 100],\n ),\n)\n\nclient.delete(\n collection_name=\"{collection_name}\",\n points_selector=models.FilterSelector(\n filter=models.Filter(\n must=[\n models.FieldCondition(\n key=\"color\",\n match=models.MatchValue(value=\"red\"),\n ),\n ],\n )\n ),\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.PointIdFactory.id;\nimport static io.qdrant.client.ConditionFactory.matchKeyword;\n\nimport java.util.List;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.Filter;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.deleteAsync(\"{collection_name}\", List.of(id(0), id(3), id(100)));\n\nclient\n .deleteAsync(\n \"{collection_name}\",\n Filter.newBuilder().addMust(matchKeyword(\"color\", \"red\")).build())\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.delete(\"{collection_name}\", {\n points: [0, 3, 100],\n});\n\nclient.delete(\"{collection_name}\", {\n filter: {\n must: [\n {\n key: \"color\",\n match: {\n value: \"red\",\n },\n },\n ],\n },\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::{points_selector::PointsSelectorOneOf, Condition, Filter, PointsIdsList, PointsSelector}};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .delete_points_blocking(\n \"{collection_name}\",\n None,\n &PointsSelector {\n points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList {\n ids: vec![0.into(), 3.into(), 100.into()],\n })),\n },\n None,\n )\n .await?;\n\n client\n .delete_points_blocking(\n \"{collection_name}\",\n None,\n &PointsSelector {\n points_selector_one_of: Some(PointsSelectorOneOf::Filter(Filter::must([\n Condition::matches(\"color\", \"red\".to_string()),\n ]))),\n },\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: 'using Qdrant.Client; - let client = QdrantClient::from_url("http://localhost:6334").build()?; - client.delete_full_snapshot("{snapshot_name}").await?; - - language: java - code: | - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; + var client = new QdrantClient("localhost", 6334); - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - client.deleteFullSnapshotAsync("{snapshot_name}").get(); - - language: csharp - code: | - using Qdrant.Client; + await client.DeleteAsync(collectionName: "{collection_name}", ids: [0, 3, 100]); - var client = new QdrantClient("localhost", 6334); - await client.DeleteFullSnapshotAsync("{snapshot_name}"); + await client.DeleteAsync(collectionName: "{collection_name}", filter: MatchKeyword("color", "red")); - /collections/{collection_name}/points: +' + language: csharp + /collections/{collection_name}/points/discover: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.discover(\n \"{collection_name}\",\n target=[0.2, 0.1, 0.9, 0.7],\n context=[\n models.ContextExamplePair(positive=100, negative=718),\n models.ContextExamplePair(positive=200, negative=300),\n ],\n limit=10,\n)\n" + language: python + - code-samples: + - code: "import java.util.List;\n\nimport static io.qdrant.client.PointIdFactory.id;\nimport static io.qdrant.client.VectorFactory.vector;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.ContextExamplePair;\nimport io.qdrant.client.grpc.Points.DiscoverPoints;\nimport io.qdrant.client.grpc.Points.TargetVector;\nimport io.qdrant.client.grpc.Points.VectorExample;\n\nQdrantClient client =\n new QdrantClient(QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .discoverAsync(\n DiscoverPoints.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .setTarget(\n TargetVector.newBuilder()\n .setSingle(\n VectorExample.newBuilder()\n .setVector(vector(0.2f, 0.1f, 0.9f, 0.7f))\n .build()))\n .addAllContext(\n List.of(\n ContextExamplePair.newBuilder()\n .setPositive(VectorExample.newBuilder().setId(id(100)))\n .setNegative(VectorExample.newBuilder().setId(id(718)))\n .build(),\n ContextExamplePair.newBuilder()\n .setPositive(VectorExample.newBuilder().setId(id(200)))\n .setNegative(VectorExample.newBuilder().setId(id(300)))\n .build()))\n .setLimit(10)\n .build())\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.discover(\"{collection_name}\", {\n target: [0.2, 0.1, 0.9, 0.7],\n context: [\n {\n positive: 100,\n negative: 718,\n },\n {\n positive: 200,\n negative: 300,\n },\n ],\n limit: 10,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{\n client::QdrantClient,\n qdrant::{\n target_vector::Target, vector_example::Example, ContextExamplePair, DiscoverPoints,\n TargetVector, VectorExample,\n },\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .discover(&DiscoverPoints {\n collection_name: \"{collection_name}\".to_string(),\n target: Some(TargetVector {\n target: Some(Target::Single(VectorExample {\n example: Some(Example::Vector(vec![0.2, 0.1, 0.9, 0.7].into())),\n })),\n }),\n context: vec![\n ContextExamplePair {\n positive: Some(VectorExample {\n example: Some(Example::Id(100.into())),\n }),\n negative: Some(VectorExample {\n example: Some(Example::Id(718.into())),\n }),\n },\n ContextExamplePair {\n positive: Some(VectorExample {\n example: Some(Example::Id(200.into())),\n }),\n negative: Some(VectorExample {\n example: Some(Example::Id(300.into())),\n }),\n },\n ],\n limit: 10,\n ..Default::default()\n })\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.DiscoverAsync(\n collectionName: \"{collection_name}\",\n target: new TargetVector\n {\n Single = new VectorExample { Vector = new float[] { 0.2f, 0.1f, 0.9f, 0.7f }, }\n },\n context:\n [\n new()\n {\n Positive = new VectorExample { Id = 100 },\n Negative = new VectorExample { Id = 718 }\n },\n new()\n {\n Positive = new VectorExample { Id = 200 },\n Negative = new VectorExample { Id = 300 }\n }\n ],\n limit: 10\n);\n" + language: csharp + /collections/{collection_name}/points/discover/batch: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\ndiscover_queries = [\n models.DiscoverRequest(\n target=[0.2, 0.1, 0.9, 0.7],\n context=[\n models.ContextExamplePair(\n positive=100,\n negative=718,\n ),\n models.ContextExamplePair(\n positive=200,\n negative=300,\n ),\n ],\n limit=10,\n ),\n models.DiscoverRequest(\n target=[0.5, 0.3, 0.2, 0.3],\n context=[\n models.ContextExamplePair(\n positive=342,\n negative=213,\n ),\n models.ContextExamplePair(\n positive=100,\n negative=200,\n ),\n ],\n limit=5,\n ),\n]\n\nclient.discover_batch(\"{collection_name}\", discover_queries)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.PointIdFactory.id;\nimport static io.qdrant.client.VectorFactory.vector;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.ContextExamplePair;\nimport io.qdrant.client.grpc.Points.DiscoverPoints;\nimport io.qdrant.client.grpc.Points.TargetVector;\nimport io.qdrant.client.grpc.Points.VectorExample;\n\nQdrantClient client = new QdrantClient(QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nList discoverPoints = Arrays.asList(\n DiscoverPoints.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .setTarget(\n TargetVector.newBuilder()\n .setSingle(\n VectorExample.newBuilder()\n .setVector(vector(\n 0.2 f,\n 0.1 f,\n 0.9 f,\n 0.7 f))\n .build()))\n .addAllContext(\n List.of(\n ContextExamplePair.newBuilder()\n .setPositive(VectorExample\n .newBuilder()\n .setId(id(100)))\n .setNegative(VectorExample\n .newBuilder()\n .setId(id(718)))\n .build(),\n ContextExamplePair.newBuilder()\n .setPositive(VectorExample\n .newBuilder()\n .setId(id(200)))\n .setNegative(VectorExample\n .newBuilder()\n .setId(id(300)))\n .build()))\n .setLimit(10)\n .build(),\n DiscoverPoints.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .setTarget(\n TargetVector.newBuilder()\n .setSingle(\n VectorExample.newBuilder()\n .setVector(vector(\n 0.5 f, 0.3 f, 0.2 f, 0.3 f))\n .build()))\n .addAllContext(\n List.of(\n ContextExamplePair.newBuilder()\n .setPositive(VectorExample\n .newBuilder()\n .setId(id(342)))\n .setNegative(VectorExample\n .newBuilder()\n .setId(id(213)))\n .build(),\n ContextExamplePair.newBuilder()\n .setPositive(VectorExample\n .newBuilder()\n .setId(id(100)))\n .setNegative(VectorExample\n .newBuilder()\n .setId(id(200)))\n .build()))\n .setLimit(10)\n .build());\nclient.discoverBatchAsync(\"{collection_name}\", discoverPoints, null);\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nconst searches = [\n {\n target: [0.2, 0.1, 0.9, 0.7],\n context: [\n {\n positive: 100,\n negative: 718,\n },\n {\n positive: 200,\n negative: 300,\n },\n ],\n limit: 10,\n },\n {\n target: [0.5, 0.3, 0.2, 0.3],\n context: [\n {\n positive: 342,\n negative: 213,\n },\n {\n positive: 100,\n negative: 200,\n },\n ],\n limit: 5,\n },\n];\n\nclient.discoverBatchPoints(\"{collection_name}\", {\n searches,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{\n client::QdrantClient,\n qdrant::{\n target_vector::Target, vector_example::Example, ContextExamplePair, DiscoverBatchPoints,\n DiscoverPoints, TargetVector, VectorExample,\n },\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nlet discover_points = &DiscoverBatchPoints {\n collection_name: \"{collection_name}\".to_string(),\n discover_points: vec![\n DiscoverPoints {\n collection_name: \"{collection_name}\".to_string(),\n target: Some(TargetVector {\n target: Some(Target::Single(VectorExample {\n example: Some(Example::Vector(vec![0.2, 0.1, 0.9, 0.7].into())),\n })),\n }),\n context: vec![\n ContextExamplePair {\n positive: Some(VectorExample {\n example: Some(Example::Id(100.into())),\n }),\n negative: Some(VectorExample {\n example: Some(Example::Id(718.into())),\n }),\n },\n ContextExamplePair {\n positive: Some(VectorExample {\n example: Some(Example::Id(200.into())),\n }),\n negative: Some(VectorExample {\n example: Some(Example::Id(300.into())),\n }),\n },\n ],\n limit: 10,\n ..Default::default()\n },\n DiscoverPoints {\n collection_name: \"{collection_name}\".to_string(),\n target: Some(TargetVector {\n target: Some(Target::Single(VectorExample {\n example: Some(Example::Vector(vec![0.5, 0.3, 0.2, 0.3].into())),\n })),\n }),\n context: vec![\n ContextExamplePair {\n positive: Some(VectorExample {\n example: Some(Example::Id(342.into())),\n }),\n negative: Some(VectorExample {\n example: Some(Example::Id(213.into())),\n }),\n },\n ContextExamplePair {\n positive: Some(VectorExample {\n example: Some(Example::Id(100.into())),\n }),\n negative: Some(VectorExample {\n example: Some(Example::Id(200.into())),\n }),\n },\n ],\n limit: 10,\n ..Default::default()\n },\n ],\n ..Default::default()\n};\n\nclient.discover_batch(discover_points).await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nvar discoverPoints = new List\n{\n new DiscoverPoints\n {\n CollectionName = \"{collection_name}\",\n Target = new TargetVector\n {\n Single = new VectorExample { Vector = new float[] { 0.2f, 0.1f, 0.9f, 0.7f }, }\n },\n Context =\n {\n new ContextExamplePair()\n {\n Positive = new VectorExample { Id = 100 },\n Negative = new VectorExample { Id = 718 }\n },\n new ContextExamplePair()\n {\n Positive = new VectorExample { Id = 200 },\n Negative = new VectorExample { Id = 300 }\n }\n },\n Limit = 10\n },\n new DiscoverPoints\n {\n CollectionName = \"{collection_name}\",\n Target = new TargetVector\n {\n Single = new VectorExample { Vector = new float[] { 0.5f, 0.3f, 0.2f, 0.3f }, }\n },\n Context =\n {\n new ContextExamplePair()\n {\n Positive = new VectorExample { Id = 342 },\n Negative = new VectorExample { Id = 213 }\n },\n new ContextExamplePair()\n {\n Positive = new VectorExample { Id = 100 },\n Negative = new VectorExample { Id = 200 }\n }\n },\n Limit = 10\n }\n};\nawait client.DiscoverBatchAsync(\"{collection_name}\", discoverPoints);\n" + language: csharp + /collections/{collection_name}/points/payload: post: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.set_payload(\n collection_name=\"{collection_name}\",\n payload={\n \"property1\": \"string\",\n \"property2\": \"string\",\n },\n points=[0, 3, 10],\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.PointIdFactory.id;\nimport static io.qdrant.client.ValueFactory.value;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .setPayloadAsync(\n \"{collection_name}\",\n Map.of(\"property1\", value(\"string\"), \"property2\", value(\"string\")),\n List.of(id(0), id(3), id(10)),\n true,\n null,\n null)\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.setPayload(\"{collection_name}\", {\n payload: {\n property1: \"string\",\n property2: \"string\",\n },\n points: [0, 3, 10],\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::{\n points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector,\n}};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .set_payload_blocking(\n \"{collection_name}\",\n None,\n &PointsSelector {\n points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList {\n ids: vec![0.into(), 3.into(), 10.into()],\n })),\n },\n json!({\n \"property1\": \"string\",\n \"property2\": \"string\",\n })\n .try_into()\n .unwrap(),\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.SetPayloadAsync(\n collectionName: \"{collection_name}\",\n payload: new Dictionary { { \"property1\", \"string\" }, { \"property2\", \"string\" } },\n ids: new ulong[] { 0, 3, 10 }\n);\n" + language: csharp + put: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.overwrite_payload(\n collection_name=\"{collection_name}\",\n payload={\n \"property1\": \"string\",\n \"property2\": \"string\",\n },\n points=[0, 3, 10],\n)\n" + language: python + - code-samples: + - code: "import java.util.List;\n\nimport static io.qdrant.client.PointIdFactory.id;\nimport static io.qdrant.client.ValueFactory.value;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .overwritePayloadAsync(\n \"{collection_name}\",\n Map.of(\"property1\", value(\"string\"), \"property2\", value(\"string\")),\n List.of(id(0), id(3), id(10)),\n true,\n null,\n null)\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.overwritePayload(\"{collection_name}\", {\n payload: {\n property1: \"string\",\n property2: \"string\",\n },\n points: [0, 3, 10],\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::{\n points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector,\n}};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .overwrite_payload_blocking(\n \"{collection_name}\",\n None,\n &PointsSelector {\n points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList {\n ids: vec![0.into(), 3.into(), 10.into()],\n })),\n },\n json!({\n \"property1\": \"string\",\n \"property2\": \"string\",\n })\n .try_into()\n .unwrap(),\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.OverwritePayloadAsync(\n collectionName: \"{collection_name}\",\n payload: new Dictionary { { \"property1\", \"string\" }, { \"property2\", \"string\" } },\n ids: new ulong[] { 0, 3, 10 }\n);\n" + language: csharp + /collections/{collection_name}/points/payload/clear: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.clear_payload(\n collection_name=\"{collection_name}\",\n points_selector=[0, 3, 100],\n)\n" + language: python + - code-samples: + - code: "import java.util.List;\n\nimport static io.qdrant.client.PointIdFactory.id;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.clearPayloadAsync(\"{collection_name}\", List.of(id(0), id(3), id(100)), null, null, null)\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.clearPayload(\"{collection_name}\", {\n points: [0, 3, 100],\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::{\n points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector,\n}};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .clear_payload(\n \"{collection_name}\",\n None,\n Some(PointsSelector {\n points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList {\n ids: vec![0.into(), 3.into(), 100.into()],\n })),\n }),\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client = QdrantClient(url="http://localhost:6333") - client.retrieve( - collection_name="{collection_name}", - ids=[0, 3, 100], - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; + var client = new QdrantClient("localhost", 6334); - const client = new QdrantClient({ host: "localhost", port: 6333 }); - client.retrieve("{collection_name}", { - ids: [0, 3, 100], - }); - - language: rust - code: | - use qdrant_client::client::QdrantClient; + await client.ClearPayloadAsync("{collection_name}", [0, 3, 10]); - let client = QdrantClient::from_url("http://localhost:6334").build()?; +' + language: csharp + /collections/{collection_name}/points/payload/delete: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.delete_payload(\n collection_name=\"{collection_name}\",\n keys=[\"color\", \"price\"],\n points=[0, 3, 100],\n)\n" + language: python + - code-samples: + - code: "import java.util.List;\n\nimport static io.qdrant.client.PointIdFactory.id;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .deletePayloadAsync(\n \"{collection_name}\",\n List.of(\"color\", \"price\"),\n List.of(id(0), id(3), id(100)),\n true,\n null,\n null)\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.deletePayload(\"{collection_name}\", {\n keys: [\"color\", \"price\"],\n points: [0, 3, 100],\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::{\n points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector,\n}};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .delete_payload_blocking(\n \"{collection_name}\",\n None,\n &PointsSelector {\n points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList {\n ids: vec![0.into(), 3.into(), 100.into()],\n })),\n },\n vec![\"color\".to_string(), \"price\".to_string()],\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client - .get_points( - "{collection_name}", - None, - &[0.into(), 30.into(), 100.into()], - Some(false), - Some(false), - None, - ) - .await?; - - language: java - code: | - import static io.qdrant.client.PointIdFactory.id; - - import java.util.List; - - client - .retrieveAsync("{collection_name}", List.of(id(0), id(30), id(100)), false, false, null) - .get(); - - language: csharp - code: | - using Qdrant.Client; var client = new QdrantClient("localhost", 6334); - await client.RetrieveAsync( - collectionName: "{collection_name}", - ids: [0, 30, 100], - withPayload: false, - withVectors: false - ); + await client.DeletePayloadAsync("{collection_name}", ["color", "price"], [0, 3, 10]); + +' + language: csharp + /collections/{collection_name}/points/recommend: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.recommend(\n collection_name=\"{collection_name}\",\n positive=[100, 231],\n negative=[718, [0.2, 0.3, 0.4, 0.5]],\n strategy=models.RecommendStrategy.AVERAGE_VECTOR,\n query_filter=models.Filter(\n must=[\n models.FieldCondition(\n key=\"city\",\n match=models.MatchValue(\n value=\"London\",\n ),\n )\n ]\n ),\n limit=3,\n)\n" + language: python + - code-samples: + - code: "import java.util.List;\n\nimport static io.qdrant.client.ConditionFactory.matchKeyword;\nimport static io.qdrant.client.PointIdFactory.id;\nimport static io.qdrant.client.VectorFactory.vector;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.Filter;\nimport io.qdrant.client.grpc.Points.RecommendPoints;\nimport io.qdrant.client.grpc.Points.RecommendStrategy;\n\nQdrantClient client =\n new QdrantClient(QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .recommendAsync(\n RecommendPoints.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .addAllPositive(List.of(id(100), id(200)))\n .addAllPositiveVectors(List.of(vector(100.0f, 231.0f)))\n .addAllNegative(List.of(id(718)))\n .addAllPositiveVectors(List.of(vector(0.2f, 0.3f, 0.4f, 0.5f)))\n .setStrategy(RecommendStrategy.AverageVector)\n .setFilter(Filter.newBuilder().addMust(matchKeyword(\"city\", \"London\")))\n .setLimit(3)\n .build())\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.recommend(\"{collection_name}\", {\n positive: [100, 231],\n negative: [718, [0.2, 0.3, 0.4, 0.5]],\n strategy: \"average_vector\",\n filter: {\n must: [\n {\n key: \"city\",\n match: {\n value: \"London\",\n },\n },\n ],\n },\n limit: 3,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{\n client::QdrantClient,\n qdrant::{Condition, Filter, RecommendPoints, RecommendStrategy},\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .recommend(&RecommendPoints {\n collection_name: \"{collection_name}\".to_string(),\n positive: vec![100.into(), 200.into()],\n positive_vectors: vec![vec![100.0, 231.0].into()],\n negative: vec![718.into()],\n negative_vectors: vec![vec![0.2, 0.3, 0.4, 0.5].into()],\n strategy: Some(RecommendStrategy::AverageVector.into()),\n filter: Some(Filter::must([Condition::matches(\n \"city\",\n \"London\".to_string(),\n )])),\n limit: 3,\n ..Default::default()\n })\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\nusing static Qdrant.Client.Grpc.Conditions;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.RecommendAsync(\n \"{collection_name}\",\n positive: new ulong[] { 100, 231 },\n negative: new ulong[] { 718 },\n filter: MatchKeyword(\"city\", \"London\"),\n limit: 3\n);\n" + language: csharp + /collections/{collection_name}/points/recommend/batch: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nrecommend_queries = [\n models.RecommendRequest(\n positive=[100, 231], negative=[718], filter=filter_, limit=3\n ),\n models.RecommendRequest(positive=[200, 67], negative=[300], limit=3),\n]\n\nclient.recommend_batch(collection_name=\"{collection_name}\", requests=recommend_queries)\n" + language: python + - code-samples: + - code: "import java.util.List;\n\nimport static io.qdrant.client.ConditionFactory.matchKeyword;\nimport static io.qdrant.client.PointIdFactory.id;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.Filter;\nimport io.qdrant.client.grpc.Points.RecommendPoints;\n\nQdrantClient client =\n new QdrantClient(QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nFilter filter = Filter.newBuilder().addMust(matchKeyword(\"city\", \"London\")).build();\n\nList recommendQueries =\n List.of(\n RecommendPoints.newBuilder()\n .addAllPositive(List.of(id(100), id(231)))\n .addAllNegative(List.of(id(718)))\n .setFilter(filter)\n .setLimit(3)\n .build(),\n RecommendPoints.newBuilder()\n .addAllPositive(List.of(id(200), id(67)))\n .addAllNegative(List.of(id(300)))\n .setFilter(filter)\n .setLimit(3)\n .build());\n\nclient.recommendBatchAsync(\"{collection_name}\", recommendQueries, null).get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nconst searches = [\n {\n positive: [100, 231],\n negative: [718],\n limit: 3,\n },\n {\n positive: [200, 67],\n negative: [300],\n limit: 3,\n },\n];\n\nclient.recommend_batch(\"{collection_name}\", {\n searches,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{\n client::QdrantClient,\n qdrant::{Condition, Filter, RecommendBatchPoints, RecommendPoints},\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nlet filter = Filter::must([Condition::matches(\"city\", \"London\".to_string())]);\n\nlet recommend_queries = vec![\n RecommendPoints {\n collection_name: \"{collection_name}\".to_string(),\n positive: vec![100.into(), 231.into()],\n negative: vec![718.into()],\n filter: Some(filter.clone()),\n limit: 3,\n ..Default::default()\n },\n RecommendPoints {\n collection_name: \"{collection_name}\".to_string(),\n positive: vec![200.into(), 67.into()],\n negative: vec![300.into()],\n filter: Some(filter),\n limit: 3,\n ..Default::default()\n },\n];\n\nclient\n .recommend_batch(&RecommendBatchPoints {\n collection_name: \"{collection_name}\".to_string(),\n recommend_points: recommend_queries,\n ..Default::default()\n })\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\nusing static Qdrant.Client.Grpc.Conditions;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nvar filter = MatchKeyword(\"city\", \"london\");\n\nawait client.RecommendBatchAsync(\n collectionName: \"{collection_name}\",\n recommendSearches:\n [\n new()\n {\n CollectionName = \"{collection_name}\",\n Positive = { new PointId[] { 100, 231 } },\n Negative = { new PointId[] { 718 } },\n Limit = 3,\n Filter = filter,\n },\n new()\n {\n CollectionName = \"{collection_name}\",\n Positive = { new PointId[] { 200, 67 } },\n Negative = { new PointId[] { 300 } },\n Limit = 3,\n Filter = filter,\n }\n ]\n);\n" + language: csharp + /collections/{collection_name}/points/recommend/groups: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.recommend_groups(\n collection_name=\"{collection_name}\",\n positive=[100, 231],\n negative=[718],\n group_by=\"document_id\",\n limit=3,\n group_size=2,\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.PointIdFactory.id;\n\nimport java.util.List;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.RecommendPointGroups;\nimport io.qdrant.client.grpc.Points.RecommendStrategy;\n\nQdrantClient client =\n new QdrantClient(QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.recommendGroupsAsync(RecommendPointGroups.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .setGroupBy(\"document_id\")\n .setGroupSize(2)\n .addAllPositive(List.of(id(100), id(200)))\n .addAllNegative(List.of(id(718)))\n .setStrategy(RecommendStrategy.AverageVector)\n .setLimit(3)\n .build());\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.recommendPointGroups(\"{collection_name}\", {\n positive: [100, 231],\n negative: [718],\n group_by: \"document_id\",\n limit: 3,\n group_size: 2,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{\n client::QdrantClient,\n qdrant::{RecommendPointGroups, RecommendStrategy},\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .recommend_groups(&RecommendPointGroups {\n collection_name: \"{collection_name}\".to_string(),\n group_by: \"document_id\".to_string(),\n group_size: 2,\n positive: vec![100.into(), 200.into()],\n negative: vec![718.into()],\n strategy: Some(RecommendStrategy::AverageVector.into()),\n limit: 3,\n ..Default::default()\n })\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing static Qdrant.Client.Grpc.Conditions;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.RecommendGroupsAsync(\n \"{collection_name}\",\n \"document_id\",\n groupSize: 3,\n positive: new ulong[] { 100, 231 },\n negative: new ulong[] { 718 },\n filter: MatchKeyword(\"city\", \"London\"),\n limit: 3\n);\n" + language: csharp + /collections/{collection_name}/points/scroll: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.scroll(\n collection_name=\"{collection_name}\",\n scroll_filter=models.Filter(\n must=[\n models.FieldCondition(key=\"color\", match=models.MatchValue(value=\"red\")),\n ]\n ),\n limit=1,\n with_payload=True,\n with_vectors=False,\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.ConditionFactory.matchKeyword;\nimport static io.qdrant.client.WithPayloadSelectorFactory.enable;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.Filter;\nimport io.qdrant.client.grpc.Points.ScrollPoints;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .scrollAsync(\n ScrollPoints.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .setFilter(Filter.newBuilder().addMust(matchKeyword(\"color\", \"red\")).build())\n .setLimit(1)\n .setWithPayload(enable(true))\n .build())\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.scroll(\"{collection_name}\", {\n filter: {\n must: [\n {\n key: \"color\",\n match: {\n value: \"red\",\n },\n },\n ],\n },\n limit: 1,\n with_payload: true,\n with_vector: false,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::{Condition, Filter, ScrollPoints}};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .scroll(&ScrollPoints {\n collection_name: \"{collection_name}\".to_string(),\n filter: Some(Filter::must([Condition::matches(\n \"color\",\n \"red\".to_string(),\n )])),\n limit: Some(1),\n with_payload: Some(true.into()),\n with_vectors: Some(false.into()),\n ..Default::default()\n })\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing static Qdrant.Client.Grpc.Conditions;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.ScrollAsync(\n collectionName: \"{collection_name}\",\n filter: MatchKeyword(\"color\", \"red\"),\n limit: 1,\n payloadSelector: true\n);\n" + language: csharp + /collections/{collection_name}/points/search: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.search(\n collection_name=\"{collection_name}\",\n query_filter=models.Filter(\n must=[\n models.FieldCondition(\n key=\"city\",\n match=models.MatchValue(\n value=\"London\",\n ),\n )\n ]\n ),\n query_vector=[0.2, 0.1, 0.9, 0.7],\n limit=3,\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.ConditionFactory.matchKeyword;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.Filter;\nimport io.qdrant.client.grpc.Points.SearchPoints;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .searchAsync(\n SearchPoints.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .setFilter(Filter.newBuilder().addMust(matchKeyword(\"city\", \"London\")).build())\n .addAllVector(List.of(0.2f, 0.1f, 0.9f, 0.7f))\n .setLimit(3)\n .build())\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.search(\"{collection_name}\", {\n filter: {\n must: [\n {\n key: \"city\",\n match: {\n value: \"London\",\n },\n },\n ],\n },\n vector: [0.2, 0.1, 0.9, 0.7],\n limit: 3,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{\n client::QdrantClient,\n qdrant::{Condition, Filter, SearchParams, SearchPoints},\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .search_points(&SearchPoints {\n collection_name: \"{collection_name}\".to_string(),\n filter: Some(Filter::must([Condition::matches(\n \"city\",\n \"London\".to_string(),\n )])),\n params: Some(SearchParams {\n hnsw_ef: Some(128),\n exact: Some(false),\n ..Default::default()\n }),\n vector: vec![0.2, 0.1, 0.9, 0.7],\n limit: 3,\n ..Default::default()\n })\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing static Qdrant.Client.Grpc.Conditions;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.SearchAsync(\n collectionName: \"{collection_name}\",\n vector: new float[] { 0.2f, 0.1f, 0.9f, 0.7f },\n filter: MatchKeyword(\"city\", \"London\"),\n limit: 3\n);\n" + language: csharp + /collections/{collection_name}/points/search/batch: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nfilter_ = models.Filter(\n must=[\n models.FieldCondition(\n key=\"city\",\n match=models.MatchValue(\n value=\"London\",\n ),\n )\n ]\n)\n\nsearch_queries = [\n models.SearchRequest(vector=[0.2, 0.1, 0.9, 0.7], filter=filter_, limit=3),\n models.SearchRequest(vector=[0.5, 0.3, 0.2, 0.3], filter=filter_, limit=3),\n]\n\nclient.search_batch(collection_name=\"{collection_name}\", requests=search_queries)\n" + language: python + - code-samples: + - code: "import java.util.List;\n\nimport static io.qdrant.client.ConditionFactory.matchKeyword;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.Filter;\nimport io.qdrant.client.grpc.Points.SearchPoints;\n\nQdrantClient client =\n new QdrantClient(QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nFilter filter = Filter.newBuilder().addMust(matchKeyword(\"city\", \"London\")).build();\nList searches =\n List.of(\n SearchPoints.newBuilder()\n .addAllVector(List.of(0.2f, 0.1f, 0.9f, 0.7f))\n .setFilter(filter)\n .setLimit(3)\n .build(),\n SearchPoints.newBuilder()\n .addAllVector(List.of(0.5f, 0.3f, 0.2f, 0.3f))\n .setFilter(filter)\n .setLimit(3)\n .build());\nclient.searchBatchAsync(\"{collection_name}\", searches, null).get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nconst filter = {\n must: [\n {\n key: \"city\",\n match: {\n value: \"London\",\n },\n },\n ],\n};\n\nconst searches = [\n {\n vector: [0.2, 0.1, 0.9, 0.7],\n filter,\n limit: 3,\n },\n {\n vector: [0.5, 0.3, 0.2, 0.3],\n filter,\n limit: 3,\n },\n];\n\nclient.searchBatch(\"{collection_name}\", {\n searches,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{\n client::QdrantClient,\n qdrant::{Condition, Filter, SearchBatchPoints, SearchPoints},\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nlet filter = Filter::must([Condition::matches(\"city\", \"London\".to_string())]);\n\nlet searches = vec![\n SearchPoints {\n collection_name: \"{collection_name}\".to_string(),\n vector: vec![0.2, 0.1, 0.9, 0.7],\n filter: Some(filter.clone()),\n limit: 3,\n ..Default::default()\n },\n SearchPoints {\n collection_name: \"{collection_name}\".to_string(),\n vector: vec![0.5, 0.3, 0.2, 0.3],\n filter: Some(filter),\n limit: 3,\n ..Default::default()\n },\n];\n\nclient\n .search_batch_points(&SearchBatchPoints {\n collection_name: \"{collection_name}\".to_string(),\n search_points: searches,\n read_consistency: None,\n ..Default::default()\n })\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\nusing static Qdrant.Client.Grpc.Conditions;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nvar filter = MatchKeyword(\"city\", \"London\");\n\nvar searches = new List\n{\n new()\n {\n Vector = { new float[] { 0.2f, 0.1f, 0.9f, 0.7f } },\n Filter = filter,\n Limit = 3\n },\n new()\n {\n Vector = { new float[] { 0.5f, 0.3f, 0.2f, 0.3f } },\n Filter = filter,\n Limit = 3\n }\n};\n\nawait client.SearchBatchAsync(collectionName: \"{collection_name}\", searches: searches);\n" + language: csharp + /collections/{collection_name}/points/search/groups: + post: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.search_groups(\n collection_name=\"{collection_name}\",\n query_vector=[1.1],\n group_by=\"document_id\",\n limit=4,\n group_size=2,\n)\n" + language: python + - code-samples: + - code: "import java.util.List;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Points.SearchPointGroups;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .searchGroupsAsync(\n SearchPointGroups.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .addAllVector(List.of(1.1f))\n .setGroupBy(\"document_id\")\n .setLimit(4)\n .setGroupSize(2)\n .build())\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.searchPointGroups(\"{collection_name}\", {\n vector: [1.1],\n group_by: \"document_id\",\n limit: 4,\n group_size: 2,\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{\n client::QdrantClient,\n qdrant::SearchPointGroups,\n};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .search_groups(&SearchPointGroups {\n collection_name: \"{collection_name}\".to_string(),\n vector: vec![1.1],\n group_by: \"document_id\".to_string(),\n limit: 4,\n group_size: 2,\n ..Default::default()\n })\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.SearchGroupsAsync(\n collectionName: \"{collection_name}\",\n vector: new float[] { 1.1f },\n groupBy: \"document_id\",\n limit: 4,\n groupSize: 2\n);\n" + language: csharp + /collections/{collection_name}/points/vectors: put: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models - - client = QdrantClient(url="http://localhost:6333") - - client.upsert( - collection_name="{collection_name}", - points=[ - models.PointStruct( - id=1, - payload={ - "color": "red", - }, - vector=[0.9, 0.1, 0.1], - ), - models.PointStruct( - id=2, - payload={ - "color": "green", - }, - vector=[0.1, 0.9, 0.1], - ), - models.PointStruct( - id=3, - payload={ - "color": "blue", - }, - vector=[0.1, 0.1, 0.9], - ), - ], - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.upsert("{collection_name}", { - points: [ - { - id: 1, - payload: { color: "red" }, - vector: [0.9, 0.1, 0.1], - }, - { - id: 2, - payload: { color: "green" }, - vector: [0.1, 0.9, 0.1], - }, - { - id: 3, - payload: { color: "blue" }, - vector: [0.1, 0.1, 0.9], - }, - ], - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::PointStruct}; - use serde_json::json; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; - - client - .upsert_points_batch_blocking( - "{collection_name}".to_string(), - None, - vec![ - PointStruct::new( - 1, - vec![0.9, 0.1, 0.1], - json!( - {"color": "red"} - ) - .try_into() - .unwrap(), - ), - PointStruct::new( - 2, - vec![0.1, 0.9, 0.1], - json!( - {"color": "green"} - ) - .try_into() - .unwrap(), - ), - PointStruct::new( - 3, - vec![0.1, 0.1, 0.9], - json!( - {"color": "blue"} - ) - .try_into() - .unwrap(), - ), - ], - None, - 100, - ) - .await?; - - language: java - code: | - import static io.qdrant.client.PointIdFactory.id; - import static io.qdrant.client.VectorFactory.vector; - import static io.qdrant.client.VectorsFactory.namedVectors; - - import java.util.List; - import java.util.Map; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.PointStruct; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .upsertAsync( - "{collection_name}", - List.of( - PointStruct.newBuilder() - .setId(id(1)) - .setVectors( - namedVectors( - Map.of( - "image", - vector(List.of(0.9f, 0.1f, 0.1f, 0.2f)), - "text", - vector(List.of(0.4f, 0.7f, 0.1f, 0.8f, 0.1f, 0.1f, 0.9f, 0.2f))))) - .build(), - PointStruct.newBuilder() - .setId(id(2)) - .setVectors( - namedVectors( - Map.of( - "image", - List.of(0.2f, 0.1f, 0.3f, 0.9f), - "text", - List.of(0.5f, 0.2f, 0.7f, 0.4f, 0.7f, 0.2f, 0.3f, 0.9f)))) - .build())) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; - - var client = new QdrantClient("localhost", 6334); - - await client.UpsertAsync( - collectionName: "{collection_name}", - points: new List - { - new() - { - Id = 1, - Vectors = new[] { 0.9f, 0.1f, 0.1f }, - Payload = { ["city"] = "red" } - }, - new() - { - Id = 2, - Vectors = new[] { 0.1f, 0.9f, 0.1f }, - Payload = { ["city"] = "green" } - }, - new() - { - Id = 3, - Vectors = new[] { 0.1f, 0.1f, 0.9f }, - Payload = { ["city"] = "blue" } - } - } - ); - - /collections/{collection_name}/points/delete: + - code: "from qdrant_client import QdrantClient, models\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.update_vectors(\n collection_name=\"{collection_name}\",\n points=[\n models.PointVectors(\n id=1,\n vector={\n \"image\": [0.1, 0.2, 0.3, 0.4],\n },\n ),\n models.PointVectors(\n id=2,\n vector={\n \"text\": [0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2],\n },\n ),\n ],\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.PointIdFactory.id;\nimport static io.qdrant.client.VectorFactory.vector;\nimport static io.qdrant.client.VectorsFactory.namedVectors;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .updateVectorsAsync(\n \"{collection_name}\",\n List.of(\n PointVectors.newBuilder()\n .setId(id(1))\n .setVectors(namedVectors(Map.of(\"image\", vector(List.of(0.1f, 0.2f, 0.3f, 0.4f)))))\n .build(),\n PointVectors.newBuilder()\n .setId(id(2))\n .setVectors(\n namedVectors(\n Map.of(\n \"text\", vector(List.of(0.9f, 0.8f, 0.7f, 0.6f, 0.5f, 0.4f, 0.3f, 0.2f)))))\n .build()))\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.updateVectors(\"{collection_name}\", {\n points: [\n {\n id: 1,\n vector: {\n image: [0.1, 0.2, 0.3, 0.4],\n },\n },\n {\n id: 2,\n vector: {\n text: [0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2],\n },\n },\n ],\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::qdrant::PointVectors;\nuse std::collections::HashMap;\n\nclient\n .update_vectors_blocking(\n \"{collection_name}\",\n None,\n &[\n PointVectors {\n id: Some(1.into()),\n vectors: Some(\n HashMap::from([(\"image\".to_string(), vec![0.1, 0.2, 0.3, 0.4])]).into(),\n ),\n },\n PointVectors {\n id: Some(2.into()),\n vectors: Some(\n HashMap::from([(\n \"text\".to_string(),\n vec![0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2],\n )])\n .into(),\n ),\n },\n ],\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.UpdateVectorsAsync(\n collectionName: \"{collection_name}\",\n points: new List\n {\n new() { Id = 1, Vectors = (\"image\", new float[] { 0.1f, 0.2f, 0.3f, 0.4f }) },\n new()\n {\n Id = 2,\n Vectors = (\"text\", new float[] { 0.9f, 0.8f, 0.7f, 0.6f, 0.5f, 0.4f, 0.3f, 0.2f })\n }\n }\n);\n" + language: csharp + /collections/{collection_name}/points/vectors/delete: post: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.delete( - collection_name="{collection_name}", - points_selector=models.PointIdsList( - points=[0, 3, 100], - ), - ) - - client.delete( - collection_name="{collection_name}", - points_selector=models.FilterSelector( - filter=models.Filter( - must=[ - models.FieldCondition( - key="color", - match=models.MatchValue(value="red"), - ), - ], - ) - ), - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.delete("{collection_name}", { - points: [0, 3, 100], - }); - - client.delete("{collection_name}", { - filter: { - must: [ - { - key: "color", - match: { - value: "red", - }, - }, - ], - }, - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::{points_selector::PointsSelectorOneOf, Condition, Filter, PointsIdsList, PointsSelector}}; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.delete_vectors(\n collection_name=\"{collection_name}\",\n points=[0, 3, 100],\n vectors=[\"text\", \"image\"],\n)\n" + language: python + - code-samples: + - code: "import static io.qdrant.client.PointIdFactory.id;\n\nimport java.util.List;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient\n .deleteVectorsAsync(\n \"{collection_name}\", List.of(\"text\", \"image\"), List.of(id(0), id(3), id(10)))\n .get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.deleteVectors(\"{collection_name}\", {\n points: [0, 3, 10],\n vectors: [\"text\", \"image\"],\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::{\n points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector, VectorsSelector,\n}};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .delete_vectors_blocking(\n \"{collection_name}\",\n None,\n &PointsSelector {\n points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList {\n ids: vec![0.into(), 3.into(), 10.into()],\n })),\n },\n &VectorsSelector {\n names: vec![\"text\".into(), \"image\".into()],\n },\n None,\n )\n .await?;\n" + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client - .delete_points_blocking( - "{collection_name}", - None, - &PointsSelector { - points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList { - ids: vec![0.into(), 3.into(), 100.into()], - })), - }, - None, - ) - .await?; - - client - .delete_points_blocking( - "{collection_name}", - None, - &PointsSelector { - points_selector_one_of: Some(PointsSelectorOneOf::Filter(Filter::must([ - Condition::matches("color", "red".to_string()), - ]))), - }, - None, - ) - .await?; - - language: java - code: | - import static io.qdrant.client.PointIdFactory.id; - import static io.qdrant.client.ConditionFactory.matchKeyword; - - import java.util.List; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.Filter; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.deleteAsync("{collection_name}", List.of(id(0), id(3), id(100))); - - client - .deleteAsync( - "{collection_name}", - Filter.newBuilder().addMust(matchKeyword("color", "red")).build()) - .get(); - - language: csharp - code: | - using Qdrant.Client; var client = new QdrantClient("localhost", 6334); - await client.DeleteAsync(collectionName: "{collection_name}", ids: [0, 3, 100]); - await client.DeleteAsync(collectionName: "{collection_name}", filter: MatchKeyword("color", "red")); + await client.DeleteVectorsAsync("{collection_name}", ["text", "image"], [0, 3, 10]); - /collections/{collection_name}/points/vectors: +' + language: csharp + /collections/{collection_name}/shards: put: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models - - client = QdrantClient(url="http://localhost:6333") + - code: 'from qdrant_client import QdrantClient - client.update_vectors( - collection_name="{collection_name}", - points=[ - models.PointVectors( - id=1, - vector={ - "image": [0.1, 0.2, 0.3, 0.4], - }, - ), - models.PointVectors( - id=2, - vector={ - "text": [0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2], - }, - ), - ], - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.updateVectors("{collection_name}", { - points: [ - { - id: 1, - vector: { - image: [0.1, 0.2, 0.3, 0.4], - }, - }, - { - id: 2, - vector: { - text: [0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2], - }, - }, - ], - }); - - language: rust - code: | - use qdrant_client::qdrant::PointVectors; - use std::collections::HashMap; - - client - .update_vectors_blocking( - "{collection_name}", - None, - &[ - PointVectors { - id: Some(1.into()), - vectors: Some( - HashMap::from([("image".to_string(), vec![0.1, 0.2, 0.3, 0.4])]).into(), - ), - }, - PointVectors { - id: Some(2.into()), - vectors: Some( - HashMap::from([( - "text".to_string(), - vec![0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2], - )]) - .into(), - ), - }, - ], - None, - ) - .await?; - - language: java - code: | - import static io.qdrant.client.PointIdFactory.id; - import static io.qdrant.client.VectorFactory.vector; - import static io.qdrant.client.VectorsFactory.namedVectors; - - import java.util.List; - import java.util.Map; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .updateVectorsAsync( - "{collection_name}", - List.of( - PointVectors.newBuilder() - .setId(id(1)) - .setVectors(namedVectors(Map.of("image", vector(List.of(0.1f, 0.2f, 0.3f, 0.4f))))) - .build(), - PointVectors.newBuilder() - .setId(id(2)) - .setVectors( - namedVectors( - Map.of( - "text", vector(List.of(0.9f, 0.8f, 0.7f, 0.6f, 0.5f, 0.4f, 0.3f, 0.2f))))) - .build())) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; + client = QdrantClient(url="http://localhost:6333") - var client = new QdrantClient("localhost", 6334); - await client.UpdateVectorsAsync( - collectionName: "{collection_name}", - points: new List - { - new() { Id = 1, Vectors = ("image", new float[] { 0.1f, 0.2f, 0.3f, 0.4f }) }, - new() - { - Id = 2, - Vectors = ("text", new float[] { 0.9f, 0.8f, 0.7f, 0.6f, 0.5f, 0.4f, 0.3f, 0.2f }) - } - } - ); + client.create_shard_key("{collection_name}", "{shard_key}") - /collections/{collection_name}/points/vectors/delete: +' + language: python + - code-samples: + - code: "import static io.qdrant.client.ShardKeyFactory.shardKey;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Collections.CreateShardKey;\nimport io.qdrant.client.grpc.Collections.CreateShardKeyRequest;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.createShardKeyAsync(CreateShardKeyRequest.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .setRequest(CreateShardKey.newBuilder()\n .setShardKey(shardKey(\"{shard_key}\"))\n .build())\n .build()).get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({\n host: \"localhost\",\n port: 6333\n});\n\nclient.createShardKey(\"{collection_name}\", {\n shard_key: \"{shard_key}\"\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::shard_key::Key};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .create_shard_key(\n \"{collection_name}\",\n &Key::Keyword(\"{shard_key\".to_string()),\n None,\n None,\n &[],\n )\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.CreateShardKeyAsync(\n \"{collection_name}\",\n new CreateShardKey { ShardKey = new ShardKey { Keyword = \"{shard_key}\", } }\n);\n" + language: csharp + /collections/{collection_name}/shards/delete: post: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.delete_vectors( - collection_name="{collection_name}", - points=[0, 3, 100], - vectors=["text", "image"], - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); + - code: 'from qdrant_client import QdrantClient - client.deleteVectors("{collection_name}", { - points: [0, 3, 10], - vectors: ["text", "image"], - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::{ - points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector, VectorsSelector, - }}; - let client = QdrantClient::from_url("http://localhost:6334").build()?; - - client - .delete_vectors_blocking( - "{collection_name}", - None, - &PointsSelector { - points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList { - ids: vec![0.into(), 3.into(), 10.into()], - })), - }, - &VectorsSelector { - names: vec!["text".into(), "image".into()], - }, - None, - ) - .await?; - - language: java - code: | - import static io.qdrant.client.PointIdFactory.id; - - import java.util.List; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .deleteVectorsAsync( - "{collection_name}", List.of("text", "image"), List.of(id(0), id(3), id(10))) - .get(); - - language: csharp - code: | - using Qdrant.Client; + client = QdrantClient(url="http://localhost:6333") - var client = new QdrantClient("localhost", 6334); - await client.DeleteVectorsAsync("{collection_name}", ["text", "image"], [0, 3, 10]); + client.delete_shard_key("{collection_name}", "{shard_key}") - /collections/{collection_name}/points/payload: - post: +' + language: python + - code-samples: + - code: "import static io.qdrant.client.ShardKeyFactory.shardKey;\n\nimport io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nimport io.qdrant.client.grpc.Collections.DeleteShardKey;\nimport io.qdrant.client.grpc.Collections.DeleteShardKeyRequest;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.deleteShardKeyAsync(DeleteShardKeyRequest.newBuilder()\n .setCollectionName(\"{collection_name}\")\n .setRequest(DeleteShardKey.newBuilder()\n .setShardKey(shardKey(\"{shard_key}\"))\n .build())\n .build()).get();\n" + language: java + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({\n host: \"localhost\",\n port: 6333\n});\n\nclient.deleteShardKey(\"{collection_name}\", {\n shard_key: \"{shard_key}\"\n});\n" + language: typescript + - code-samples: + - code: "use qdrant_client::{client::QdrantClient, qdrant::shard_key::Key};\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .delete_shard_key(\"{collection_name}\", &Key::Keyword(\"{shard_key\".to_string()))\n .await?;\n" + language: rust + - code-samples: + - code: "using Qdrant.Client;\nusing Qdrant.Client.Grpc;\n\nvar client = new QdrantClient(\"localhost\", 6334);\n\nawait client.DeleteShardKeyAsync(\n \"{collection_name}\",\n new DeleteShardKey { ShardKey = new ShardKey { Keyword = \"shard_key\", } }\n);\n" + language: csharp + /collections/{collection_name}/snapshots: + get: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.set_payload( - collection_name="{collection_name}", - payload={ - "property1": "string", - "property2": "string", - }, - points=[0, 3, 10], - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.setPayload("{collection_name}", { - payload: { - property1: "string", - property2: "string", - }, - points: [0, 3, 10], - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::{ - points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector, - }}; + - code: 'from qdrant_client import QdrantClient - let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .set_payload_blocking( - "{collection_name}", - None, - &PointsSelector { - points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList { - ids: vec![0.into(), 3.into(), 10.into()], - })), - }, - json!({ - "property1": "string", - "property2": "string", - }) - .try_into() - .unwrap(), - None, - ) - .await?; - - language: java - code: | - import static io.qdrant.client.PointIdFactory.id; - import static io.qdrant.client.ValueFactory.value; - - import java.util.List; - import java.util.Map; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .setPayloadAsync( - "{collection_name}", - Map.of("property1", value("string"), "property2", value("string")), - List.of(id(0), id(3), id(10)), - true, - null, - null) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; + client = QdrantClient(url="http://localhost:6333") - var client = new QdrantClient("localhost", 6334); - await client.SetPayloadAsync( - collectionName: "{collection_name}", - payload: new Dictionary { { "property1", "string" }, { "property2", "string" } }, - ids: new ulong[] { 0, 3, 10 } - ); + client.list_snapshots(collection_name="{collection_name}") - put: - x-fern-examples: +' + language: python - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.listSnapshotAsync(\"{collection_name}\").get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - client.overwrite_payload( - collection_name="{collection_name}", - payload={ - "property1": "string", - "property2": "string", - }, - points=[0, 3, 10], - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; const client = new QdrantClient({ host: "localhost", port: 6333 }); - client.overwritePayload("{collection_name}", { - payload: { - property1: "string", - property2: "string", - }, - points: [0, 3, 10], - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::{ - points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector, - }}; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; - - client - .overwrite_payload_blocking( - "{collection_name}", - None, - &PointsSelector { - points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList { - ids: vec![0.into(), 3.into(), 10.into()], - })), - }, - json!({ - "property1": "string", - "property2": "string", - }) - .try_into() - .unwrap(), - None, - ) - .await?; - - language: java - code: | - import java.util.List; - - import static io.qdrant.client.PointIdFactory.id; - import static io.qdrant.client.ValueFactory.value; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .overwritePayloadAsync( - "{collection_name}", - Map.of("property1", value("string"), "property2", value("string")), - List.of(id(0), id(3), id(10)), - true, - null, - null) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; - var client = new QdrantClient("localhost", 6334); - - await client.OverwritePayloadAsync( - collectionName: "{collection_name}", - payload: new Dictionary { { "property1", "string" }, { "property2", "string" } }, - ids: new ulong[] { 0, 3, 10 } - ); + client.listSnapshots("{collection_name}"); - /collections/{collection_name}/points/payload/delete: - post: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") + - code: 'use qdrant_client::client::QdrantClient; - client.delete_payload( - collection_name="{collection_name}", - keys=["color", "price"], - points=[0, 3, 100], - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.deletePayload("{collection_name}", { - keys: ["color", "price"], - points: [0, 3, 100], - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::{ - points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector, - }}; let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .delete_payload_blocking( - "{collection_name}", - None, - &PointsSelector { - points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList { - ids: vec![0.into(), 3.into(), 100.into()], - })), - }, - vec!["color".to_string(), "price".to_string()], - None, - ) - .await?; - - language: java - code: | - import java.util.List; - - import static io.qdrant.client.PointIdFactory.id; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .deletePayloadAsync( - "{collection_name}", - List.of("color", "price"), - List.of(id(0), id(3), id(100)), - true, - null, - null) - .get(); - - language: csharp - code: | - using Qdrant.Client; - - var client = new QdrantClient("localhost", 6334); - await client.DeletePayloadAsync("{collection_name}", ["color", "price"], [0, 3, 10]); + client.list_snapshots("{collection_name}").await?; - /collections/{collection_name}/points/payload/clear: - post: - x-fern-examples: +' + language: rust - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") + - code: 'using Qdrant.Client; - client.clear_payload( - collection_name="{collection_name}", - points_selector=[0, 3, 100], - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.clearPayload("{collection_name}", { - points: [0, 3, 100], - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::{ - points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector, - }}; - - let client = QdrantClient::from_url("http://localhost:6334").build()?; - - client - .clear_payload( - "{collection_name}", - None, - Some(PointsSelector { - points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList { - ids: vec![0.into(), 3.into(), 100.into()], - })), - }), - None, - ) - .await?; - - language: java - code: | - import java.util.List; - - import static io.qdrant.client.PointIdFactory.id; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.clearPayloadAsync("{collection_name}", List.of(id(0), id(3), id(100)), null, null, null) - .get(); - - language: csharp - code: | - using Qdrant.Client; var client = new QdrantClient("localhost", 6334); - await client.ClearPayloadAsync("{collection_name}", [0, 3, 10]); - /collections/{collection_name}/points/batch: + await client.ListSnapshotsAsync("{collection_name}"); + +' + language: csharp post: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models + - code: 'from qdrant_client import QdrantClient + client = QdrantClient(url="http://localhost:6333") - client.batch_update_points( - collection_name="{collection_name}", - update_operations=[ - models.UpsertOperation( - upsert=models.PointsList( - points=[ - models.PointStruct( - id=1, - vector=[1.0, 2.0, 3.0, 4.0], - payload={}, - ), - ] - ) - ), - models.UpdateVectorsOperation( - update_vectors=models.UpdateVectors( - points=[ - models.PointVectors( - id=1, - vector=[1.0, 2.0, 3.0, 4.0], - ) - ] - ) - ), - models.SetPayloadOperation( - set_payload=models.SetPayload( - payload={ - "test_payload_2": 2, - "test_payload_3": 3, - }, - points=[1], - ) - ), - ], - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - const client = new QdrantClient({ host: "localhost", port: 6333 }); + client.create_snapshot(collection_name="{collection_name}") - client.batchUpdate("{collection_name}", { - operations: [ - { - upsert: { - points: [ - { - id: 1, - vector: [1.0, 2.0, 3.0, 4.0], - payload: {}, - }, - ], - }, - }, - { - update_vectors: { - points: [ - { - id: 1, - vector: [1.0, 2.0, 3.0, 4.0], - }, - ], - }, - }, - { - set_payload: { - payload: { - test_payload_2: 2, - test_payload_3: 3, - }, - points: [1], - }, - }, - ], - }); - - language: rust - code: | - use qdrant_client::qdrant::{ - points_selector::PointsSelectorOneOf, - points_update_operation::{ - Operation, PointStructList, SetPayload, UpdateVectors, - }, - PointStruct, PointVectors, PointsIdsList, PointsSelector, PointsUpdateOperation, - }; +' + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.createSnapshotAsync(\"{collection_name}\").get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .batch_updates_blocking( - "{collection_name}", - &[ - PointsUpdateOperation { - operation: Some(Operation::Upsert(PointStructList { - points: vec![PointStruct::new( - 1, - vec![1.0, 2.0, 3.0, 4.0], - json!({}).try_into().unwrap(), - )], - ..Default::default() - })), - }, - PointsUpdateOperation { - operation: Some(Operation::UpdateVectors(UpdateVectors { - points: vec![PointVectors { - id: Some(1.into()), - vectors: Some(vec![1.0, 2.0, 3.0, 4.0].into()), - }], - ..Default::default() - })), - }, - PointsUpdateOperation { - operation: Some(Operation::OverwritePayload(SetPayload { - points_selector: Some(PointsSelector { - points_selector_one_of: Some(PointsSelectorOneOf::Points( - PointsIdsList { - ids: vec![1.into()], - }, - )), - }), - payload: HashMap::from([("test_payload".to_string(), 1.into())]), - ..Default::default() - })), - }, - ], - None, - ) - .await?; - - language: java - code: | - import java.util.List; - import java.util.Map; - - import static io.qdrant.client.PointIdFactory.id; - import static io.qdrant.client.ValueFactory.value; - import static io.qdrant.client.VectorsFactory.vectors; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.PointStruct; - import io.qdrant.client.grpc.Points.PointVectors; - import io.qdrant.client.grpc.Points.PointsIdsList; - import io.qdrant.client.grpc.Points.PointsSelector; - import io.qdrant.client.grpc.Points.PointsUpdateOperation; - import io.qdrant.client.grpc.Points.PointsUpdateOperation.PointStructList; - import io.qdrant.client.grpc.Points.PointsUpdateOperation.SetPayload; - import io.qdrant.client.grpc.Points.PointsUpdateOperation.UpdateVectors; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .batchUpdateAsync( - "{collection_name}", - List.of( - PointsUpdateOperation.newBuilder() - .setUpsert( - PointStructList.newBuilder() - .addPoints( - PointStruct.newBuilder() - .setId(id(1)) - .setVectors(vectors( - 1.0 f, - 2.0 f, - 3.0 f, - 4.0 f)) - .build()) - .build()) - .build(), - PointsUpdateOperation.newBuilder() - .setUpdateVectors( - UpdateVectors.newBuilder() - .addPoints( - PointVectors.newBuilder() - .setId(id(1)) - .setVectors(vectors( - 1.0 f, - 2.0 f, - 3.0 f, - 4.0 f)) - .build()) - .build()) - .build(), - PointsUpdateOperation.newBuilder() - .setSetPayload( - SetPayload.newBuilder() - .setPointsSelector( - PointsSelector.newBuilder() - .setPoints(PointsIdsList - .newBuilder() - .addIds(id(1)) - .build()) - .build()) - .putAllPayload( - Map.of("test_payload_2", - value(2), - "test_payload_3", - value(3))) - .build()) - .build())) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; + const client = new QdrantClient({ host: "localhost", port: 6333 }); - var client = new QdrantClient("localhost", 6334); - await client.UpdateBatchAsync( - "{collection_name}", - [ - new() - { - Upsert = new() - { - Points = - { - new PointStruct { Id = 1, Vectors = new[] { 0.9f, 0.1f, 0.1f } }, - } - } - }, - new() - { - UpdateVectors = new() - { - Points = - { - new PointVectors { Id = 1, Vectors = new[] { 0.9f, 0.1f, 0.1f } }, - } - } - }, - new() - { - SetPayload = new() - { - PointsSelector = new PointsSelector { Points = new PointsIdsList { Ids = { 1 } } }, - Payload = { ["test_payload_2"] = 2, ["test_payload_3"] = 3 } - } - } - ] - ); + client.createSnapshot("{collection_name}"); - /collections/{collection_name}/points/scroll: - post: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models - - client = QdrantClient(url="http://localhost:6333") + - code: 'use qdrant_client::client::QdrantClient; - client.scroll( - collection_name="{collection_name}", - scroll_filter=models.Filter( - must=[ - models.FieldCondition(key="color", match=models.MatchValue(value="red")), - ] - ), - limit=1, - with_payload=True, - with_vectors=False, - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.scroll("{collection_name}", { - filter: { - must: [ - { - key: "color", - match: { - value: "red", - }, - }, - ], - }, - limit: 1, - with_payload: true, - with_vector: false, - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::{Condition, Filter, ScrollPoints}}; let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .scroll(&ScrollPoints { - collection_name: "{collection_name}".to_string(), - filter: Some(Filter::must([Condition::matches( - "color", - "red".to_string(), - )])), - limit: Some(1), - with_payload: Some(true.into()), - with_vectors: Some(false.into()), - ..Default::default() - }) - .await?; - - language: java - code: | - import static io.qdrant.client.ConditionFactory.matchKeyword; - import static io.qdrant.client.WithPayloadSelectorFactory.enable; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.Filter; - import io.qdrant.client.grpc.Points.ScrollPoints; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .scrollAsync( - ScrollPoints.newBuilder() - .setCollectionName("{collection_name}") - .setFilter(Filter.newBuilder().addMust(matchKeyword("color", "red")).build()) - .setLimit(1) - .setWithPayload(enable(true)) - .build()) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using static Qdrant.Client.Grpc.Conditions; - - var client = new QdrantClient("localhost", 6334); - await client.ScrollAsync( - collectionName: "{collection_name}", - filter: MatchKeyword("color", "red"), - limit: 1, - payloadSelector: true - ); + client.create_snapshot("{collection_name}").await?; - /collections/{collection_name}/points/search: - post: - x-fern-examples: +' + language: rust - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models - - client = QdrantClient(url="http://localhost:6333") - - client.search( - collection_name="{collection_name}", - query_filter=models.Filter( - must=[ - models.FieldCondition( - key="city", - match=models.MatchValue( - value="London", - ), - ) - ] - ), - query_vector=[0.2, 0.1, 0.9, 0.7], - limit=3, - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; + - code: 'using Qdrant.Client; - const client = new QdrantClient({ host: "localhost", port: 6333 }); - - client.search("{collection_name}", { - filter: { - must: [ - { - key: "city", - match: { - value: "London", - }, - }, - ], - }, - vector: [0.2, 0.1, 0.9, 0.7], - limit: 3, - }); - - language: rust - code: | - use qdrant_client::{ - client::QdrantClient, - qdrant::{Condition, Filter, SearchParams, SearchPoints}, - }; - let client = QdrantClient::from_url("http://localhost:6334").build()?; + var client = new QdrantClient("localhost", 6334); - client - .search_points(&SearchPoints { - collection_name: "{collection_name}".to_string(), - filter: Some(Filter::must([Condition::matches( - "city", - "London".to_string(), - )])), - params: Some(SearchParams { - hnsw_ef: Some(128), - exact: Some(false), - ..Default::default() - }), - vector: vec![0.2, 0.1, 0.9, 0.7], - limit: 3, - ..Default::default() - }) - .await?; - - language: java - code: | - import static io.qdrant.client.ConditionFactory.matchKeyword; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.Filter; - import io.qdrant.client.grpc.Points.SearchPoints; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .searchAsync( - SearchPoints.newBuilder() - .setCollectionName("{collection_name}") - .setFilter(Filter.newBuilder().addMust(matchKeyword("city", "London")).build()) - .addAllVector(List.of(0.2f, 0.1f, 0.9f, 0.7f)) - .setLimit(3) - .build()) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using static Qdrant.Client.Grpc.Conditions; - var client = new QdrantClient("localhost", 6334); + await client.CreateSnapshotAsync("{collection_name}"); - await client.SearchAsync( - collectionName: "{collection_name}", - vector: new float[] { 0.2f, 0.1f, 0.9f, 0.7f }, - filter: MatchKeyword("city", "London"), - limit: 3 - ); - - /collections/{collection_name}/points/search/batch: - post: +' + language: csharp + /collections/{collection_name}/snapshots/recover: + put: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models - - client = QdrantClient(url="http://localhost:6333") + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.recover_snapshot(\n \"{collection_name}\",\n \"http://example.com/path/to/snapshot.shapshot\",\n)\n" + language: python + - code-samples: + - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.recoverSnapshot(\"{collection_name}\", {\n location: \"http://example.com/path/to/snapshot.shapshot\",\n});\n" + language: typescript + /collections/{collection_name}/snapshots/{snapshot_name}: + delete: + x-fern-examples: + - code-samples: + - code: "from qdrant_client import QdrantClient\n\nclient = QdrantClient(url=\"http://localhost:6333\")\n\nclient.delete_snapshot(\n collection_name=\"{collection_name}\", snapshot_name=\"{snapshot_name}\"\n)\n" + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.deleteSnapshotAsync(\"{collection_name}\", \"{snapshot_name}\").get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - filter_ = models.Filter( - must=[ - models.FieldCondition( - key="city", - match=models.MatchValue( - value="London", - ), - ) - ] - ) - - search_queries = [ - models.SearchRequest(vector=[0.2, 0.1, 0.9, 0.7], filter=filter_, limit=3), - models.SearchRequest(vector=[0.5, 0.3, 0.2, 0.3], filter=filter_, limit=3), - ] - - client.search_batch(collection_name="{collection_name}", requests=search_queries) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; const client = new QdrantClient({ host: "localhost", port: 6333 }); - const filter = { - must: [ - { - key: "city", - match: { - value: "London", - }, - }, - ], - }; - - const searches = [ - { - vector: [0.2, 0.1, 0.9, 0.7], - filter, - limit: 3, - }, - { - vector: [0.5, 0.3, 0.2, 0.3], - filter, - limit: 3, - }, - ]; - - client.searchBatch("{collection_name}", { - searches, - }); - - language: rust - code: | - use qdrant_client::{ - client::QdrantClient, - qdrant::{Condition, Filter, SearchBatchPoints, SearchPoints}, - }; - let client = QdrantClient::from_url("http://localhost:6334").build()?; + client.deleteSnapshot("{collection_name}", "{snapshot_name}"); + +' + language: typescript + - code-samples: + - code: "use qdrant_client::client::QdrantClient;\n\nlet client = QdrantClient::from_url(\"http://localhost:6334\").build()?;\n\nclient\n .delete_snapshot(\"{collection_name}\", \"{snapshot_name}\")\n .await?;\n" + language: rust + - code-samples: + - code: 'using Qdrant.Client; - let filter = Filter::must([Condition::matches("city", "London".to_string())]); - - let searches = vec![ - SearchPoints { - collection_name: "{collection_name}".to_string(), - vector: vec![0.2, 0.1, 0.9, 0.7], - filter: Some(filter.clone()), - limit: 3, - ..Default::default() - }, - SearchPoints { - collection_name: "{collection_name}".to_string(), - vector: vec![0.5, 0.3, 0.2, 0.3], - filter: Some(filter), - limit: 3, - ..Default::default() - }, - ]; - - client - .search_batch_points(&SearchBatchPoints { - collection_name: "{collection_name}".to_string(), - search_points: searches, - read_consistency: None, - ..Default::default() - }) - .await?; - - language: java - code: | - import java.util.List; - - import static io.qdrant.client.ConditionFactory.matchKeyword; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.Filter; - import io.qdrant.client.grpc.Points.SearchPoints; - - QdrantClient client = - new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - Filter filter = Filter.newBuilder().addMust(matchKeyword("city", "London")).build(); - List searches = - List.of( - SearchPoints.newBuilder() - .addAllVector(List.of(0.2f, 0.1f, 0.9f, 0.7f)) - .setFilter(filter) - .setLimit(3) - .build(), - SearchPoints.newBuilder() - .addAllVector(List.of(0.5f, 0.3f, 0.2f, 0.3f)) - .setFilter(filter) - .setLimit(3) - .build()); - client.searchBatchAsync("{collection_name}", searches, null).get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; - using static Qdrant.Client.Grpc.Conditions; var client = new QdrantClient("localhost", 6334); - var filter = MatchKeyword("city", "London"); - - var searches = new List - { - new() - { - Vector = { new float[] { 0.2f, 0.1f, 0.9f, 0.7f } }, - Filter = filter, - Limit = 3 - }, - new() - { - Vector = { new float[] { 0.5f, 0.3f, 0.2f, 0.3f } }, - Filter = filter, - Limit = 3 - } - }; - - await client.SearchBatchAsync(collectionName: "{collection_name}", searches: searches); - /collections/{collection_name}/points/search/groups: - post: + await client.DeleteSnapshotAsync("{collection_name}", "{snapshot_name}"); + +' + language: csharp + /snapshots: + get: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient + - code: 'from qdrant_client import QdrantClient + client = QdrantClient(url="http://localhost:6333") - client.search_groups( - collection_name="{collection_name}", - query_vector=[1.1], - group_by="document_id", - limit=4, - group_size=2, - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - const client = new QdrantClient({ host: "localhost", port: 6333 }); + client.list_full_snapshots() - client.searchPointGroups("{collection_name}", { - vector: [1.1], - group_by: "document_id", - limit: 4, - group_size: 2, - }); - - language: rust - code: | - use qdrant_client::{ - client::QdrantClient, - qdrant::SearchPointGroups, - }; +' + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.listFullSnapshotAsync().get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .search_groups(&SearchPointGroups { - collection_name: "{collection_name}".to_string(), - vector: vec![1.1], - group_by: "document_id".to_string(), - limit: 4, - group_size: 2, - ..Default::default() - }) - .await?; - - language: java - code: | - import java.util.List; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.SearchPointGroups; - - QdrantClient client = new QdrantClient( - QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .searchGroupsAsync( - SearchPointGroups.newBuilder() - .setCollectionName("{collection_name}") - .addAllVector(List.of(1.1f)) - .setGroupBy("document_id") - .setLimit(4) - .setGroupSize(2) - .build()) - .get(); - - language: csharp - code: | - using Qdrant.Client; + const client = new QdrantClient({ host: "localhost", port: 6333 }); - var client = new QdrantClient("localhost", 6334); - await client.SearchGroupsAsync( - collectionName: "{collection_name}", - vector: new float[] { 1.1f }, - groupBy: "document_id", - limit: 4, - groupSize: 2 - ); + client.listFullSnapshots(); - /collections/{collection_name}/points/recommend: - post: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models + - code: 'use qdrant_client::client::QdrantClient; - client = QdrantClient(url="http://localhost:6333") - client.recommend( - collection_name="{collection_name}", - positive=[100, 231], - negative=[718, [0.2, 0.3, 0.4, 0.5]], - strategy=models.RecommendStrategy.AVERAGE_VECTOR, - query_filter=models.Filter( - must=[ - models.FieldCondition( - key="city", - match=models.MatchValue( - value="London", - ), - ) - ] - ), - limit=3, - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; + let client = QdrantClient::from_url("http://localhost:6334").build()?; - const client = new QdrantClient({ host: "localhost", port: 6333 }); - client.recommend("{collection_name}", { - positive: [100, 231], - negative: [718, [0.2, 0.3, 0.4, 0.5]], - strategy: "average_vector", - filter: { - must: [ - { - key: "city", - match: { - value: "London", - }, - }, - ], - }, - limit: 3, - }); - - language: rust - code: | - use qdrant_client::{ - client::QdrantClient, - qdrant::{Condition, Filter, RecommendPoints, RecommendStrategy}, - }; + client.list_full_snapshots().await?; - let client = QdrantClient::from_url("http://localhost:6334").build()?; +' + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client - .recommend(&RecommendPoints { - collection_name: "{collection_name}".to_string(), - positive: vec![100.into(), 200.into()], - positive_vectors: vec![vec![100.0, 231.0].into()], - negative: vec![718.into()], - negative_vectors: vec![vec![0.2, 0.3, 0.4, 0.5].into()], - strategy: Some(RecommendStrategy::AverageVector.into()), - filter: Some(Filter::must([Condition::matches( - "city", - "London".to_string(), - )])), - limit: 3, - ..Default::default() - }) - .await?; - - language: java - code: | - import java.util.List; - - import static io.qdrant.client.ConditionFactory.matchKeyword; - import static io.qdrant.client.PointIdFactory.id; - import static io.qdrant.client.VectorFactory.vector; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.Filter; - import io.qdrant.client.grpc.Points.RecommendPoints; - import io.qdrant.client.grpc.Points.RecommendStrategy; - - QdrantClient client = - new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .recommendAsync( - RecommendPoints.newBuilder() - .setCollectionName("{collection_name}") - .addAllPositive(List.of(id(100), id(200))) - .addAllPositiveVectors(List.of(vector(100.0f, 231.0f))) - .addAllNegative(List.of(id(718))) - .addAllPositiveVectors(List.of(vector(0.2f, 0.3f, 0.4f, 0.5f))) - .setStrategy(RecommendStrategy.AverageVector) - .setFilter(Filter.newBuilder().addMust(matchKeyword("city", "London"))) - .setLimit(3) - .build()) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; - using static Qdrant.Client.Grpc.Conditions; var client = new QdrantClient("localhost", 6334); - await client.RecommendAsync( - "{collection_name}", - positive: new ulong[] { 100, 231 }, - negative: new ulong[] { 718 }, - filter: MatchKeyword("city", "London"), - limit: 3 - ); - /collections/{collection_name}/points/recommend/batch: + await client.ListFullSnapshotsAsync(); + +' + language: csharp post: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models + - code: 'from qdrant_client import QdrantClient - client = QdrantClient(url="http://localhost:6333") - recommend_queries = [ - models.RecommendRequest( - positive=[100, 231], negative=[718], filter=filter_, limit=3 - ), - models.RecommendRequest(positive=[200, 67], negative=[300], limit=3), - ] + client = QdrantClient(url="http://localhost:6333") - client.recommend_batch(collection_name="{collection_name}", requests=recommend_queries) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - const client = new QdrantClient({ host: "localhost", port: 6333 }); + client.create_full_snapshot() - const searches = [ - { - positive: [100, 231], - negative: [718], - limit: 3, - }, - { - positive: [200, 67], - negative: [300], - limit: 3, - }, - ]; - - client.recommend_batch("{collection_name}", { - searches, - }); - - language: rust - code: | - use qdrant_client::{ - client::QdrantClient, - qdrant::{Condition, Filter, RecommendBatchPoints, RecommendPoints}, - }; +' + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.createFullSnapshotAsync().get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - let client = QdrantClient::from_url("http://localhost:6334").build()?; - let filter = Filter::must([Condition::matches("city", "London".to_string())]); - - let recommend_queries = vec![ - RecommendPoints { - collection_name: "{collection_name}".to_string(), - positive: vec![100.into(), 231.into()], - negative: vec![718.into()], - filter: Some(filter.clone()), - limit: 3, - ..Default::default() - }, - RecommendPoints { - collection_name: "{collection_name}".to_string(), - positive: vec![200.into(), 67.into()], - negative: vec![300.into()], - filter: Some(filter), - limit: 3, - ..Default::default() - }, - ]; - - client - .recommend_batch(&RecommendBatchPoints { - collection_name: "{collection_name}".to_string(), - recommend_points: recommend_queries, - ..Default::default() - }) - .await?; - - language: java - code: | - import java.util.List; - - import static io.qdrant.client.ConditionFactory.matchKeyword; - import static io.qdrant.client.PointIdFactory.id; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.Filter; - import io.qdrant.client.grpc.Points.RecommendPoints; - - QdrantClient client = - new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - Filter filter = Filter.newBuilder().addMust(matchKeyword("city", "London")).build(); - - List recommendQueries = - List.of( - RecommendPoints.newBuilder() - .addAllPositive(List.of(id(100), id(231))) - .addAllNegative(List.of(id(718))) - .setFilter(filter) - .setLimit(3) - .build(), - RecommendPoints.newBuilder() - .addAllPositive(List.of(id(200), id(67))) - .addAllNegative(List.of(id(300))) - .setFilter(filter) - .setLimit(3) - .build()); - - client.recommendBatchAsync("{collection_name}", recommendQueries, null).get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; - using static Qdrant.Client.Grpc.Conditions; + const client = new QdrantClient({ host: "localhost", port: 6333 }); - var client = new QdrantClient("localhost", 6334); - var filter = MatchKeyword("city", "london"); - - await client.RecommendBatchAsync( - collectionName: "{collection_name}", - recommendSearches: - [ - new() - { - CollectionName = "{collection_name}", - Positive = { new PointId[] { 100, 231 } }, - Negative = { new PointId[] { 718 } }, - Limit = 3, - Filter = filter, - }, - new() - { - CollectionName = "{collection_name}", - Positive = { new PointId[] { 200, 67 } }, - Negative = { new PointId[] { 300 } }, - Limit = 3, - Filter = filter, - } - ] - ); + client.createFullSnapshot(); - /collections/{collection_name}/points/recommend/groups: - post: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models + - code: 'use qdrant_client::client::QdrantClient; - client = QdrantClient(url="http://localhost:6333") - client.recommend_groups( - collection_name="{collection_name}", - positive=[100, 231], - negative=[718], - group_by="document_id", - limit=3, - group_size=2, - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; + let client = QdrantClient::from_url("http://localhost:6334").build()?; - const client = new QdrantClient({ host: "localhost", port: 6333 }); - client.recommendPointGroups("{collection_name}", { - positive: [100, 231], - negative: [718], - group_by: "document_id", - limit: 3, - group_size: 2, - }); - - language: rust - code: | - use qdrant_client::{ - client::QdrantClient, - qdrant::{RecommendPointGroups, RecommendStrategy}, - }; + client.create_full_snapshot().await?; - let client = QdrantClient::from_url("http://localhost:6334").build()?; +' + language: rust + - code-samples: + - code: 'using Qdrant.Client; - client - .recommend_groups(&RecommendPointGroups { - collection_name: "{collection_name}".to_string(), - group_by: "document_id".to_string(), - group_size: 2, - positive: vec![100.into(), 200.into()], - negative: vec![718.into()], - strategy: Some(RecommendStrategy::AverageVector.into()), - limit: 3, - ..Default::default() - }) - .await?; - - language: java - code: | - import static io.qdrant.client.PointIdFactory.id; - - import java.util.List; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.RecommendPointGroups; - import io.qdrant.client.grpc.Points.RecommendStrategy; - - QdrantClient client = - new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client.recommendGroupsAsync(RecommendPointGroups.newBuilder() - .setCollectionName("{collection_name}") - .setGroupBy("document_id") - .setGroupSize(2) - .addAllPositive(List.of(id(100), id(200))) - .addAllNegative(List.of(id(718))) - .setStrategy(RecommendStrategy.AverageVector) - .setLimit(3) - .build()); - - language: csharp - code: | - using Qdrant.Client; - using static Qdrant.Client.Grpc.Conditions; var client = new QdrantClient("localhost", 6334); - await client.RecommendGroupsAsync( - "{collection_name}", - "document_id", - groupSize: 3, - positive: new ulong[] { 100, 231 }, - negative: new ulong[] { 718 }, - filter: MatchKeyword("city", "London"), - limit: 3 - ); - /collections/{collection_name}/points/discover: - post: + await client.CreateFullSnapshotAsync(); + +' + language: csharp + /snapshots/{snapshot_name}: + delete: x-fern-examples: - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models + - code: 'from qdrant_client import QdrantClient + client = QdrantClient(url="http://localhost:6333") - client.discover( - "{collection_name}", - target=[0.2, 0.1, 0.9, 0.7], - context=[ - models.ContextExamplePair(positive=100, negative=718), - models.ContextExamplePair(positive=200, negative=300), - ], - limit=10, - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - const client = new QdrantClient({ host: "localhost", port: 6333 }); + client.delete_full_snapshot(snapshot_name="{snapshot_name}") - client.discover("{collection_name}", { - target: [0.2, 0.1, 0.9, 0.7], - context: [ - { - positive: 100, - negative: 718, - }, - { - positive: 200, - negative: 300, - }, - ], - limit: 10, - }); - - language: rust - code: | - use qdrant_client::{ - client::QdrantClient, - qdrant::{ - target_vector::Target, vector_example::Example, ContextExamplePair, DiscoverPoints, - TargetVector, VectorExample, - }, - }; +' + language: python + - code-samples: + - code: "import io.qdrant.client.QdrantClient;\nimport io.qdrant.client.QdrantGrpcClient;\n\nQdrantClient client = new QdrantClient(\n QdrantGrpcClient.newBuilder(\"localhost\", 6334, false).build());\n\nclient.deleteFullSnapshotAsync(\"{snapshot_name}\").get();\n" + language: java + - code-samples: + - code: 'import { QdrantClient } from "@qdrant/js-client-rest"; - let client = QdrantClient::from_url("http://localhost:6334").build()?; - client - .discover(&DiscoverPoints { - collection_name: "{collection_name}".to_string(), - target: Some(TargetVector { - target: Some(Target::Single(VectorExample { - example: Some(Example::Vector(vec![0.2, 0.1, 0.9, 0.7].into())), - })), - }), - context: vec![ - ContextExamplePair { - positive: Some(VectorExample { - example: Some(Example::Id(100.into())), - }), - negative: Some(VectorExample { - example: Some(Example::Id(718.into())), - }), - }, - ContextExamplePair { - positive: Some(VectorExample { - example: Some(Example::Id(200.into())), - }), - negative: Some(VectorExample { - example: Some(Example::Id(300.into())), - }), - }, - ], - limit: 10, - ..Default::default() - }) - .await?; - - language: java - code: | - import java.util.List; - - import static io.qdrant.client.PointIdFactory.id; - import static io.qdrant.client.VectorFactory.vector; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.ContextExamplePair; - import io.qdrant.client.grpc.Points.DiscoverPoints; - import io.qdrant.client.grpc.Points.TargetVector; - import io.qdrant.client.grpc.Points.VectorExample; - - QdrantClient client = - new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .discoverAsync( - DiscoverPoints.newBuilder() - .setCollectionName("{collection_name}") - .setTarget( - TargetVector.newBuilder() - .setSingle( - VectorExample.newBuilder() - .setVector(vector(0.2f, 0.1f, 0.9f, 0.7f)) - .build())) - .addAllContext( - List.of( - ContextExamplePair.newBuilder() - .setPositive(VectorExample.newBuilder().setId(id(100))) - .setNegative(VectorExample.newBuilder().setId(id(718))) - .build(), - ContextExamplePair.newBuilder() - .setPositive(VectorExample.newBuilder().setId(id(200))) - .setNegative(VectorExample.newBuilder().setId(id(300))) - .build())) - .setLimit(10) - .build()) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; + const client = new QdrantClient({ host: "localhost", port: 6333 }); - var client = new QdrantClient("localhost", 6334); - await client.DiscoverAsync( - collectionName: "{collection_name}", - target: new TargetVector - { - Single = new VectorExample { Vector = new float[] { 0.2f, 0.1f, 0.9f, 0.7f }, } - }, - context: - [ - new() - { - Positive = new VectorExample { Id = 100 }, - Negative = new VectorExample { Id = 718 } - }, - new() - { - Positive = new VectorExample { Id = 200 }, - Negative = new VectorExample { Id = 300 } - } - ], - limit: 10 - ); + client.deleteFullSnapshot("{snapshot_name}"); - /collections/{collection_name}/points/discover/batch: - post: - x-fern-examples: +' + language: typescript - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient, models - - client = QdrantClient(url="http://localhost:6333") - - discover_queries = [ - models.DiscoverRequest( - target=[0.2, 0.1, 0.9, 0.7], - context=[ - models.ContextExamplePair( - positive=100, - negative=718, - ), - models.ContextExamplePair( - positive=200, - negative=300, - ), - ], - limit=10, - ), - models.DiscoverRequest( - target=[0.5, 0.3, 0.2, 0.3], - context=[ - models.ContextExamplePair( - positive=342, - negative=213, - ), - models.ContextExamplePair( - positive=100, - negative=200, - ), - ], - limit=5, - ), - ] - - client.discover_batch("{collection_name}", discover_queries) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); + - code: 'use qdrant_client::client::QdrantClient; - const searches = [ - { - target: [0.2, 0.1, 0.9, 0.7], - context: [ - { - positive: 100, - negative: 718, - }, - { - positive: 200, - negative: 300, - }, - ], - limit: 10, - }, - { - target: [0.5, 0.3, 0.2, 0.3], - context: [ - { - positive: 342, - negative: 213, - }, - { - positive: 100, - negative: 200, - }, - ], - limit: 5, - }, - ]; - - client.discoverBatchPoints("{collection_name}", { - searches, - }); - - language: rust - code: | - use qdrant_client::{ - client::QdrantClient, - qdrant::{ - target_vector::Target, vector_example::Example, ContextExamplePair, DiscoverBatchPoints, - DiscoverPoints, TargetVector, VectorExample, - }, - }; let client = QdrantClient::from_url("http://localhost:6334").build()?; - let discover_points = &DiscoverBatchPoints { - collection_name: "{collection_name}".to_string(), - discover_points: vec![ - DiscoverPoints { - collection_name: "{collection_name}".to_string(), - target: Some(TargetVector { - target: Some(Target::Single(VectorExample { - example: Some(Example::Vector(vec![0.2, 0.1, 0.9, 0.7].into())), - })), - }), - context: vec![ - ContextExamplePair { - positive: Some(VectorExample { - example: Some(Example::Id(100.into())), - }), - negative: Some(VectorExample { - example: Some(Example::Id(718.into())), - }), - }, - ContextExamplePair { - positive: Some(VectorExample { - example: Some(Example::Id(200.into())), - }), - negative: Some(VectorExample { - example: Some(Example::Id(300.into())), - }), - }, - ], - limit: 10, - ..Default::default() - }, - DiscoverPoints { - collection_name: "{collection_name}".to_string(), - target: Some(TargetVector { - target: Some(Target::Single(VectorExample { - example: Some(Example::Vector(vec![0.5, 0.3, 0.2, 0.3].into())), - })), - }), - context: vec![ - ContextExamplePair { - positive: Some(VectorExample { - example: Some(Example::Id(342.into())), - }), - negative: Some(VectorExample { - example: Some(Example::Id(213.into())), - }), - }, - ContextExamplePair { - positive: Some(VectorExample { - example: Some(Example::Id(100.into())), - }), - negative: Some(VectorExample { - example: Some(Example::Id(200.into())), - }), - }, - ], - limit: 10, - ..Default::default() - }, - ], - ..Default::default() - }; - - client.discover_batch(discover_points).await?; - - language: java - code: | - import static io.qdrant.client.PointIdFactory.id; - import static io.qdrant.client.VectorFactory.vector; - - import java.util.Arrays; - import java.util.List; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.ContextExamplePair; - import io.qdrant.client.grpc.Points.DiscoverPoints; - import io.qdrant.client.grpc.Points.TargetVector; - import io.qdrant.client.grpc.Points.VectorExample; - - QdrantClient client = new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - List discoverPoints = Arrays.asList( - DiscoverPoints.newBuilder() - .setCollectionName("{collection_name}") - .setTarget( - TargetVector.newBuilder() - .setSingle( - VectorExample.newBuilder() - .setVector(vector( - 0.2 f, - 0.1 f, - 0.9 f, - 0.7 f)) - .build())) - .addAllContext( - List.of( - ContextExamplePair.newBuilder() - .setPositive(VectorExample - .newBuilder() - .setId(id(100))) - .setNegative(VectorExample - .newBuilder() - .setId(id(718))) - .build(), - ContextExamplePair.newBuilder() - .setPositive(VectorExample - .newBuilder() - .setId(id(200))) - .setNegative(VectorExample - .newBuilder() - .setId(id(300))) - .build())) - .setLimit(10) - .build(), - DiscoverPoints.newBuilder() - .setCollectionName("{collection_name}") - .setTarget( - TargetVector.newBuilder() - .setSingle( - VectorExample.newBuilder() - .setVector(vector( - 0.5 f, 0.3 f, 0.2 f, 0.3 f)) - .build())) - .addAllContext( - List.of( - ContextExamplePair.newBuilder() - .setPositive(VectorExample - .newBuilder() - .setId(id(342))) - .setNegative(VectorExample - .newBuilder() - .setId(id(213))) - .build(), - ContextExamplePair.newBuilder() - .setPositive(VectorExample - .newBuilder() - .setId(id(100))) - .setNegative(VectorExample - .newBuilder() - .setId(id(200))) - .build())) - .setLimit(10) - .build()); - client.discoverBatchAsync("{collection_name}", discoverPoints, null); - - language: csharp - code: | - using Qdrant.Client; - using Qdrant.Client.Grpc; - - var client = new QdrantClient("localhost", 6334); - var discoverPoints = new List - { - new DiscoverPoints - { - CollectionName = "{collection_name}", - Target = new TargetVector - { - Single = new VectorExample { Vector = new float[] { 0.2f, 0.1f, 0.9f, 0.7f }, } - }, - Context = - { - new ContextExamplePair() - { - Positive = new VectorExample { Id = 100 }, - Negative = new VectorExample { Id = 718 } - }, - new ContextExamplePair() - { - Positive = new VectorExample { Id = 200 }, - Negative = new VectorExample { Id = 300 } - } - }, - Limit = 10 - }, - new DiscoverPoints - { - CollectionName = "{collection_name}", - Target = new TargetVector - { - Single = new VectorExample { Vector = new float[] { 0.5f, 0.3f, 0.2f, 0.3f }, } - }, - Context = - { - new ContextExamplePair() - { - Positive = new VectorExample { Id = 342 }, - Negative = new VectorExample { Id = 213 } - }, - new ContextExamplePair() - { - Positive = new VectorExample { Id = 100 }, - Negative = new VectorExample { Id = 200 } - } - }, - Limit = 10 - } - }; - await client.DiscoverBatchAsync("{collection_name}", discoverPoints); + client.delete_full_snapshot("{snapshot_name}").await?; - /collections/{collection_name}/points/count: - post: - x-fern-examples: +' + language: rust - code-samples: - - language: python - code: | - from qdrant_client import QdrantClient - - client = QdrantClient(url="http://localhost:6333") - - client.count( - collection_name="{collection_name}", - count_filter=models.Filter( - must=[ - models.FieldCondition(key="color", match=models.MatchValue(value="red")), - ] - ), - exact=True, - ) - - language: typescript - code: | - import { QdrantClient } from "@qdrant/js-client-rest"; - - const client = new QdrantClient({ host: "localhost", port: 6333 }); + - code: 'using Qdrant.Client; - client.count("{collection_name}", { - filter: { - must: [ - { - key: "color", - match: { - value: "red", - }, - }, - ], - }, - exact: true, - }); - - language: rust - code: | - use qdrant_client::{client::QdrantClient, qdrant::{Condition, CountPoints, Filter}}; - let client = QdrantClient::from_url("http://localhost:6334").build()?; + var client = new QdrantClient("localhost", 6334); - client - .count(&CountPoints { - collection_name: "{collection_name}".to_string(), - filter: Some(Filter::must([Condition::matches( - "color", - "red".to_string(), - )])), - exact: Some(true), - ..Default::default() - }) - .await?; - - language: java - code: | - import static io.qdrant.client.ConditionFactory.matchKeyword; - - import io.qdrant.client.QdrantClient; - import io.qdrant.client.QdrantGrpcClient; - - import io.qdrant.client.grpc.Points.Filter; - - QdrantClient client = new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); - - client - .countAsync( - "{collection_name}", - Filter.newBuilder().addMust(matchKeyword("color", "red")).build(), - true) - .get(); - - language: csharp - code: | - using Qdrant.Client; - using static Qdrant.Client.Grpc.Conditions; - var client = new QdrantClient("localhost", 6334); + await client.DeleteFullSnapshotAsync("{snapshot_name}"); - await client.CountAsync( - collectionName: "{collection_name}", - filter: MatchKeyword("color", "red"), - exact: true - ); +' + language: csharp diff --git a/fern/openapi-overrides-template.yml b/fern/openapi-overrides-template.yml new file mode 100644 index 0000000..29ff951 --- /dev/null +++ b/fern/openapi-overrides-template.yml @@ -0,0 +1,8 @@ +# +# WARNING: This file is auto-generated. Do not edit this file directly. +# +components: + securitySchemes: + BearerAuth: + type: http + scheme: bearer \ No newline at end of file diff --git a/snippets/csharp/batch_update.cs b/snippets/csharp/batch_update.cs new file mode 100644 index 0000000..6772a27 --- /dev/null +++ b/snippets/csharp/batch_update.cs @@ -0,0 +1,38 @@ +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient("localhost", 6334); + +await client.UpdateBatchAsync( + "{collection_name}", + [ + new() + { + Upsert = new() + { + Points = + { + new PointStruct { Id = 1, Vectors = new[] { 0.9f, 0.1f, 0.1f } }, + } + } + }, + new() + { + UpdateVectors = new() + { + Points = + { + new PointVectors { Id = 1, Vectors = new[] { 0.9f, 0.1f, 0.1f } }, + } + } + }, + new() + { + SetPayload = new() + { + PointsSelector = new PointsSelector { Points = new PointsIdsList { Ids = { 1 } } }, + Payload = { ["test_payload_2"] = 2, ["test_payload_3"] = 3 } + } + } + ] +); diff --git a/snippets/csharp/clear_payload.cs b/snippets/csharp/clear_payload.cs new file mode 100644 index 0000000..f285e9c --- /dev/null +++ b/snippets/csharp/clear_payload.cs @@ -0,0 +1,5 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.ClearPayloadAsync("{collection_name}", [0, 3, 10]); diff --git a/snippets/csharp/count_points.cs b/snippets/csharp/count_points.cs new file mode 100644 index 0000000..09fc33c --- /dev/null +++ b/snippets/csharp/count_points.cs @@ -0,0 +1,10 @@ +using Qdrant.Client; +using static Qdrant.Client.Grpc.Conditions; + +var client = new QdrantClient("localhost", 6334); + +await client.CountAsync( + collectionName: "{collection_name}", + filter: MatchKeyword("color", "red"), + exact: true +); diff --git a/snippets/csharp/create_collection.cs b/snippets/csharp/create_collection.cs new file mode 100644 index 0000000..e69de29 diff --git a/snippets/csharp/create_field_index.cs b/snippets/csharp/create_field_index.cs new file mode 100644 index 0000000..3e8c5ec --- /dev/null +++ b/snippets/csharp/create_field_index.cs @@ -0,0 +1,8 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.CreatePayloadIndexAsync( + collectionName: "{collection_name}", + fieldName: "name_of_the_field_to_index" +); diff --git a/snippets/csharp/create_full_snapshot.cs b/snippets/csharp/create_full_snapshot.cs new file mode 100644 index 0000000..834d0c7 --- /dev/null +++ b/snippets/csharp/create_full_snapshot.cs @@ -0,0 +1,5 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.CreateFullSnapshotAsync(); diff --git a/snippets/csharp/create_shard_key.cs b/snippets/csharp/create_shard_key.cs new file mode 100644 index 0000000..74d7faa --- /dev/null +++ b/snippets/csharp/create_shard_key.cs @@ -0,0 +1,9 @@ +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient("localhost", 6334); + +await client.CreateShardKeyAsync( + "{collection_name}", + new CreateShardKey { ShardKey = new ShardKey { Keyword = "{shard_key}", } } +); diff --git a/snippets/csharp/create_snapshot.cs b/snippets/csharp/create_snapshot.cs new file mode 100644 index 0000000..305540a --- /dev/null +++ b/snippets/csharp/create_snapshot.cs @@ -0,0 +1,5 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.CreateSnapshotAsync("{collection_name}"); diff --git a/snippets/csharp/delete_collection.cs b/snippets/csharp/delete_collection.cs new file mode 100644 index 0000000..3759adf --- /dev/null +++ b/snippets/csharp/delete_collection.cs @@ -0,0 +1,5 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.DeleteCollectionAsync("{collection_name}"); diff --git a/snippets/csharp/delete_field_index.cs b/snippets/csharp/delete_field_index.cs new file mode 100644 index 0000000..2977825 --- /dev/null +++ b/snippets/csharp/delete_field_index.cs @@ -0,0 +1,8 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.DeletePayloadIndexAsync( + collectionName: "{collection_name}", + fieldName: "name_of_the_field_to_index" +); diff --git a/snippets/csharp/delete_full_snapshot.cs b/snippets/csharp/delete_full_snapshot.cs new file mode 100644 index 0000000..cdc69f3 --- /dev/null +++ b/snippets/csharp/delete_full_snapshot.cs @@ -0,0 +1,5 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.DeleteFullSnapshotAsync("{snapshot_name}"); diff --git a/snippets/csharp/delete_payload.cs b/snippets/csharp/delete_payload.cs new file mode 100644 index 0000000..b346b76 --- /dev/null +++ b/snippets/csharp/delete_payload.cs @@ -0,0 +1,5 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.DeletePayloadAsync("{collection_name}", ["color", "price"], [0, 3, 10]); diff --git a/snippets/csharp/delete_points.cs b/snippets/csharp/delete_points.cs new file mode 100644 index 0000000..97cc8eb --- /dev/null +++ b/snippets/csharp/delete_points.cs @@ -0,0 +1,7 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.DeleteAsync(collectionName: "{collection_name}", ids: [0, 3, 100]); + +await client.DeleteAsync(collectionName: "{collection_name}", filter: MatchKeyword("color", "red")); diff --git a/snippets/csharp/delete_shard_key.cs b/snippets/csharp/delete_shard_key.cs new file mode 100644 index 0000000..e7b0270 --- /dev/null +++ b/snippets/csharp/delete_shard_key.cs @@ -0,0 +1,9 @@ +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient("localhost", 6334); + +await client.DeleteShardKeyAsync( + "{collection_name}", + new DeleteShardKey { ShardKey = new ShardKey { Keyword = "shard_key", } } +); diff --git a/snippets/csharp/delete_snapshot.cs b/snippets/csharp/delete_snapshot.cs new file mode 100644 index 0000000..8ebd35f --- /dev/null +++ b/snippets/csharp/delete_snapshot.cs @@ -0,0 +1,5 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.DeleteSnapshotAsync("{collection_name}", "{snapshot_name}"); diff --git a/snippets/csharp/delete_vectors.cs b/snippets/csharp/delete_vectors.cs new file mode 100644 index 0000000..a9bc9ad --- /dev/null +++ b/snippets/csharp/delete_vectors.cs @@ -0,0 +1,5 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.DeleteVectorsAsync("{collection_name}", ["text", "image"], [0, 3, 10]); diff --git a/snippets/csharp/discover_batch_points.cs b/snippets/csharp/discover_batch_points.cs new file mode 100644 index 0000000..3d1e4a7 --- /dev/null +++ b/snippets/csharp/discover_batch_points.cs @@ -0,0 +1,53 @@ +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient("localhost", 6334); + +var discoverPoints = new List +{ + new DiscoverPoints + { + CollectionName = "{collection_name}", + Target = new TargetVector + { + Single = new VectorExample { Vector = new float[] { 0.2f, 0.1f, 0.9f, 0.7f }, } + }, + Context = + { + new ContextExamplePair() + { + Positive = new VectorExample { Id = 100 }, + Negative = new VectorExample { Id = 718 } + }, + new ContextExamplePair() + { + Positive = new VectorExample { Id = 200 }, + Negative = new VectorExample { Id = 300 } + } + }, + Limit = 10 + }, + new DiscoverPoints + { + CollectionName = "{collection_name}", + Target = new TargetVector + { + Single = new VectorExample { Vector = new float[] { 0.5f, 0.3f, 0.2f, 0.3f }, } + }, + Context = + { + new ContextExamplePair() + { + Positive = new VectorExample { Id = 342 }, + Negative = new VectorExample { Id = 213 } + }, + new ContextExamplePair() + { + Positive = new VectorExample { Id = 100 }, + Negative = new VectorExample { Id = 200 } + } + }, + Limit = 10 + } +}; +await client.DiscoverBatchAsync("{collection_name}", discoverPoints); diff --git a/snippets/csharp/discover_points.cs b/snippets/csharp/discover_points.cs new file mode 100644 index 0000000..6f3d4b9 --- /dev/null +++ b/snippets/csharp/discover_points.cs @@ -0,0 +1,26 @@ +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient("localhost", 6334); + +await client.DiscoverAsync( + collectionName: "{collection_name}", + target: new TargetVector + { + Single = new VectorExample { Vector = new float[] { 0.2f, 0.1f, 0.9f, 0.7f }, } + }, + context: + [ + new() + { + Positive = new VectorExample { Id = 100 }, + Negative = new VectorExample { Id = 718 } + }, + new() + { + Positive = new VectorExample { Id = 200 }, + Negative = new VectorExample { Id = 300 } + } + ], + limit: 10 +); diff --git a/snippets/csharp/get_collection.cs b/snippets/csharp/get_collection.cs new file mode 100644 index 0000000..02b3aeb --- /dev/null +++ b/snippets/csharp/get_collection.cs @@ -0,0 +1,5 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.GetCollectionInfoAsync("{collection_name}"); diff --git a/snippets/csharp/get_collection_aliases.cs b/snippets/csharp/get_collection_aliases.cs new file mode 100644 index 0000000..26ef430 --- /dev/null +++ b/snippets/csharp/get_collection_aliases.cs @@ -0,0 +1,5 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.ListCollectionAliasesAsync("{collection_name}"); diff --git a/snippets/csharp/get_collections.cs b/snippets/csharp/get_collections.cs new file mode 100644 index 0000000..39fe0e5 --- /dev/null +++ b/snippets/csharp/get_collections.cs @@ -0,0 +1,5 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.ListCollectionsAsync(); diff --git a/snippets/csharp/get_collections_aliases.cs b/snippets/csharp/get_collections_aliases.cs new file mode 100644 index 0000000..ec546a4 --- /dev/null +++ b/snippets/csharp/get_collections_aliases.cs @@ -0,0 +1,5 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.ListAliasesAsync(); diff --git a/snippets/csharp/get_points.cs b/snippets/csharp/get_points.cs new file mode 100644 index 0000000..7cf4447 --- /dev/null +++ b/snippets/csharp/get_points.cs @@ -0,0 +1,10 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.RetrieveAsync( + collectionName: "{collection_name}", + ids: [0, 30, 100], + withPayload: false, + withVectors: false +); diff --git a/snippets/csharp/list_full_snapshots.cs b/snippets/csharp/list_full_snapshots.cs new file mode 100644 index 0000000..d0e1643 --- /dev/null +++ b/snippets/csharp/list_full_snapshots.cs @@ -0,0 +1,5 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.ListFullSnapshotsAsync(); diff --git a/snippets/csharp/list_snapshots.cs b/snippets/csharp/list_snapshots.cs new file mode 100644 index 0000000..65f3380 --- /dev/null +++ b/snippets/csharp/list_snapshots.cs @@ -0,0 +1,5 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.ListSnapshotsAsync("{collection_name}"); diff --git a/snippets/csharp/overwrite_payload.cs b/snippets/csharp/overwrite_payload.cs new file mode 100644 index 0000000..a5fff52 --- /dev/null +++ b/snippets/csharp/overwrite_payload.cs @@ -0,0 +1,10 @@ +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient("localhost", 6334); + +await client.OverwritePayloadAsync( + collectionName: "{collection_name}", + payload: new Dictionary { { "property1", "string" }, { "property2", "string" } }, + ids: new ulong[] { 0, 3, 10 } +); diff --git a/snippets/csharp/recommend_batch_points.cs b/snippets/csharp/recommend_batch_points.cs new file mode 100644 index 0000000..dec1b79 --- /dev/null +++ b/snippets/csharp/recommend_batch_points.cs @@ -0,0 +1,30 @@ +using Qdrant.Client; +using Qdrant.Client.Grpc; +using static Qdrant.Client.Grpc.Conditions; + +var client = new QdrantClient("localhost", 6334); + +var filter = MatchKeyword("city", "london"); + +await client.RecommendBatchAsync( + collectionName: "{collection_name}", + recommendSearches: + [ + new() + { + CollectionName = "{collection_name}", + Positive = { new PointId[] { 100, 231 } }, + Negative = { new PointId[] { 718 } }, + Limit = 3, + Filter = filter, + }, + new() + { + CollectionName = "{collection_name}", + Positive = { new PointId[] { 200, 67 } }, + Negative = { new PointId[] { 300 } }, + Limit = 3, + Filter = filter, + } + ] +); diff --git a/snippets/csharp/recommend_point_groups.cs b/snippets/csharp/recommend_point_groups.cs new file mode 100644 index 0000000..8f0483c --- /dev/null +++ b/snippets/csharp/recommend_point_groups.cs @@ -0,0 +1,14 @@ +using Qdrant.Client; +using static Qdrant.Client.Grpc.Conditions; + +var client = new QdrantClient("localhost", 6334); + +await client.RecommendGroupsAsync( + "{collection_name}", + "document_id", + groupSize: 3, + positive: new ulong[] { 100, 231 }, + negative: new ulong[] { 718 }, + filter: MatchKeyword("city", "London"), + limit: 3 +); diff --git a/snippets/csharp/recommend_points.cs b/snippets/csharp/recommend_points.cs new file mode 100644 index 0000000..8289df1 --- /dev/null +++ b/snippets/csharp/recommend_points.cs @@ -0,0 +1,13 @@ +using Qdrant.Client; +using Qdrant.Client.Grpc; +using static Qdrant.Client.Grpc.Conditions; + +var client = new QdrantClient("localhost", 6334); + +await client.RecommendAsync( + "{collection_name}", + positive: new ulong[] { 100, 231 }, + negative: new ulong[] { 718 }, + filter: MatchKeyword("city", "London"), + limit: 3 +); diff --git a/snippets/csharp/scroll_points.cs b/snippets/csharp/scroll_points.cs new file mode 100644 index 0000000..31017f0 --- /dev/null +++ b/snippets/csharp/scroll_points.cs @@ -0,0 +1,11 @@ +using Qdrant.Client; +using static Qdrant.Client.Grpc.Conditions; + +var client = new QdrantClient("localhost", 6334); + +await client.ScrollAsync( + collectionName: "{collection_name}", + filter: MatchKeyword("color", "red"), + limit: 1, + payloadSelector: true +); diff --git a/snippets/csharp/search_batch_points.cs b/snippets/csharp/search_batch_points.cs new file mode 100644 index 0000000..6542022 --- /dev/null +++ b/snippets/csharp/search_batch_points.cs @@ -0,0 +1,25 @@ +using Qdrant.Client; +using Qdrant.Client.Grpc; +using static Qdrant.Client.Grpc.Conditions; + +var client = new QdrantClient("localhost", 6334); + +var filter = MatchKeyword("city", "London"); + +var searches = new List +{ + new() + { + Vector = { new float[] { 0.2f, 0.1f, 0.9f, 0.7f } }, + Filter = filter, + Limit = 3 + }, + new() + { + Vector = { new float[] { 0.5f, 0.3f, 0.2f, 0.3f } }, + Filter = filter, + Limit = 3 + } +}; + +await client.SearchBatchAsync(collectionName: "{collection_name}", searches: searches); diff --git a/snippets/csharp/search_point_groups.cs b/snippets/csharp/search_point_groups.cs new file mode 100644 index 0000000..c848565 --- /dev/null +++ b/snippets/csharp/search_point_groups.cs @@ -0,0 +1,11 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.SearchGroupsAsync( + collectionName: "{collection_name}", + vector: new float[] { 1.1f }, + groupBy: "document_id", + limit: 4, + groupSize: 2 +); diff --git a/snippets/csharp/search_points.cs b/snippets/csharp/search_points.cs new file mode 100644 index 0000000..de1d59a --- /dev/null +++ b/snippets/csharp/search_points.cs @@ -0,0 +1,11 @@ +using Qdrant.Client; +using static Qdrant.Client.Grpc.Conditions; + +var client = new QdrantClient("localhost", 6334); + +await client.SearchAsync( + collectionName: "{collection_name}", + vector: new float[] { 0.2f, 0.1f, 0.9f, 0.7f }, + filter: MatchKeyword("city", "London"), + limit: 3 +); diff --git a/snippets/csharp/set_payload.cs b/snippets/csharp/set_payload.cs new file mode 100644 index 0000000..714ef07 --- /dev/null +++ b/snippets/csharp/set_payload.cs @@ -0,0 +1,10 @@ +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient("localhost", 6334); + +await client.SetPayloadAsync( + collectionName: "{collection_name}", + payload: new Dictionary { { "property1", "string" }, { "property2", "string" } }, + ids: new ulong[] { 0, 3, 10 } +); diff --git a/snippets/csharp/update_aliases.cs b/snippets/csharp/update_aliases.cs new file mode 100644 index 0000000..876b87b --- /dev/null +++ b/snippets/csharp/update_aliases.cs @@ -0,0 +1,7 @@ +using Qdrant.Client; + +var client = new QdrantClient("localhost", 6334); + +await client.CreateAliasAsync(aliasName: "production_collection", collectionName: "example_collection"); + +await client.DeleteAliasAsync("production_collection"); diff --git a/snippets/csharp/update_collection.cs b/snippets/csharp/update_collection.cs new file mode 100644 index 0000000..9cecd88 --- /dev/null +++ b/snippets/csharp/update_collection.cs @@ -0,0 +1,9 @@ +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient("localhost", 6334); + +await client.UpdateCollectionAsync( + collectionName: "{collection_name}", + optimizersConfig: new OptimizersConfigDiff { IndexingThreshold = 10000 } +); diff --git a/snippets/csharp/update_vectors.cs b/snippets/csharp/update_vectors.cs new file mode 100644 index 0000000..4b3a27c --- /dev/null +++ b/snippets/csharp/update_vectors.cs @@ -0,0 +1,17 @@ +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient("localhost", 6334); + +await client.UpdateVectorsAsync( + collectionName: "{collection_name}", + points: new List + { + new() { Id = 1, Vectors = ("image", new float[] { 0.1f, 0.2f, 0.3f, 0.4f }) }, + new() + { + Id = 2, + Vectors = ("text", new float[] { 0.9f, 0.8f, 0.7f, 0.6f, 0.5f, 0.4f, 0.3f, 0.2f }) + } + } +); diff --git a/snippets/csharp/upsert_points.cs b/snippets/csharp/upsert_points.cs new file mode 100644 index 0000000..2d8df77 --- /dev/null +++ b/snippets/csharp/upsert_points.cs @@ -0,0 +1,29 @@ +using Qdrant.Client; +using Qdrant.Client.Grpc; + +var client = new QdrantClient("localhost", 6334); + +await client.UpsertAsync( + collectionName: "{collection_name}", + points: new List + { + new() + { + Id = 1, + Vectors = new[] { 0.9f, 0.1f, 0.1f }, + Payload = { ["city"] = "red" } + }, + new() + { + Id = 2, + Vectors = new[] { 0.1f, 0.9f, 0.1f }, + Payload = { ["city"] = "green" } + }, + new() + { + Id = 3, + Vectors = new[] { 0.1f, 0.1f, 0.9f }, + Payload = { ["city"] = "blue" } + } + } +); diff --git a/snippets/java/batch_update.java b/snippets/java/batch_update.java new file mode 100644 index 0000000..74fdea7 --- /dev/null +++ b/snippets/java/batch_update.java @@ -0,0 +1,72 @@ +import java.util.List; +import java.util.Map; + +import static io.qdrant.client.PointIdFactory.id; +import static io.qdrant.client.ValueFactory.value; +import static io.qdrant.client.VectorsFactory.vectors; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +import io.qdrant.client.grpc.Points.PointStruct; +import io.qdrant.client.grpc.Points.PointVectors; +import io.qdrant.client.grpc.Points.PointsIdsList; +import io.qdrant.client.grpc.Points.PointsSelector; +import io.qdrant.client.grpc.Points.PointsUpdateOperation; +import io.qdrant.client.grpc.Points.PointsUpdateOperation.PointStructList; +import io.qdrant.client.grpc.Points.PointsUpdateOperation.SetPayload; +import io.qdrant.client.grpc.Points.PointsUpdateOperation.UpdateVectors; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client + .batchUpdateAsync( + "{collection_name}", + List.of( + PointsUpdateOperation.newBuilder() + .setUpsert( + PointStructList.newBuilder() + .addPoints( + PointStruct.newBuilder() + .setId(id(1)) + .setVectors(vectors( + 1.0 f, + 2.0 f, + 3.0 f, + 4.0 f)) + .build()) + .build()) + .build(), + PointsUpdateOperation.newBuilder() + .setUpdateVectors( + UpdateVectors.newBuilder() + .addPoints( + PointVectors.newBuilder() + .setId(id(1)) + .setVectors(vectors( + 1.0 f, + 2.0 f, + 3.0 f, + 4.0 f)) + .build()) + .build()) + .build(), + PointsUpdateOperation.newBuilder() + .setSetPayload( + SetPayload.newBuilder() + .setPointsSelector( + PointsSelector.newBuilder() + .setPoints(PointsIdsList + .newBuilder() + .addIds(id(1)) + .build()) + .build()) + .putAllPayload( + Map.of("test_payload_2", + value(2), + "test_payload_3", + value(3))) + .build()) + .build())) + .get(); diff --git a/snippets/java/clear_payload.java b/snippets/java/clear_payload.java new file mode 100644 index 0000000..2b4b217 --- /dev/null +++ b/snippets/java/clear_payload.java @@ -0,0 +1,12 @@ +import java.util.List; + +import static io.qdrant.client.PointIdFactory.id; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.clearPayloadAsync("{collection_name}", List.of(id(0), id(3), id(100)), null, null, null) + .get(); diff --git a/snippets/java/count_points.java b/snippets/java/count_points.java new file mode 100644 index 0000000..ae164d2 --- /dev/null +++ b/snippets/java/count_points.java @@ -0,0 +1,15 @@ +import static io.qdrant.client.ConditionFactory.matchKeyword; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +import io.qdrant.client.grpc.Points.Filter; + +QdrantClient client = new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client + .countAsync( + "{collection_name}", + Filter.newBuilder().addMust(matchKeyword("color", "red")).build(), + true) + .get(); diff --git a/snippets/java/create_collection.java b/snippets/java/create_collection.java new file mode 100644 index 0000000..4984cd4 --- /dev/null +++ b/snippets/java/create_collection.java @@ -0,0 +1,11 @@ +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +import io.qdrant.client.grpc.Collections.Distance; +import io.qdrant.client.grpc.Collections.VectorParams; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.createCollectionAsync("{collection_name}", + VectorParams.newBuilder().setDistance(Distance.Cosine).setSize(100).build()).get(); diff --git a/snippets/java/create_field_index.java b/snippets/java/create_field_index.java new file mode 100644 index 0000000..832e01a --- /dev/null +++ b/snippets/java/create_field_index.java @@ -0,0 +1,16 @@ +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +import io.qdrant.client.grpc.Collections.PayloadSchemaType; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.createPayloadIndexAsync( + "{collection_name}", + "{field_name}", + PayloadSchemaType.Keyword, + null, + true, + null, + null); diff --git a/snippets/java/create_full_snapshot.java b/snippets/java/create_full_snapshot.java new file mode 100644 index 0000000..b37d7c2 --- /dev/null +++ b/snippets/java/create_full_snapshot.java @@ -0,0 +1,7 @@ +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.createFullSnapshotAsync().get(); diff --git a/snippets/java/create_shard_key.java b/snippets/java/create_shard_key.java new file mode 100644 index 0000000..202f090 --- /dev/null +++ b/snippets/java/create_shard_key.java @@ -0,0 +1,17 @@ +import static io.qdrant.client.ShardKeyFactory.shardKey; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +import io.qdrant.client.grpc.Collections.CreateShardKey; +import io.qdrant.client.grpc.Collections.CreateShardKeyRequest; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.createShardKeyAsync(CreateShardKeyRequest.newBuilder() + .setCollectionName("{collection_name}") + .setRequest(CreateShardKey.newBuilder() + .setShardKey(shardKey("{shard_key}")) + .build()) + .build()).get(); diff --git a/snippets/java/create_snapshot.java b/snippets/java/create_snapshot.java new file mode 100644 index 0000000..b5fad45 --- /dev/null +++ b/snippets/java/create_snapshot.java @@ -0,0 +1,7 @@ +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.createSnapshotAsync("{collection_name}").get(); diff --git a/snippets/java/delete_collection.java b/snippets/java/delete_collection.java new file mode 100644 index 0000000..3145512 --- /dev/null +++ b/snippets/java/delete_collection.java @@ -0,0 +1,7 @@ +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +QdrantClient client = + new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.deleteCollectionAsync("{collection_name}").get(); diff --git a/snippets/java/delete_field_index.java b/snippets/java/delete_field_index.java new file mode 100644 index 0000000..e1013b5 --- /dev/null +++ b/snippets/java/delete_field_index.java @@ -0,0 +1,7 @@ +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.deletePayloadIndexAsync("{collection_name}", "{field_name}", true, null, null).get(); diff --git a/snippets/java/delete_full_snapshot.java b/snippets/java/delete_full_snapshot.java new file mode 100644 index 0000000..b41035f --- /dev/null +++ b/snippets/java/delete_full_snapshot.java @@ -0,0 +1,7 @@ +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.deleteFullSnapshotAsync("{snapshot_name}").get(); diff --git a/snippets/java/delete_payload.java b/snippets/java/delete_payload.java new file mode 100644 index 0000000..c0366d7 --- /dev/null +++ b/snippets/java/delete_payload.java @@ -0,0 +1,19 @@ +import java.util.List; + +import static io.qdrant.client.PointIdFactory.id; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client + .deletePayloadAsync( + "{collection_name}", + List.of("color", "price"), + List.of(id(0), id(3), id(100)), + true, + null, + null) + .get(); diff --git a/snippets/java/delete_points.java b/snippets/java/delete_points.java new file mode 100644 index 0000000..f8a0f08 --- /dev/null +++ b/snippets/java/delete_points.java @@ -0,0 +1,20 @@ +import static io.qdrant.client.PointIdFactory.id; +import static io.qdrant.client.ConditionFactory.matchKeyword; + +import java.util.List; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +import io.qdrant.client.grpc.Points.Filter; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.deleteAsync("{collection_name}", List.of(id(0), id(3), id(100))); + +client + .deleteAsync( + "{collection_name}", + Filter.newBuilder().addMust(matchKeyword("color", "red")).build()) + .get(); diff --git a/snippets/java/delete_shard_key.java b/snippets/java/delete_shard_key.java new file mode 100644 index 0000000..96ea783 --- /dev/null +++ b/snippets/java/delete_shard_key.java @@ -0,0 +1,17 @@ +import static io.qdrant.client.ShardKeyFactory.shardKey; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +import io.qdrant.client.grpc.Collections.DeleteShardKey; +import io.qdrant.client.grpc.Collections.DeleteShardKeyRequest; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.deleteShardKeyAsync(DeleteShardKeyRequest.newBuilder() + .setCollectionName("{collection_name}") + .setRequest(DeleteShardKey.newBuilder() + .setShardKey(shardKey("{shard_key}")) + .build()) + .build()).get(); diff --git a/snippets/java/delete_snapshot.java b/snippets/java/delete_snapshot.java new file mode 100644 index 0000000..32ad541 --- /dev/null +++ b/snippets/java/delete_snapshot.java @@ -0,0 +1,7 @@ +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.deleteSnapshotAsync("{collection_name}", "{snapshot_name}").get(); diff --git a/snippets/java/delete_vectors.java b/snippets/java/delete_vectors.java new file mode 100644 index 0000000..c8bf07b --- /dev/null +++ b/snippets/java/delete_vectors.java @@ -0,0 +1,14 @@ +import static io.qdrant.client.PointIdFactory.id; + +import java.util.List; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client + .deleteVectorsAsync( + "{collection_name}", List.of("text", "image"), List.of(id(0), id(3), id(10))) + .get(); diff --git a/snippets/java/discover_batch_points.java b/snippets/java/discover_batch_points.java new file mode 100644 index 0000000..524e4dd --- /dev/null +++ b/snippets/java/discover_batch_points.java @@ -0,0 +1,79 @@ +import static io.qdrant.client.PointIdFactory.id; +import static io.qdrant.client.VectorFactory.vector; + +import java.util.Arrays; +import java.util.List; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +import io.qdrant.client.grpc.Points.ContextExamplePair; +import io.qdrant.client.grpc.Points.DiscoverPoints; +import io.qdrant.client.grpc.Points.TargetVector; +import io.qdrant.client.grpc.Points.VectorExample; + +QdrantClient client = new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +List discoverPoints = Arrays.asList( + DiscoverPoints.newBuilder() + .setCollectionName("{collection_name}") + .setTarget( + TargetVector.newBuilder() + .setSingle( + VectorExample.newBuilder() + .setVector(vector( + 0.2 f, + 0.1 f, + 0.9 f, + 0.7 f)) + .build())) + .addAllContext( + List.of( + ContextExamplePair.newBuilder() + .setPositive(VectorExample + .newBuilder() + .setId(id(100))) + .setNegative(VectorExample + .newBuilder() + .setId(id(718))) + .build(), + ContextExamplePair.newBuilder() + .setPositive(VectorExample + .newBuilder() + .setId(id(200))) + .setNegative(VectorExample + .newBuilder() + .setId(id(300))) + .build())) + .setLimit(10) + .build(), + DiscoverPoints.newBuilder() + .setCollectionName("{collection_name}") + .setTarget( + TargetVector.newBuilder() + .setSingle( + VectorExample.newBuilder() + .setVector(vector( + 0.5 f, 0.3 f, 0.2 f, 0.3 f)) + .build())) + .addAllContext( + List.of( + ContextExamplePair.newBuilder() + .setPositive(VectorExample + .newBuilder() + .setId(id(342))) + .setNegative(VectorExample + .newBuilder() + .setId(id(213))) + .build(), + ContextExamplePair.newBuilder() + .setPositive(VectorExample + .newBuilder() + .setId(id(100))) + .setNegative(VectorExample + .newBuilder() + .setId(id(200))) + .build())) + .setLimit(10) + .build()); +client.discoverBatchAsync("{collection_name}", discoverPoints, null); diff --git a/snippets/java/discover_points.java b/snippets/java/discover_points.java new file mode 100644 index 0000000..9166f6e --- /dev/null +++ b/snippets/java/discover_points.java @@ -0,0 +1,39 @@ +import java.util.List; + +import static io.qdrant.client.PointIdFactory.id; +import static io.qdrant.client.VectorFactory.vector; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +import io.qdrant.client.grpc.Points.ContextExamplePair; +import io.qdrant.client.grpc.Points.DiscoverPoints; +import io.qdrant.client.grpc.Points.TargetVector; +import io.qdrant.client.grpc.Points.VectorExample; + +QdrantClient client = + new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client + .discoverAsync( + DiscoverPoints.newBuilder() + .setCollectionName("{collection_name}") + .setTarget( + TargetVector.newBuilder() + .setSingle( + VectorExample.newBuilder() + .setVector(vector(0.2f, 0.1f, 0.9f, 0.7f)) + .build())) + .addAllContext( + List.of( + ContextExamplePair.newBuilder() + .setPositive(VectorExample.newBuilder().setId(id(100))) + .setNegative(VectorExample.newBuilder().setId(id(718))) + .build(), + ContextExamplePair.newBuilder() + .setPositive(VectorExample.newBuilder().setId(id(200))) + .setNegative(VectorExample.newBuilder().setId(id(300))) + .build())) + .setLimit(10) + .build()) + .get(); diff --git a/snippets/java/get_collection.java b/snippets/java/get_collection.java new file mode 100644 index 0000000..2fbb7a3 --- /dev/null +++ b/snippets/java/get_collection.java @@ -0,0 +1,7 @@ +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.getCollectionInfoAsync("{collection_name}").get(); diff --git a/snippets/java/get_collection_aliases.java b/snippets/java/get_collection_aliases.java new file mode 100644 index 0000000..01b5f0b --- /dev/null +++ b/snippets/java/get_collection_aliases.java @@ -0,0 +1,7 @@ +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.listCollectionAliasesAsync("{collection_name}").get(); diff --git a/snippets/java/get_collections.java b/snippets/java/get_collections.java new file mode 100644 index 0000000..d297118 --- /dev/null +++ b/snippets/java/get_collections.java @@ -0,0 +1,7 @@ +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.listCollectionsAsync().get(); diff --git a/snippets/java/get_collections_aliases.java b/snippets/java/get_collections_aliases.java new file mode 100644 index 0000000..fc23964 --- /dev/null +++ b/snippets/java/get_collections_aliases.java @@ -0,0 +1,7 @@ +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.listAliasesAsync().get(); diff --git a/snippets/java/get_points.java b/snippets/java/get_points.java new file mode 100644 index 0000000..e87239b --- /dev/null +++ b/snippets/java/get_points.java @@ -0,0 +1,7 @@ +import static io.qdrant.client.PointIdFactory.id; + +import java.util.List; + +client + .retrieveAsync("{collection_name}", List.of(id(0), id(30), id(100)), false, false, null) + .get(); diff --git a/snippets/java/list_full_snapshots.java b/snippets/java/list_full_snapshots.java new file mode 100644 index 0000000..8f3f96f --- /dev/null +++ b/snippets/java/list_full_snapshots.java @@ -0,0 +1,7 @@ +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.listFullSnapshotAsync().get(); diff --git a/snippets/java/list_snapshots.java b/snippets/java/list_snapshots.java new file mode 100644 index 0000000..7690c37 --- /dev/null +++ b/snippets/java/list_snapshots.java @@ -0,0 +1,7 @@ +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.listSnapshotAsync("{collection_name}").get(); diff --git a/snippets/java/overwrite_payload.java b/snippets/java/overwrite_payload.java new file mode 100644 index 0000000..68b1620 --- /dev/null +++ b/snippets/java/overwrite_payload.java @@ -0,0 +1,20 @@ +import java.util.List; + +import static io.qdrant.client.PointIdFactory.id; +import static io.qdrant.client.ValueFactory.value; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client + .overwritePayloadAsync( + "{collection_name}", + Map.of("property1", value("string"), "property2", value("string")), + List.of(id(0), id(3), id(10)), + true, + null, + null) + .get(); diff --git a/snippets/java/recommend_batch_points.java b/snippets/java/recommend_batch_points.java new file mode 100644 index 0000000..b23f285 --- /dev/null +++ b/snippets/java/recommend_batch_points.java @@ -0,0 +1,32 @@ +import java.util.List; + +import static io.qdrant.client.ConditionFactory.matchKeyword; +import static io.qdrant.client.PointIdFactory.id; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +import io.qdrant.client.grpc.Points.Filter; +import io.qdrant.client.grpc.Points.RecommendPoints; + +QdrantClient client = + new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +Filter filter = Filter.newBuilder().addMust(matchKeyword("city", "London")).build(); + +List recommendQueries = + List.of( + RecommendPoints.newBuilder() + .addAllPositive(List.of(id(100), id(231))) + .addAllNegative(List.of(id(718))) + .setFilter(filter) + .setLimit(3) + .build(), + RecommendPoints.newBuilder() + .addAllPositive(List.of(id(200), id(67))) + .addAllNegative(List.of(id(300))) + .setFilter(filter) + .setLimit(3) + .build()); + +client.recommendBatchAsync("{collection_name}", recommendQueries, null).get(); diff --git a/snippets/java/recommend_point_groups.java b/snippets/java/recommend_point_groups.java new file mode 100644 index 0000000..51e056b --- /dev/null +++ b/snippets/java/recommend_point_groups.java @@ -0,0 +1,22 @@ +import static io.qdrant.client.PointIdFactory.id; + +import java.util.List; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +import io.qdrant.client.grpc.Points.RecommendPointGroups; +import io.qdrant.client.grpc.Points.RecommendStrategy; + +QdrantClient client = + new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.recommendGroupsAsync(RecommendPointGroups.newBuilder() + .setCollectionName("{collection_name}") + .setGroupBy("document_id") + .setGroupSize(2) + .addAllPositive(List.of(id(100), id(200))) + .addAllNegative(List.of(id(718))) + .setStrategy(RecommendStrategy.AverageVector) + .setLimit(3) + .build()); diff --git a/snippets/java/recommend_points.java b/snippets/java/recommend_points.java new file mode 100644 index 0000000..85c2622 --- /dev/null +++ b/snippets/java/recommend_points.java @@ -0,0 +1,29 @@ +import java.util.List; + +import static io.qdrant.client.ConditionFactory.matchKeyword; +import static io.qdrant.client.PointIdFactory.id; +import static io.qdrant.client.VectorFactory.vector; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +import io.qdrant.client.grpc.Points.Filter; +import io.qdrant.client.grpc.Points.RecommendPoints; +import io.qdrant.client.grpc.Points.RecommendStrategy; + +QdrantClient client = + new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client + .recommendAsync( + RecommendPoints.newBuilder() + .setCollectionName("{collection_name}") + .addAllPositive(List.of(id(100), id(200))) + .addAllPositiveVectors(List.of(vector(100.0f, 231.0f))) + .addAllNegative(List.of(id(718))) + .addAllPositiveVectors(List.of(vector(0.2f, 0.3f, 0.4f, 0.5f))) + .setStrategy(RecommendStrategy.AverageVector) + .setFilter(Filter.newBuilder().addMust(matchKeyword("city", "London"))) + .setLimit(3) + .build()) + .get(); diff --git a/snippets/java/scroll_points.java b/snippets/java/scroll_points.java new file mode 100644 index 0000000..bf5e007 --- /dev/null +++ b/snippets/java/scroll_points.java @@ -0,0 +1,21 @@ +import static io.qdrant.client.ConditionFactory.matchKeyword; +import static io.qdrant.client.WithPayloadSelectorFactory.enable; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +import io.qdrant.client.grpc.Points.Filter; +import io.qdrant.client.grpc.Points.ScrollPoints; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client + .scrollAsync( + ScrollPoints.newBuilder() + .setCollectionName("{collection_name}") + .setFilter(Filter.newBuilder().addMust(matchKeyword("color", "red")).build()) + .setLimit(1) + .setWithPayload(enable(true)) + .build()) + .get(); diff --git a/snippets/java/search_batch_points.java b/snippets/java/search_batch_points.java new file mode 100644 index 0000000..0445c78 --- /dev/null +++ b/snippets/java/search_batch_points.java @@ -0,0 +1,27 @@ +import java.util.List; + +import static io.qdrant.client.ConditionFactory.matchKeyword; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +import io.qdrant.client.grpc.Points.Filter; +import io.qdrant.client.grpc.Points.SearchPoints; + +QdrantClient client = + new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +Filter filter = Filter.newBuilder().addMust(matchKeyword("city", "London")).build(); +List searches = + List.of( + SearchPoints.newBuilder() + .addAllVector(List.of(0.2f, 0.1f, 0.9f, 0.7f)) + .setFilter(filter) + .setLimit(3) + .build(), + SearchPoints.newBuilder() + .addAllVector(List.of(0.5f, 0.3f, 0.2f, 0.3f)) + .setFilter(filter) + .setLimit(3) + .build()); +client.searchBatchAsync("{collection_name}", searches, null).get(); diff --git a/snippets/java/search_point_groups.java b/snippets/java/search_point_groups.java new file mode 100644 index 0000000..b09abe7 --- /dev/null +++ b/snippets/java/search_point_groups.java @@ -0,0 +1,20 @@ +import java.util.List; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +import io.qdrant.client.grpc.Points.SearchPointGroups; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client + .searchGroupsAsync( + SearchPointGroups.newBuilder() + .setCollectionName("{collection_name}") + .addAllVector(List.of(1.1f)) + .setGroupBy("document_id") + .setLimit(4) + .setGroupSize(2) + .build()) + .get(); diff --git a/snippets/java/search_points.java b/snippets/java/search_points.java new file mode 100644 index 0000000..48b49a0 --- /dev/null +++ b/snippets/java/search_points.java @@ -0,0 +1,20 @@ +import static io.qdrant.client.ConditionFactory.matchKeyword; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +import io.qdrant.client.grpc.Points.Filter; +import io.qdrant.client.grpc.Points.SearchPoints; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client + .searchAsync( + SearchPoints.newBuilder() + .setCollectionName("{collection_name}") + .setFilter(Filter.newBuilder().addMust(matchKeyword("city", "London")).build()) + .addAllVector(List.of(0.2f, 0.1f, 0.9f, 0.7f)) + .setLimit(3) + .build()) + .get(); diff --git a/snippets/java/set_payload.java b/snippets/java/set_payload.java new file mode 100644 index 0000000..80f8308 --- /dev/null +++ b/snippets/java/set_payload.java @@ -0,0 +1,21 @@ +import static io.qdrant.client.PointIdFactory.id; +import static io.qdrant.client.ValueFactory.value; + +import java.util.List; +import java.util.Map; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client + .setPayloadAsync( + "{collection_name}", + Map.of("property1", value("string"), "property2", value("string")), + List.of(id(0), id(3), id(10)), + true, + null, + null) + .get(); diff --git a/snippets/java/update_aliases.java b/snippets/java/update_aliases.java new file mode 100644 index 0000000..465b435 --- /dev/null +++ b/snippets/java/update_aliases.java @@ -0,0 +1,14 @@ +import static io.qdrant.client.ShardKeyFactory.shardKey; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +import io.qdrant.client.grpc.Collections.DeleteShardKey; +import io.qdrant.client.grpc.Collections.DeleteShardKeyRequest; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.createAliasAsync("production_collection", "example_collection").get(); + +client.deleteAliasAsync("production_collection").get(); diff --git a/snippets/java/update_collection.java b/snippets/java/update_collection.java new file mode 100644 index 0000000..291f21c --- /dev/null +++ b/snippets/java/update_collection.java @@ -0,0 +1,17 @@ +import static io.qdrant.client.ShardKeyFactory.shardKey; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +import io.qdrant.client.grpc.Collections.OptimizersConfigDiff; +import io.qdrant.client.grpc.Collections.UpdateCollection; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client.updateCollectionAsync( + UpdateCollection.newBuilder() + .setCollectionName("{collection_name}") + .setOptimizersConfig( + OptimizersConfigDiff.newBuilder().setIndexingThreshold(10000).build()) + .build()); diff --git a/snippets/java/update_vectors.java b/snippets/java/update_vectors.java new file mode 100644 index 0000000..c14107f --- /dev/null +++ b/snippets/java/update_vectors.java @@ -0,0 +1,29 @@ +import static io.qdrant.client.PointIdFactory.id; +import static io.qdrant.client.VectorFactory.vector; +import static io.qdrant.client.VectorsFactory.namedVectors; + +import java.util.List; +import java.util.Map; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client + .updateVectorsAsync( + "{collection_name}", + List.of( + PointVectors.newBuilder() + .setId(id(1)) + .setVectors(namedVectors(Map.of("image", vector(List.of(0.1f, 0.2f, 0.3f, 0.4f))))) + .build(), + PointVectors.newBuilder() + .setId(id(2)) + .setVectors( + namedVectors( + Map.of( + "text", vector(List.of(0.9f, 0.8f, 0.7f, 0.6f, 0.5f, 0.4f, 0.3f, 0.2f))))) + .build())) + .get(); diff --git a/snippets/java/upsert_points.java b/snippets/java/upsert_points.java new file mode 100644 index 0000000..0260738 --- /dev/null +++ b/snippets/java/upsert_points.java @@ -0,0 +1,40 @@ +import static io.qdrant.client.PointIdFactory.id; +import static io.qdrant.client.VectorFactory.vector; +import static io.qdrant.client.VectorsFactory.namedVectors; + +import java.util.List; +import java.util.Map; + +import io.qdrant.client.QdrantClient; +import io.qdrant.client.QdrantGrpcClient; + +import io.qdrant.client.grpc.Points.PointStruct; + +QdrantClient client = new QdrantClient( + QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); + +client + .upsertAsync( + "{collection_name}", + List.of( + PointStruct.newBuilder() + .setId(id(1)) + .setVectors( + namedVectors( + Map.of( + "image", + vector(List.of(0.9f, 0.1f, 0.1f, 0.2f)), + "text", + vector(List.of(0.4f, 0.7f, 0.1f, 0.8f, 0.1f, 0.1f, 0.9f, 0.2f))))) + .build(), + PointStruct.newBuilder() + .setId(id(2)) + .setVectors( + namedVectors( + Map.of( + "image", + List.of(0.2f, 0.1f, 0.3f, 0.9f), + "text", + List.of(0.5f, 0.2f, 0.7f, 0.4f, 0.7f, 0.2f, 0.3f, 0.9f)))) + .build())) + .get(); diff --git a/snippets/python/batch_update.py b/snippets/python/batch_update.py new file mode 100644 index 0000000..2e326d9 --- /dev/null +++ b/snippets/python/batch_update.py @@ -0,0 +1,39 @@ +from qdrant_client import QdrantClient, models + +client = QdrantClient(url="http://localhost:6333") + +client.batch_update_points( + collection_name="{collection_name}", + update_operations=[ + models.UpsertOperation( + upsert=models.PointsList( + points=[ + models.PointStruct( + id=1, + vector=[1.0, 2.0, 3.0, 4.0], + payload={}, + ), + ] + ) + ), + models.UpdateVectorsOperation( + update_vectors=models.UpdateVectors( + points=[ + models.PointVectors( + id=1, + vector=[1.0, 2.0, 3.0, 4.0], + ) + ] + ) + ), + models.SetPayloadOperation( + set_payload=models.SetPayload( + payload={ + "test_payload_2": 2, + "test_payload_3": 3, + }, + points=[1], + ) + ), + ], +) diff --git a/snippets/python/clear_payload.py b/snippets/python/clear_payload.py new file mode 100644 index 0000000..76b01c5 --- /dev/null +++ b/snippets/python/clear_payload.py @@ -0,0 +1,8 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.clear_payload( + collection_name="{collection_name}", + points_selector=[0, 3, 100], +) diff --git a/snippets/python/count_points.py b/snippets/python/count_points.py new file mode 100644 index 0000000..ed462c0 --- /dev/null +++ b/snippets/python/count_points.py @@ -0,0 +1,13 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.count( + collection_name="{collection_name}", + count_filter=models.Filter( + must=[ + models.FieldCondition(key="color", match=models.MatchValue(value="red")), + ] + ), + exact=True, +) diff --git a/snippets/python/create_collection.py b/snippets/python/create_collection.py new file mode 100644 index 0000000..eb3a82b --- /dev/null +++ b/snippets/python/create_collection.py @@ -0,0 +1,8 @@ +from qdrant_client import QdrantClient, models + +client = QdrantClient(url="http://localhost:6333") + +client.create_collection( + collection_name="{collection_name}", + vectors_config=models.VectorParams(size=100, distance=models.Distance.COSINE), +) diff --git a/snippets/python/create_field_index.py b/snippets/python/create_field_index.py new file mode 100644 index 0000000..66c7616 --- /dev/null +++ b/snippets/python/create_field_index.py @@ -0,0 +1,9 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.create_payload_index( + collection_name="{collection_name}", + field_name="name_of_the_field_to_index", + field_schema="keyword", +) diff --git a/snippets/python/create_full_snapshot.py b/snippets/python/create_full_snapshot.py new file mode 100644 index 0000000..e7f3b67 --- /dev/null +++ b/snippets/python/create_full_snapshot.py @@ -0,0 +1,5 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.create_full_snapshot() diff --git a/snippets/python/create_shard_key.py b/snippets/python/create_shard_key.py new file mode 100644 index 0000000..a9c985d --- /dev/null +++ b/snippets/python/create_shard_key.py @@ -0,0 +1,5 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.create_shard_key("{collection_name}", "{shard_key}") diff --git a/snippets/python/create_snapshot.py b/snippets/python/create_snapshot.py new file mode 100644 index 0000000..db38c46 --- /dev/null +++ b/snippets/python/create_snapshot.py @@ -0,0 +1,5 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.create_snapshot(collection_name="{collection_name}") diff --git a/snippets/python/delete_collection.py b/snippets/python/delete_collection.py new file mode 100644 index 0000000..4f6c257 --- /dev/null +++ b/snippets/python/delete_collection.py @@ -0,0 +1,5 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.delete_collection(collection_name="{collection_name}") diff --git a/snippets/python/delete_field_index.py b/snippets/python/delete_field_index.py new file mode 100644 index 0000000..55d6e09 --- /dev/null +++ b/snippets/python/delete_field_index.py @@ -0,0 +1,5 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.delete_payload_index("{collection_name}", "{field_name}"); diff --git a/snippets/python/delete_full_snapshot.py b/snippets/python/delete_full_snapshot.py new file mode 100644 index 0000000..11670eb --- /dev/null +++ b/snippets/python/delete_full_snapshot.py @@ -0,0 +1,5 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.delete_full_snapshot(snapshot_name="{snapshot_name}") diff --git a/snippets/python/delete_payload.py b/snippets/python/delete_payload.py new file mode 100644 index 0000000..248ae8f --- /dev/null +++ b/snippets/python/delete_payload.py @@ -0,0 +1,9 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.delete_payload( + collection_name="{collection_name}", + keys=["color", "price"], + points=[0, 3, 100], +) diff --git a/snippets/python/delete_points.py b/snippets/python/delete_points.py new file mode 100644 index 0000000..dd96aa3 --- /dev/null +++ b/snippets/python/delete_points.py @@ -0,0 +1,24 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.delete( + collection_name="{collection_name}", + points_selector=models.PointIdsList( + points=[0, 3, 100], + ), +) + +client.delete( + collection_name="{collection_name}", + points_selector=models.FilterSelector( + filter=models.Filter( + must=[ + models.FieldCondition( + key="color", + match=models.MatchValue(value="red"), + ), + ], + ) + ), +) diff --git a/snippets/python/delete_shard_key.py b/snippets/python/delete_shard_key.py new file mode 100644 index 0000000..667266e --- /dev/null +++ b/snippets/python/delete_shard_key.py @@ -0,0 +1,5 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.delete_shard_key("{collection_name}", "{shard_key}") diff --git a/snippets/python/delete_snapshot.py b/snippets/python/delete_snapshot.py new file mode 100644 index 0000000..2131bf3 --- /dev/null +++ b/snippets/python/delete_snapshot.py @@ -0,0 +1,7 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.delete_snapshot( + collection_name="{collection_name}", snapshot_name="{snapshot_name}" +) diff --git a/snippets/python/delete_vectors.py b/snippets/python/delete_vectors.py new file mode 100644 index 0000000..d35fb77 --- /dev/null +++ b/snippets/python/delete_vectors.py @@ -0,0 +1,9 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.delete_vectors( + collection_name="{collection_name}", + points=[0, 3, 100], + vectors=["text", "image"], +) diff --git a/snippets/python/discover_batch_points.py b/snippets/python/discover_batch_points.py new file mode 100644 index 0000000..efeae64 --- /dev/null +++ b/snippets/python/discover_batch_points.py @@ -0,0 +1,36 @@ +from qdrant_client import QdrantClient, models + +client = QdrantClient(url="http://localhost:6333") + +discover_queries = [ + models.DiscoverRequest( + target=[0.2, 0.1, 0.9, 0.7], + context=[ + models.ContextExamplePair( + positive=100, + negative=718, + ), + models.ContextExamplePair( + positive=200, + negative=300, + ), + ], + limit=10, + ), + models.DiscoverRequest( + target=[0.5, 0.3, 0.2, 0.3], + context=[ + models.ContextExamplePair( + positive=342, + negative=213, + ), + models.ContextExamplePair( + positive=100, + negative=200, + ), + ], + limit=5, + ), +] + +client.discover_batch("{collection_name}", discover_queries) diff --git a/snippets/python/discover_points.py b/snippets/python/discover_points.py new file mode 100644 index 0000000..f438891 --- /dev/null +++ b/snippets/python/discover_points.py @@ -0,0 +1,13 @@ +from qdrant_client import QdrantClient, models + +client = QdrantClient(url="http://localhost:6333") + +client.discover( + "{collection_name}", + target=[0.2, 0.1, 0.9, 0.7], + context=[ + models.ContextExamplePair(positive=100, negative=718), + models.ContextExamplePair(positive=200, negative=300), + ], + limit=10, +) diff --git a/snippets/python/get_collection.py b/snippets/python/get_collection.py new file mode 100644 index 0000000..94cff64 --- /dev/null +++ b/snippets/python/get_collection.py @@ -0,0 +1,5 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.get_collection("{collection_name}") diff --git a/snippets/python/get_collection_aliases.py b/snippets/python/get_collection_aliases.py new file mode 100644 index 0000000..9cfa053 --- /dev/null +++ b/snippets/python/get_collection_aliases.py @@ -0,0 +1,5 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.get_collection_aliases("{collection_name}") diff --git a/snippets/python/get_collections.py b/snippets/python/get_collections.py new file mode 100644 index 0000000..0f1a1fe --- /dev/null +++ b/snippets/python/get_collections.py @@ -0,0 +1,5 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.get_collections() diff --git a/snippets/python/get_collections_aliases.py b/snippets/python/get_collections_aliases.py new file mode 100644 index 0000000..56c6233 --- /dev/null +++ b/snippets/python/get_collections_aliases.py @@ -0,0 +1,5 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.get_aliases() diff --git a/snippets/python/get_points.py b/snippets/python/get_points.py new file mode 100644 index 0000000..2b723cd --- /dev/null +++ b/snippets/python/get_points.py @@ -0,0 +1,8 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.retrieve( + collection_name="{collection_name}", + ids=[0, 3, 100], +) diff --git a/snippets/python/list_full_snapshots.py b/snippets/python/list_full_snapshots.py new file mode 100644 index 0000000..db0dde6 --- /dev/null +++ b/snippets/python/list_full_snapshots.py @@ -0,0 +1,5 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.list_full_snapshots() diff --git a/snippets/python/list_snapshots.py b/snippets/python/list_snapshots.py new file mode 100644 index 0000000..d262804 --- /dev/null +++ b/snippets/python/list_snapshots.py @@ -0,0 +1,5 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.list_snapshots(collection_name="{collection_name}") diff --git a/snippets/python/overwrite_payload.py b/snippets/python/overwrite_payload.py new file mode 100644 index 0000000..93efb02 --- /dev/null +++ b/snippets/python/overwrite_payload.py @@ -0,0 +1,12 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.overwrite_payload( + collection_name="{collection_name}", + payload={ + "property1": "string", + "property2": "string", + }, + points=[0, 3, 10], +) diff --git a/snippets/python/recommend_batch_points.py b/snippets/python/recommend_batch_points.py new file mode 100644 index 0000000..a757293 --- /dev/null +++ b/snippets/python/recommend_batch_points.py @@ -0,0 +1,12 @@ +from qdrant_client import QdrantClient, models + +client = QdrantClient(url="http://localhost:6333") + +recommend_queries = [ + models.RecommendRequest( + positive=[100, 231], negative=[718], filter=filter_, limit=3 + ), + models.RecommendRequest(positive=[200, 67], negative=[300], limit=3), +] + +client.recommend_batch(collection_name="{collection_name}", requests=recommend_queries) diff --git a/snippets/python/recommend_point_groups.py b/snippets/python/recommend_point_groups.py new file mode 100644 index 0000000..666c3bb --- /dev/null +++ b/snippets/python/recommend_point_groups.py @@ -0,0 +1,12 @@ +from qdrant_client import QdrantClient, models + +client = QdrantClient(url="http://localhost:6333") + +client.recommend_groups( + collection_name="{collection_name}", + positive=[100, 231], + negative=[718], + group_by="document_id", + limit=3, + group_size=2, +) diff --git a/snippets/python/recommend_points.py b/snippets/python/recommend_points.py new file mode 100644 index 0000000..1919be7 --- /dev/null +++ b/snippets/python/recommend_points.py @@ -0,0 +1,21 @@ +from qdrant_client import QdrantClient, models + +client = QdrantClient(url="http://localhost:6333") + +client.recommend( + collection_name="{collection_name}", + positive=[100, 231], + negative=[718, [0.2, 0.3, 0.4, 0.5]], + strategy=models.RecommendStrategy.AVERAGE_VECTOR, + query_filter=models.Filter( + must=[ + models.FieldCondition( + key="city", + match=models.MatchValue( + value="London", + ), + ) + ] + ), + limit=3, +) diff --git a/snippets/python/recover_from_snapshot.py b/snippets/python/recover_from_snapshot.py new file mode 100644 index 0000000..83553e2 --- /dev/null +++ b/snippets/python/recover_from_snapshot.py @@ -0,0 +1,8 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.recover_snapshot( + "{collection_name}", + "http://example.com/path/to/snapshot.shapshot", +) diff --git a/snippets/python/scroll_points.py b/snippets/python/scroll_points.py new file mode 100644 index 0000000..3584c38 --- /dev/null +++ b/snippets/python/scroll_points.py @@ -0,0 +1,15 @@ +from qdrant_client import QdrantClient, models + +client = QdrantClient(url="http://localhost:6333") + +client.scroll( + collection_name="{collection_name}", + scroll_filter=models.Filter( + must=[ + models.FieldCondition(key="color", match=models.MatchValue(value="red")), + ] + ), + limit=1, + with_payload=True, + with_vectors=False, +) diff --git a/snippets/python/search_batch_points.py b/snippets/python/search_batch_points.py new file mode 100644 index 0000000..1f60d60 --- /dev/null +++ b/snippets/python/search_batch_points.py @@ -0,0 +1,21 @@ +from qdrant_client import QdrantClient, models + +client = QdrantClient(url="http://localhost:6333") + +filter_ = models.Filter( + must=[ + models.FieldCondition( + key="city", + match=models.MatchValue( + value="London", + ), + ) + ] +) + +search_queries = [ + models.SearchRequest(vector=[0.2, 0.1, 0.9, 0.7], filter=filter_, limit=3), + models.SearchRequest(vector=[0.5, 0.3, 0.2, 0.3], filter=filter_, limit=3), +] + +client.search_batch(collection_name="{collection_name}", requests=search_queries) diff --git a/snippets/python/search_point_groups.py b/snippets/python/search_point_groups.py new file mode 100644 index 0000000..3be36ef --- /dev/null +++ b/snippets/python/search_point_groups.py @@ -0,0 +1,11 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.search_groups( + collection_name="{collection_name}", + query_vector=[1.1], + group_by="document_id", + limit=4, + group_size=2, +) diff --git a/snippets/python/search_points.py b/snippets/python/search_points.py new file mode 100644 index 0000000..935203a --- /dev/null +++ b/snippets/python/search_points.py @@ -0,0 +1,19 @@ +from qdrant_client import QdrantClient, models + +client = QdrantClient(url="http://localhost:6333") + +client.search( + collection_name="{collection_name}", + query_filter=models.Filter( + must=[ + models.FieldCondition( + key="city", + match=models.MatchValue( + value="London", + ), + ) + ] + ), + query_vector=[0.2, 0.1, 0.9, 0.7], + limit=3, +) diff --git a/snippets/python/set_payload.py b/snippets/python/set_payload.py new file mode 100644 index 0000000..7cb1200 --- /dev/null +++ b/snippets/python/set_payload.py @@ -0,0 +1,12 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.set_payload( + collection_name="{collection_name}", + payload={ + "property1": "string", + "property2": "string", + }, + points=[0, 3, 10], +) diff --git a/snippets/python/update_aliases.py b/snippets/python/update_aliases.py new file mode 100644 index 0000000..9550be5 --- /dev/null +++ b/snippets/python/update_aliases.py @@ -0,0 +1,21 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.update_collection_aliases( + change_aliases_operations=[ + models.CreateAliasOperation( + create_alias=models.CreateAlias( + collection_name="example_collection", alias_name="production_collection" + ) + ) + ] +) + +client.update_collection_aliases( + change_aliases_operations=[ + models.DeleteAliasOperation( + delete_alias=models.DeleteAlias(alias_name="production_collection") + ), + ] +) diff --git a/snippets/python/update_collection.py b/snippets/python/update_collection.py new file mode 100644 index 0000000..369f45c --- /dev/null +++ b/snippets/python/update_collection.py @@ -0,0 +1,8 @@ +from qdrant_client import QdrantClient + +client = QdrantClient(url="http://localhost:6333") + +client.update_collection( + collection_name="{collection_name}", + optimizer_config=models.OptimizersConfigDiff(indexing_threshold=10000), +) diff --git a/snippets/python/update_vectors.py b/snippets/python/update_vectors.py new file mode 100644 index 0000000..6475e0b --- /dev/null +++ b/snippets/python/update_vectors.py @@ -0,0 +1,21 @@ +from qdrant_client import QdrantClient, models + +client = QdrantClient(url="http://localhost:6333") + +client.update_vectors( + collection_name="{collection_name}", + points=[ + models.PointVectors( + id=1, + vector={ + "image": [0.1, 0.2, 0.3, 0.4], + }, + ), + models.PointVectors( + id=2, + vector={ + "text": [0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2], + }, + ), + ], +) diff --git a/snippets/python/upsert_points.py b/snippets/python/upsert_points.py new file mode 100644 index 0000000..d87ee1d --- /dev/null +++ b/snippets/python/upsert_points.py @@ -0,0 +1,30 @@ +from qdrant_client import QdrantClient, models + +client = QdrantClient(url="http://localhost:6333") + +client.upsert( + collection_name="{collection_name}", + points=[ + models.PointStruct( + id=1, + payload={ + "color": "red", + }, + vector=[0.9, 0.1, 0.1], + ), + models.PointStruct( + id=2, + payload={ + "color": "green", + }, + vector=[0.1, 0.9, 0.1], + ), + models.PointStruct( + id=3, + payload={ + "color": "blue", + }, + vector=[0.1, 0.1, 0.9], + ), + ], +) diff --git a/snippets/rust/batch_update.rs b/snippets/rust/batch_update.rs new file mode 100644 index 0000000..197c713 --- /dev/null +++ b/snippets/rust/batch_update.rs @@ -0,0 +1,50 @@ +use qdrant_client::qdrant::{ + points_selector::PointsSelectorOneOf, + points_update_operation::{ + Operation, PointStructList, SetPayload, UpdateVectors, + }, + PointStruct, PointVectors, PointsIdsList, PointsSelector, PointsUpdateOperation, +}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .batch_updates_blocking( + "{collection_name}", + &[ + PointsUpdateOperation { + operation: Some(Operation::Upsert(PointStructList { + points: vec![PointStruct::new( + 1, + vec![1.0, 2.0, 3.0, 4.0], + json!({}).try_into().unwrap(), + )], + ..Default::default() + })), + }, + PointsUpdateOperation { + operation: Some(Operation::UpdateVectors(UpdateVectors { + points: vec![PointVectors { + id: Some(1.into()), + vectors: Some(vec![1.0, 2.0, 3.0, 4.0].into()), + }], + ..Default::default() + })), + }, + PointsUpdateOperation { + operation: Some(Operation::OverwritePayload(SetPayload { + points_selector: Some(PointsSelector { + points_selector_one_of: Some(PointsSelectorOneOf::Points( + PointsIdsList { + ids: vec![1.into()], + }, + )), + }), + payload: HashMap::from([("test_payload".to_string(), 1.into())]), + ..Default::default() + })), + }, + ], + None, + ) + .await?; diff --git a/snippets/rust/clear_payload.rs b/snippets/rust/clear_payload.rs new file mode 100644 index 0000000..ba4220a --- /dev/null +++ b/snippets/rust/clear_payload.rs @@ -0,0 +1,18 @@ +use qdrant_client::{client::QdrantClient, qdrant::{ + points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector, +}}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .clear_payload( + "{collection_name}", + None, + Some(PointsSelector { + points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList { + ids: vec![0.into(), 3.into(), 100.into()], + })), + }), + None, + ) + .await?; diff --git a/snippets/rust/count_points.rs b/snippets/rust/count_points.rs new file mode 100644 index 0000000..576b7ad --- /dev/null +++ b/snippets/rust/count_points.rs @@ -0,0 +1,15 @@ +use qdrant_client::{client::QdrantClient, qdrant::{Condition, CountPoints, Filter}}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .count(&CountPoints { + collection_name: "{collection_name}".to_string(), + filter: Some(Filter::must([Condition::matches( + "color", + "red".to_string(), + )])), + exact: Some(true), + ..Default::default() + }) + .await?; diff --git a/snippets/rust/create_collection.rs b/snippets/rust/create_collection.rs new file mode 100644 index 0000000..0581cee --- /dev/null +++ b/snippets/rust/create_collection.rs @@ -0,0 +1,20 @@ +use qdrant_client::{ + client::QdrantClient, + qdrant::{vectors_config::Config, CreateCollection, Distance, VectorParams, VectorsConfig}, +}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .create_collection(&CreateCollection { + collection_name: "{collection_name}".to_string(), + vectors_config: Some(VectorsConfig { + config: Some(Config::Params(VectorParams { + size: 100, + distance: Distance::Cosine.into(), + ..Default::default() + })), + }), + ..Default::default() + }) + .await?; diff --git a/snippets/rust/create_field_index.rs b/snippets/rust/create_field_index.rs new file mode 100644 index 0000000..c148b59 --- /dev/null +++ b/snippets/rust/create_field_index.rs @@ -0,0 +1,13 @@ +use qdrant_client::{client::QdrantClient, qdrant::FieldType}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client +.create_field_index( + "{collection_name}", + "{field_name}", + FieldType::Keyword, + None, + None, +) +.await?; diff --git a/snippets/rust/create_full_snapshot.rs b/snippets/rust/create_full_snapshot.rs new file mode 100644 index 0000000..7750745 --- /dev/null +++ b/snippets/rust/create_full_snapshot.rs @@ -0,0 +1,5 @@ +use qdrant_client::client::QdrantClient; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client.create_full_snapshot().await?; diff --git a/snippets/rust/create_shard_key.rs b/snippets/rust/create_shard_key.rs new file mode 100644 index 0000000..985c5f1 --- /dev/null +++ b/snippets/rust/create_shard_key.rs @@ -0,0 +1,13 @@ +use qdrant_client::{client::QdrantClient, qdrant::shard_key::Key}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .create_shard_key( + "{collection_name}", + &Key::Keyword("{shard_key".to_string()), + None, + None, + &[], + ) + .await?; diff --git a/snippets/rust/create_snapshot.rs b/snippets/rust/create_snapshot.rs new file mode 100644 index 0000000..0e0eb61 --- /dev/null +++ b/snippets/rust/create_snapshot.rs @@ -0,0 +1,5 @@ +use qdrant_client::client::QdrantClient; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client.create_snapshot("{collection_name}").await?; diff --git a/snippets/rust/delete_collection.rs b/snippets/rust/delete_collection.rs new file mode 100644 index 0000000..63f0c4c --- /dev/null +++ b/snippets/rust/delete_collection.rs @@ -0,0 +1,5 @@ +use qdrant_client::client::QdrantClient; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client.delete_collection("{collection_name}").await?; diff --git a/snippets/rust/delete_field_index.rs b/snippets/rust/delete_field_index.rs new file mode 100644 index 0000000..4f57417 --- /dev/null +++ b/snippets/rust/delete_field_index.rs @@ -0,0 +1,7 @@ +use qdrant_client::client::QdrantClient; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .delete_field_index("{collection_name}", "{field_name}", None) + .await?; diff --git a/snippets/rust/delete_full_snapshot.rs b/snippets/rust/delete_full_snapshot.rs new file mode 100644 index 0000000..a3c3d6a --- /dev/null +++ b/snippets/rust/delete_full_snapshot.rs @@ -0,0 +1,5 @@ +use qdrant_client::client::QdrantClient; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client.delete_full_snapshot("{snapshot_name}").await?; diff --git a/snippets/rust/delete_payload.rs b/snippets/rust/delete_payload.rs new file mode 100644 index 0000000..aae2b7d --- /dev/null +++ b/snippets/rust/delete_payload.rs @@ -0,0 +1,19 @@ +use qdrant_client::{client::QdrantClient, qdrant::{ + points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector, +}}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .delete_payload_blocking( + "{collection_name}", + None, + &PointsSelector { + points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList { + ids: vec![0.into(), 3.into(), 100.into()], + })), + }, + vec!["color".to_string(), "price".to_string()], + None, + ) + .await?; diff --git a/snippets/rust/delete_points.rs b/snippets/rust/delete_points.rs new file mode 100644 index 0000000..bb5ce04 --- /dev/null +++ b/snippets/rust/delete_points.rs @@ -0,0 +1,29 @@ +use qdrant_client::{client::QdrantClient, qdrant::{points_selector::PointsSelectorOneOf, Condition, Filter, PointsIdsList, PointsSelector}}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .delete_points_blocking( + "{collection_name}", + None, + &PointsSelector { + points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList { + ids: vec![0.into(), 3.into(), 100.into()], + })), + }, + None, + ) + .await?; + + client + .delete_points_blocking( + "{collection_name}", + None, + &PointsSelector { + points_selector_one_of: Some(PointsSelectorOneOf::Filter(Filter::must([ + Condition::matches("color", "red".to_string()), + ]))), + }, + None, + ) + .await?; diff --git a/snippets/rust/delete_shard_key.rs b/snippets/rust/delete_shard_key.rs new file mode 100644 index 0000000..ccbb5bc --- /dev/null +++ b/snippets/rust/delete_shard_key.rs @@ -0,0 +1,7 @@ +use qdrant_client::{client::QdrantClient, qdrant::shard_key::Key}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .delete_shard_key("{collection_name}", &Key::Keyword("{shard_key".to_string())) + .await?; diff --git a/snippets/rust/delete_snapshot.rs b/snippets/rust/delete_snapshot.rs new file mode 100644 index 0000000..476aaed --- /dev/null +++ b/snippets/rust/delete_snapshot.rs @@ -0,0 +1,7 @@ +use qdrant_client::client::QdrantClient; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .delete_snapshot("{collection_name}", "{snapshot_name}") + .await?; diff --git a/snippets/rust/delete_vectors.rs b/snippets/rust/delete_vectors.rs new file mode 100644 index 0000000..792befe --- /dev/null +++ b/snippets/rust/delete_vectors.rs @@ -0,0 +1,21 @@ +use qdrant_client::{client::QdrantClient, qdrant::{ + points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector, VectorsSelector, +}}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .delete_vectors_blocking( + "{collection_name}", + None, + &PointsSelector { + points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList { + ids: vec![0.into(), 3.into(), 10.into()], + })), + }, + &VectorsSelector { + names: vec!["text".into(), "image".into()], + }, + None, + ) + .await?; diff --git a/snippets/rust/discover_batch_points.rs b/snippets/rust/discover_batch_points.rs new file mode 100644 index 0000000..e58d2a4 --- /dev/null +++ b/snippets/rust/discover_batch_points.rs @@ -0,0 +1,74 @@ +use qdrant_client::{ + client::QdrantClient, + qdrant::{ + target_vector::Target, vector_example::Example, ContextExamplePair, DiscoverBatchPoints, + DiscoverPoints, TargetVector, VectorExample, + }, +}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +let discover_points = &DiscoverBatchPoints { + collection_name: "{collection_name}".to_string(), + discover_points: vec![ + DiscoverPoints { + collection_name: "{collection_name}".to_string(), + target: Some(TargetVector { + target: Some(Target::Single(VectorExample { + example: Some(Example::Vector(vec![0.2, 0.1, 0.9, 0.7].into())), + })), + }), + context: vec![ + ContextExamplePair { + positive: Some(VectorExample { + example: Some(Example::Id(100.into())), + }), + negative: Some(VectorExample { + example: Some(Example::Id(718.into())), + }), + }, + ContextExamplePair { + positive: Some(VectorExample { + example: Some(Example::Id(200.into())), + }), + negative: Some(VectorExample { + example: Some(Example::Id(300.into())), + }), + }, + ], + limit: 10, + ..Default::default() + }, + DiscoverPoints { + collection_name: "{collection_name}".to_string(), + target: Some(TargetVector { + target: Some(Target::Single(VectorExample { + example: Some(Example::Vector(vec![0.5, 0.3, 0.2, 0.3].into())), + })), + }), + context: vec![ + ContextExamplePair { + positive: Some(VectorExample { + example: Some(Example::Id(342.into())), + }), + negative: Some(VectorExample { + example: Some(Example::Id(213.into())), + }), + }, + ContextExamplePair { + positive: Some(VectorExample { + example: Some(Example::Id(100.into())), + }), + negative: Some(VectorExample { + example: Some(Example::Id(200.into())), + }), + }, + ], + limit: 10, + ..Default::default() + }, + ], + ..Default::default() +}; + +client.discover_batch(discover_points).await?; diff --git a/snippets/rust/discover_points.rs b/snippets/rust/discover_points.rs new file mode 100644 index 0000000..a3c8cd5 --- /dev/null +++ b/snippets/rust/discover_points.rs @@ -0,0 +1,40 @@ +use qdrant_client::{ + client::QdrantClient, + qdrant::{ + target_vector::Target, vector_example::Example, ContextExamplePair, DiscoverPoints, + TargetVector, VectorExample, + }, +}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .discover(&DiscoverPoints { + collection_name: "{collection_name}".to_string(), + target: Some(TargetVector { + target: Some(Target::Single(VectorExample { + example: Some(Example::Vector(vec![0.2, 0.1, 0.9, 0.7].into())), + })), + }), + context: vec![ + ContextExamplePair { + positive: Some(VectorExample { + example: Some(Example::Id(100.into())), + }), + negative: Some(VectorExample { + example: Some(Example::Id(718.into())), + }), + }, + ContextExamplePair { + positive: Some(VectorExample { + example: Some(Example::Id(200.into())), + }), + negative: Some(VectorExample { + example: Some(Example::Id(300.into())), + }), + }, + ], + limit: 10, + ..Default::default() + }) + .await?; diff --git a/snippets/rust/get_collection.rs b/snippets/rust/get_collection.rs new file mode 100644 index 0000000..325f3f4 --- /dev/null +++ b/snippets/rust/get_collection.rs @@ -0,0 +1,5 @@ +use qdrant_client::client::QdrantClient; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client.collection_info("{collection_name}").await?; diff --git a/snippets/rust/get_collection_aliases.rs b/snippets/rust/get_collection_aliases.rs new file mode 100644 index 0000000..1068b60 --- /dev/null +++ b/snippets/rust/get_collection_aliases.rs @@ -0,0 +1,5 @@ +use qdrant_client::client::QdrantClient; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client.list_collection_aliases("{collection_name}").await?; diff --git a/snippets/rust/get_collections.rs b/snippets/rust/get_collections.rs new file mode 100644 index 0000000..64becc2 --- /dev/null +++ b/snippets/rust/get_collections.rs @@ -0,0 +1,5 @@ +use qdrant_client::client::QdrantClient; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client.list_collections().await?; diff --git a/snippets/rust/get_collections_aliases.rs b/snippets/rust/get_collections_aliases.rs new file mode 100644 index 0000000..0ef8cdc --- /dev/null +++ b/snippets/rust/get_collections_aliases.rs @@ -0,0 +1,5 @@ +use qdrant_client::client::QdrantClient; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client.list_aliases().await?; diff --git a/snippets/rust/get_points.rs b/snippets/rust/get_points.rs new file mode 100644 index 0000000..a640479 --- /dev/null +++ b/snippets/rust/get_points.rs @@ -0,0 +1,14 @@ +use qdrant_client::client::QdrantClient; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .get_points( + "{collection_name}", + None, + &[0.into(), 30.into(), 100.into()], + Some(false), + Some(false), + None, + ) + .await?; diff --git a/snippets/rust/list_full_snapshots.rs b/snippets/rust/list_full_snapshots.rs new file mode 100644 index 0000000..38e625f --- /dev/null +++ b/snippets/rust/list_full_snapshots.rs @@ -0,0 +1,5 @@ +use qdrant_client::client::QdrantClient; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client.list_full_snapshots().await?; diff --git a/snippets/rust/list_snapshots.rs b/snippets/rust/list_snapshots.rs new file mode 100644 index 0000000..2877b6a --- /dev/null +++ b/snippets/rust/list_snapshots.rs @@ -0,0 +1,5 @@ +use qdrant_client::client::QdrantClient; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client.list_snapshots("{collection_name}").await?; diff --git a/snippets/rust/overwrite_payload.rs b/snippets/rust/overwrite_payload.rs new file mode 100644 index 0000000..0e57cd3 --- /dev/null +++ b/snippets/rust/overwrite_payload.rs @@ -0,0 +1,24 @@ +use qdrant_client::{client::QdrantClient, qdrant::{ + points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector, +}}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .overwrite_payload_blocking( + "{collection_name}", + None, + &PointsSelector { + points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList { + ids: vec![0.into(), 3.into(), 10.into()], + })), + }, + json!({ + "property1": "string", + "property2": "string", + }) + .try_into() + .unwrap(), + None, + ) + .await?; diff --git a/snippets/rust/recommend_batch_points.rs b/snippets/rust/recommend_batch_points.rs new file mode 100644 index 0000000..b438041 --- /dev/null +++ b/snippets/rust/recommend_batch_points.rs @@ -0,0 +1,35 @@ +use qdrant_client::{ + client::QdrantClient, + qdrant::{Condition, Filter, RecommendBatchPoints, RecommendPoints}, +}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +let filter = Filter::must([Condition::matches("city", "London".to_string())]); + +let recommend_queries = vec![ + RecommendPoints { + collection_name: "{collection_name}".to_string(), + positive: vec![100.into(), 231.into()], + negative: vec![718.into()], + filter: Some(filter.clone()), + limit: 3, + ..Default::default() + }, + RecommendPoints { + collection_name: "{collection_name}".to_string(), + positive: vec![200.into(), 67.into()], + negative: vec![300.into()], + filter: Some(filter), + limit: 3, + ..Default::default() + }, +]; + +client + .recommend_batch(&RecommendBatchPoints { + collection_name: "{collection_name}".to_string(), + recommend_points: recommend_queries, + ..Default::default() + }) + .await?; diff --git a/snippets/rust/recommend_point_groups.rs b/snippets/rust/recommend_point_groups.rs new file mode 100644 index 0000000..106bfc8 --- /dev/null +++ b/snippets/rust/recommend_point_groups.rs @@ -0,0 +1,19 @@ +use qdrant_client::{ + client::QdrantClient, + qdrant::{RecommendPointGroups, RecommendStrategy}, +}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .recommend_groups(&RecommendPointGroups { + collection_name: "{collection_name}".to_string(), + group_by: "document_id".to_string(), + group_size: 2, + positive: vec![100.into(), 200.into()], + negative: vec![718.into()], + strategy: Some(RecommendStrategy::AverageVector.into()), + limit: 3, + ..Default::default() + }) + .await?; diff --git a/snippets/rust/recommend_points.rs b/snippets/rust/recommend_points.rs new file mode 100644 index 0000000..c8dd7e4 --- /dev/null +++ b/snippets/rust/recommend_points.rs @@ -0,0 +1,23 @@ +use qdrant_client::{ + client::QdrantClient, + qdrant::{Condition, Filter, RecommendPoints, RecommendStrategy}, +}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .recommend(&RecommendPoints { + collection_name: "{collection_name}".to_string(), + positive: vec![100.into(), 200.into()], + positive_vectors: vec![vec![100.0, 231.0].into()], + negative: vec![718.into()], + negative_vectors: vec![vec![0.2, 0.3, 0.4, 0.5].into()], + strategy: Some(RecommendStrategy::AverageVector.into()), + filter: Some(Filter::must([Condition::matches( + "city", + "London".to_string(), + )])), + limit: 3, + ..Default::default() + }) + .await?; diff --git a/snippets/rust/scroll_points.rs b/snippets/rust/scroll_points.rs new file mode 100644 index 0000000..0453d9f --- /dev/null +++ b/snippets/rust/scroll_points.rs @@ -0,0 +1,17 @@ +use qdrant_client::{client::QdrantClient, qdrant::{Condition, Filter, ScrollPoints}}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .scroll(&ScrollPoints { + collection_name: "{collection_name}".to_string(), + filter: Some(Filter::must([Condition::matches( + "color", + "red".to_string(), + )])), + limit: Some(1), + with_payload: Some(true.into()), + with_vectors: Some(false.into()), + ..Default::default() + }) + .await?; diff --git a/snippets/rust/search_batch_points.rs b/snippets/rust/search_batch_points.rs new file mode 100644 index 0000000..d83739f --- /dev/null +++ b/snippets/rust/search_batch_points.rs @@ -0,0 +1,34 @@ +use qdrant_client::{ + client::QdrantClient, + qdrant::{Condition, Filter, SearchBatchPoints, SearchPoints}, +}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +let filter = Filter::must([Condition::matches("city", "London".to_string())]); + +let searches = vec![ + SearchPoints { + collection_name: "{collection_name}".to_string(), + vector: vec![0.2, 0.1, 0.9, 0.7], + filter: Some(filter.clone()), + limit: 3, + ..Default::default() + }, + SearchPoints { + collection_name: "{collection_name}".to_string(), + vector: vec![0.5, 0.3, 0.2, 0.3], + filter: Some(filter), + limit: 3, + ..Default::default() + }, +]; + +client + .search_batch_points(&SearchBatchPoints { + collection_name: "{collection_name}".to_string(), + search_points: searches, + read_consistency: None, + ..Default::default() + }) + .await?; diff --git a/snippets/rust/search_point_groups.rs b/snippets/rust/search_point_groups.rs new file mode 100644 index 0000000..a4a4a09 --- /dev/null +++ b/snippets/rust/search_point_groups.rs @@ -0,0 +1,17 @@ +use qdrant_client::{ + client::QdrantClient, + qdrant::SearchPointGroups, +}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .search_groups(&SearchPointGroups { + collection_name: "{collection_name}".to_string(), + vector: vec![1.1], + group_by: "document_id".to_string(), + limit: 4, + group_size: 2, + ..Default::default() + }) + .await?; diff --git a/snippets/rust/search_points.rs b/snippets/rust/search_points.rs new file mode 100644 index 0000000..45aed82 --- /dev/null +++ b/snippets/rust/search_points.rs @@ -0,0 +1,24 @@ +use qdrant_client::{ + client::QdrantClient, + qdrant::{Condition, Filter, SearchParams, SearchPoints}, +}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .search_points(&SearchPoints { + collection_name: "{collection_name}".to_string(), + filter: Some(Filter::must([Condition::matches( + "city", + "London".to_string(), + )])), + params: Some(SearchParams { + hnsw_ef: Some(128), + exact: Some(false), + ..Default::default() + }), + vector: vec![0.2, 0.1, 0.9, 0.7], + limit: 3, + ..Default::default() + }) + .await?; diff --git a/snippets/rust/set_payload.rs b/snippets/rust/set_payload.rs new file mode 100644 index 0000000..8ab04f9 --- /dev/null +++ b/snippets/rust/set_payload.rs @@ -0,0 +1,24 @@ +use qdrant_client::{client::QdrantClient, qdrant::{ + points_selector::PointsSelectorOneOf, PointsIdsList, PointsSelector, +}}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .set_payload_blocking( + "{collection_name}", + None, + &PointsSelector { + points_selector_one_of: Some(PointsSelectorOneOf::Points(PointsIdsList { + ids: vec![0.into(), 3.into(), 10.into()], + })), + }, + json!({ + "property1": "string", + "property2": "string", + }) + .try_into() + .unwrap(), + None, + ) + .await?; diff --git a/snippets/rust/update_aliases.rs b/snippets/rust/update_aliases.rs new file mode 100644 index 0000000..007afa9 --- /dev/null +++ b/snippets/rust/update_aliases.rs @@ -0,0 +1,7 @@ +use qdrant_client::client::QdrantClient; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client.create_alias("example_collection", "production_collection").await?; + +client.delete_alias("production_collection").await?; diff --git a/snippets/rust/update_collection.rs b/snippets/rust/update_collection.rs new file mode 100644 index 0000000..e6a5a2d --- /dev/null +++ b/snippets/rust/update_collection.rs @@ -0,0 +1,18 @@ +use qdrant_client::{client::QdrantClient, qdrant::OptimizersConfigDiff}; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .update_collection( + "{collection_name}", + Some(&OptimizersConfigDiff { + indexing_threshold: Some(10000), + ..Default::default() + }), + None, + None, + None, + None, + None, + ) + .await?; diff --git a/snippets/rust/update_vectors.rs b/snippets/rust/update_vectors.rs new file mode 100644 index 0000000..e898939 --- /dev/null +++ b/snippets/rust/update_vectors.rs @@ -0,0 +1,28 @@ +use qdrant_client::qdrant::PointVectors; +use std::collections::HashMap; + +client + .update_vectors_blocking( + "{collection_name}", + None, + &[ + PointVectors { + id: Some(1.into()), + vectors: Some( + HashMap::from([("image".to_string(), vec![0.1, 0.2, 0.3, 0.4])]).into(), + ), + }, + PointVectors { + id: Some(2.into()), + vectors: Some( + HashMap::from([( + "text".to_string(), + vec![0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2], + )]) + .into(), + ), + }, + ], + None, + ) + .await?; diff --git a/snippets/rust/upsert_points.rs b/snippets/rust/upsert_points.rs new file mode 100644 index 0000000..b7f0d77 --- /dev/null +++ b/snippets/rust/upsert_points.rs @@ -0,0 +1,42 @@ +use qdrant_client::{client::QdrantClient, qdrant::PointStruct}; +use serde_json::json; + +let client = QdrantClient::from_url("http://localhost:6334").build()?; + +client + .upsert_points_batch_blocking( + "{collection_name}".to_string(), + None, + vec![ + PointStruct::new( + 1, + vec![0.9, 0.1, 0.1], + json!( + {"color": "red"} + ) + .try_into() + .unwrap(), + ), + PointStruct::new( + 2, + vec![0.1, 0.9, 0.1], + json!( + {"color": "green"} + ) + .try_into() + .unwrap(), + ), + PointStruct::new( + 3, + vec![0.1, 0.1, 0.9], + json!( + {"color": "blue"} + ) + .try_into() + .unwrap(), + ), + ], + None, + 100, + ) + .await?; diff --git a/snippets/typescript/batch_update.ts b/snippets/typescript/batch_update.ts new file mode 100644 index 0000000..94f2361 --- /dev/null +++ b/snippets/typescript/batch_update.ts @@ -0,0 +1,38 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.batchUpdate("{collection_name}", { + operations: [ + { + upsert: { + points: [ + { + id: 1, + vector: [1.0, 2.0, 3.0, 4.0], + payload: {}, + }, + ], + }, + }, + { + update_vectors: { + points: [ + { + id: 1, + vector: [1.0, 2.0, 3.0, 4.0], + }, + ], + }, + }, + { + set_payload: { + payload: { + test_payload_2: 2, + test_payload_3: 3, + }, + points: [1], + }, + }, + ], +}); diff --git a/snippets/typescript/clear_payload.ts b/snippets/typescript/clear_payload.ts new file mode 100644 index 0000000..492d915 --- /dev/null +++ b/snippets/typescript/clear_payload.ts @@ -0,0 +1,7 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.clearPayload("{collection_name}", { + points: [0, 3, 100], +}); diff --git a/snippets/typescript/count_points.ts b/snippets/typescript/count_points.ts new file mode 100644 index 0000000..4d803b0 --- /dev/null +++ b/snippets/typescript/count_points.ts @@ -0,0 +1,17 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.count("{collection_name}", { + filter: { + must: [ + { + key: "color", + match: { + value: "red", + }, + }, + ], + }, + exact: true, +}); diff --git a/snippets/typescript/create_collection.ts b/snippets/typescript/create_collection.ts new file mode 100644 index 0000000..a22ff1a --- /dev/null +++ b/snippets/typescript/create_collection.ts @@ -0,0 +1,7 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.createCollection("{collection_name}", { + vectors: { size: 100, distance: "Cosine" }, +}); diff --git a/snippets/typescript/create_field_index.ts b/snippets/typescript/create_field_index.ts new file mode 100644 index 0000000..9b9af7e --- /dev/null +++ b/snippets/typescript/create_field_index.ts @@ -0,0 +1,8 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.createPayloadIndex("{collection_name}", { + field_name: "{field_name}", + field_schema: "keyword", +}); diff --git a/snippets/typescript/create_full_snapshot.ts b/snippets/typescript/create_full_snapshot.ts new file mode 100644 index 0000000..9232146 --- /dev/null +++ b/snippets/typescript/create_full_snapshot.ts @@ -0,0 +1,5 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.createFullSnapshot(); diff --git a/snippets/typescript/create_shard_key.ts b/snippets/typescript/create_shard_key.ts new file mode 100644 index 0000000..434ca10 --- /dev/null +++ b/snippets/typescript/create_shard_key.ts @@ -0,0 +1,10 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ + host: "localhost", + port: 6333 +}); + +client.createShardKey("{collection_name}", { + shard_key: "{shard_key}" +}); diff --git a/snippets/typescript/create_snapshot.ts b/snippets/typescript/create_snapshot.ts new file mode 100644 index 0000000..6b88b7b --- /dev/null +++ b/snippets/typescript/create_snapshot.ts @@ -0,0 +1,5 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.createSnapshot("{collection_name}"); diff --git a/snippets/typescript/delete_collection.ts b/snippets/typescript/delete_collection.ts new file mode 100644 index 0000000..d623fe6 --- /dev/null +++ b/snippets/typescript/delete_collection.ts @@ -0,0 +1,5 @@ +import { QdrantClient } from '@qdrant/qdrant-js'; + +const client = new QdrantClient({url: 'http://127.0.0.1:6333'}); + +client.deleteCollection("{collection_name}"); diff --git a/snippets/typescript/delete_field_index.ts b/snippets/typescript/delete_field_index.ts new file mode 100644 index 0000000..6257b62 --- /dev/null +++ b/snippets/typescript/delete_field_index.ts @@ -0,0 +1,5 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.deletePayloadIndex("{collection_name}", "{field_name}"); diff --git a/snippets/typescript/delete_full_snapshot.ts b/snippets/typescript/delete_full_snapshot.ts new file mode 100644 index 0000000..b436a73 --- /dev/null +++ b/snippets/typescript/delete_full_snapshot.ts @@ -0,0 +1,5 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.deleteFullSnapshot("{snapshot_name}"); diff --git a/snippets/typescript/delete_payload.ts b/snippets/typescript/delete_payload.ts new file mode 100644 index 0000000..dd4dfc2 --- /dev/null +++ b/snippets/typescript/delete_payload.ts @@ -0,0 +1,8 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.deletePayload("{collection_name}", { + keys: ["color", "price"], + points: [0, 3, 100], +}); diff --git a/snippets/typescript/delete_points.ts b/snippets/typescript/delete_points.ts new file mode 100644 index 0000000..e4b0374 --- /dev/null +++ b/snippets/typescript/delete_points.ts @@ -0,0 +1,20 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.delete("{collection_name}", { + points: [0, 3, 100], +}); + +client.delete("{collection_name}", { + filter: { + must: [ + { + key: "color", + match: { + value: "red", + }, + }, + ], + }, +}); diff --git a/snippets/typescript/delete_shard_key.ts b/snippets/typescript/delete_shard_key.ts new file mode 100644 index 0000000..72f6ca0 --- /dev/null +++ b/snippets/typescript/delete_shard_key.ts @@ -0,0 +1,10 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ + host: "localhost", + port: 6333 +}); + +client.deleteShardKey("{collection_name}", { + shard_key: "{shard_key}" +}); diff --git a/snippets/typescript/delete_snapshot.ts b/snippets/typescript/delete_snapshot.ts new file mode 100644 index 0000000..6460b6f --- /dev/null +++ b/snippets/typescript/delete_snapshot.ts @@ -0,0 +1,5 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.deleteSnapshot("{collection_name}", "{snapshot_name}"); diff --git a/snippets/typescript/delete_vectors.ts b/snippets/typescript/delete_vectors.ts new file mode 100644 index 0000000..2947373 --- /dev/null +++ b/snippets/typescript/delete_vectors.ts @@ -0,0 +1,8 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.deleteVectors("{collection_name}", { + points: [0, 3, 10], + vectors: ["text", "image"], +}); diff --git a/snippets/typescript/discover_batch_points.ts b/snippets/typescript/discover_batch_points.ts new file mode 100644 index 0000000..98525a7 --- /dev/null +++ b/snippets/typescript/discover_batch_points.ts @@ -0,0 +1,38 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +const searches = [ + { + target: [0.2, 0.1, 0.9, 0.7], + context: [ + { + positive: 100, + negative: 718, + }, + { + positive: 200, + negative: 300, + }, + ], + limit: 10, + }, + { + target: [0.5, 0.3, 0.2, 0.3], + context: [ + { + positive: 342, + negative: 213, + }, + { + positive: 100, + negative: 200, + }, + ], + limit: 5, + }, +]; + +client.discoverBatchPoints("{collection_name}", { + searches, +}); diff --git a/snippets/typescript/discover_points.ts b/snippets/typescript/discover_points.ts new file mode 100644 index 0000000..54caa63 --- /dev/null +++ b/snippets/typescript/discover_points.ts @@ -0,0 +1,18 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.discover("{collection_name}", { + target: [0.2, 0.1, 0.9, 0.7], + context: [ + { + positive: 100, + negative: 718, + }, + { + positive: 200, + negative: 300, + }, + ], + limit: 10, +}); diff --git a/snippets/typescript/get_collection.ts b/snippets/typescript/get_collection.ts new file mode 100644 index 0000000..d95e3e2 --- /dev/null +++ b/snippets/typescript/get_collection.ts @@ -0,0 +1,5 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.getCollection("{collection_name}"); diff --git a/snippets/typescript/get_collection_aliases.ts b/snippets/typescript/get_collection_aliases.ts new file mode 100644 index 0000000..0651184 --- /dev/null +++ b/snippets/typescript/get_collection_aliases.ts @@ -0,0 +1,5 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.getCollectionAliases("{collection_name}"); diff --git a/snippets/typescript/get_collections.ts b/snippets/typescript/get_collections.ts new file mode 100644 index 0000000..d281fa5 --- /dev/null +++ b/snippets/typescript/get_collections.ts @@ -0,0 +1,5 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.getCollections(); diff --git a/snippets/typescript/get_collections_aliases.ts b/snippets/typescript/get_collections_aliases.ts new file mode 100644 index 0000000..59ae4ab --- /dev/null +++ b/snippets/typescript/get_collections_aliases.ts @@ -0,0 +1,5 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.getAliases(); diff --git a/snippets/typescript/get_points.ts b/snippets/typescript/get_points.ts new file mode 100644 index 0000000..6190ea2 --- /dev/null +++ b/snippets/typescript/get_points.ts @@ -0,0 +1,7 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.retrieve("{collection_name}", { + ids: [0, 3, 100], +}); diff --git a/snippets/typescript/list_full_snapshots.ts b/snippets/typescript/list_full_snapshots.ts new file mode 100644 index 0000000..8101155 --- /dev/null +++ b/snippets/typescript/list_full_snapshots.ts @@ -0,0 +1,5 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.listFullSnapshots(); diff --git a/snippets/typescript/list_snapshots.ts b/snippets/typescript/list_snapshots.ts new file mode 100644 index 0000000..52ad162 --- /dev/null +++ b/snippets/typescript/list_snapshots.ts @@ -0,0 +1,5 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.listSnapshots("{collection_name}"); diff --git a/snippets/typescript/overwrite_payload.ts b/snippets/typescript/overwrite_payload.ts new file mode 100644 index 0000000..616541f --- /dev/null +++ b/snippets/typescript/overwrite_payload.ts @@ -0,0 +1,11 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.overwritePayload("{collection_name}", { + payload: { + property1: "string", + property2: "string", + }, + points: [0, 3, 10], +}); diff --git a/snippets/typescript/recommend_batch_points.ts b/snippets/typescript/recommend_batch_points.ts new file mode 100644 index 0000000..7bf1a9c --- /dev/null +++ b/snippets/typescript/recommend_batch_points.ts @@ -0,0 +1,20 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +const searches = [ + { + positive: [100, 231], + negative: [718], + limit: 3, + }, + { + positive: [200, 67], + negative: [300], + limit: 3, + }, +]; + +client.recommend_batch("{collection_name}", { + searches, +}); diff --git a/snippets/typescript/recommend_point_groups.ts b/snippets/typescript/recommend_point_groups.ts new file mode 100644 index 0000000..cc9666f --- /dev/null +++ b/snippets/typescript/recommend_point_groups.ts @@ -0,0 +1,11 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.recommendPointGroups("{collection_name}", { + positive: [100, 231], + negative: [718], + group_by: "document_id", + limit: 3, + group_size: 2, +}); diff --git a/snippets/typescript/recommend_points.ts b/snippets/typescript/recommend_points.ts new file mode 100644 index 0000000..ad72aad --- /dev/null +++ b/snippets/typescript/recommend_points.ts @@ -0,0 +1,20 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.recommend("{collection_name}", { + positive: [100, 231], + negative: [718, [0.2, 0.3, 0.4, 0.5]], + strategy: "average_vector", + filter: { + must: [ + { + key: "city", + match: { + value: "London", + }, + }, + ], + }, + limit: 3, +}); diff --git a/snippets/typescript/recover_from_snapshot.ts b/snippets/typescript/recover_from_snapshot.ts new file mode 100644 index 0000000..8c5a8fc --- /dev/null +++ b/snippets/typescript/recover_from_snapshot.ts @@ -0,0 +1,7 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.recoverSnapshot("{collection_name}", { + location: "http://example.com/path/to/snapshot.shapshot", +}); diff --git a/snippets/typescript/scroll_points.ts b/snippets/typescript/scroll_points.ts new file mode 100644 index 0000000..b4906ac --- /dev/null +++ b/snippets/typescript/scroll_points.ts @@ -0,0 +1,19 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.scroll("{collection_name}", { + filter: { + must: [ + { + key: "color", + match: { + value: "red", + }, + }, + ], + }, + limit: 1, + with_payload: true, + with_vector: false, +}); diff --git a/snippets/typescript/search_batch_points.ts b/snippets/typescript/search_batch_points.ts new file mode 100644 index 0000000..220e929 --- /dev/null +++ b/snippets/typescript/search_batch_points.ts @@ -0,0 +1,31 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +const filter = { + must: [ + { + key: "city", + match: { + value: "London", + }, + }, + ], +}; + +const searches = [ + { + vector: [0.2, 0.1, 0.9, 0.7], + filter, + limit: 3, + }, + { + vector: [0.5, 0.3, 0.2, 0.3], + filter, + limit: 3, + }, +]; + +client.searchBatch("{collection_name}", { + searches, +}); diff --git a/snippets/typescript/search_point_groups.ts b/snippets/typescript/search_point_groups.ts new file mode 100644 index 0000000..2b7c507 --- /dev/null +++ b/snippets/typescript/search_point_groups.ts @@ -0,0 +1,10 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.searchPointGroups("{collection_name}", { + vector: [1.1], + group_by: "document_id", + limit: 4, + group_size: 2, +}); diff --git a/snippets/typescript/search_points.ts b/snippets/typescript/search_points.ts new file mode 100644 index 0000000..7f067a7 --- /dev/null +++ b/snippets/typescript/search_points.ts @@ -0,0 +1,18 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.search("{collection_name}", { + filter: { + must: [ + { + key: "city", + match: { + value: "London", + }, + }, + ], + }, + vector: [0.2, 0.1, 0.9, 0.7], + limit: 3, +}); diff --git a/snippets/typescript/set_payload.ts b/snippets/typescript/set_payload.ts new file mode 100644 index 0000000..ccb33f2 --- /dev/null +++ b/snippets/typescript/set_payload.ts @@ -0,0 +1,11 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.setPayload("{collection_name}", { + payload: { + property1: "string", + property2: "string", + }, + points: [0, 3, 10], +}); diff --git a/snippets/typescript/update_aliases.ts b/snippets/typescript/update_aliases.ts new file mode 100644 index 0000000..9eaaf3e --- /dev/null +++ b/snippets/typescript/update_aliases.ts @@ -0,0 +1,24 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.updateCollectionAliases({ + actions: [ + { + create_alias: { + collection_name: "example_collection", + alias_name: "production_collection", + }, + }, + ], +}); + +client.updateCollectionAliases({ + actions: [ + { + delete_alias: { + alias_name: "production_collection", + }, + }, + ], +}); diff --git a/snippets/typescript/update_collection.ts b/snippets/typescript/update_collection.ts new file mode 100644 index 0000000..bd29327 --- /dev/null +++ b/snippets/typescript/update_collection.ts @@ -0,0 +1,9 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.updateCollection("{collection_name}", { + optimizers_config: { + indexing_threshold: 10000, + }, +}); diff --git a/snippets/typescript/update_vectors.ts b/snippets/typescript/update_vectors.ts new file mode 100644 index 0000000..dd40dfd --- /dev/null +++ b/snippets/typescript/update_vectors.ts @@ -0,0 +1,20 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.updateVectors("{collection_name}", { + points: [ + { + id: 1, + vector: { + image: [0.1, 0.2, 0.3, 0.4], + }, + }, + { + id: 2, + vector: { + text: [0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2], + }, + }, + ], +}); diff --git a/snippets/typescript/upsert_points.ts b/snippets/typescript/upsert_points.ts new file mode 100644 index 0000000..dd33c91 --- /dev/null +++ b/snippets/typescript/upsert_points.ts @@ -0,0 +1,23 @@ +import { QdrantClient } from "@qdrant/js-client-rest"; + +const client = new QdrantClient({ host: "localhost", port: 6333 }); + +client.upsert("{collection_name}", { + points: [ + { + id: 1, + payload: { color: "red" }, + vector: [0.9, 0.1, 0.1], + }, + { + id: 2, + payload: { color: "green" }, + vector: [0.1, 0.9, 0.1], + }, + { + id: 3, + payload: { color: "blue" }, + vector: [0.1, 0.1, 0.9], + }, + ], +}); diff --git a/tools/generate_snippet_overwrites.py b/tools/generate_snippet_overwrites.py new file mode 100644 index 0000000..e37614d --- /dev/null +++ b/tools/generate_snippet_overwrites.py @@ -0,0 +1,160 @@ + +import argparse +from collections import defaultdict +import json +import glob +import yaml +import os + + +FILE_EXTENSION_BY_SDK = { + 'python': '.py', + 'javascript': '.js', + 'typescript': '.ts', + 'java': '.java', + 'csharp': '.cs', + 'go': '.go', + 'php': '.php', + 'ruby': '.rb', + 'swift': '.swift', + 'kotlin': '.kt', + 'rust': '.rs', + 'scala': '.scala', + 'dart': '.dart', + 'bash': '.sh', + 'txt': '.txt', + 'plaintext': '.txt' +} + + +def parse_openapi_spec(path: str): + """ + Load the OpenAPI specs and generate mapping of the endpoints to operation operationId + """ + + with open(path, 'r') as f: + openapi_spec = json.load(f) + + paths = openapi_spec['paths'] + operation_mapping = {} + for path, path_spec in paths.items(): + for method, method_spec in path_spec.items(): + operation_mapping[method_spec['operationId']] = [path, method] + return operation_mapping + + +def create_empty_file(path: str): + # make sure directory exists + os.makedirs(os.path.dirname(path), exist_ok=True) + + with open(path, 'w') as f: + f.write('') + +def get_file_content_if_exists(path: str): + try: + with open(path, 'r') as f: + return f.read() + except FileNotFoundError: + return '' + + +def convert_snippets_to_yaml_format(overwrites: dict) -> dict: + """ + Convert to someting like this: + paths: + /collections/{collection_name}/shards: + put: + x-fern-examples: + - code-samples: + - sdk: python + code: CODE + """ + yaml_overwrites = {} + for path, methods in overwrites.items(): + yaml_overwrites[path] = {} + for method, sdks in methods.items(): + yaml_overwrites[path][method] = { + 'x-fern-examples': [] + } + for sdk, code in sdks.items(): + yaml_overwrites[path][method]['x-fern-examples'].append({ + 'code-samples': [ + { + 'language': sdk, + 'code': code + } + ] + }) + return { + "paths": yaml_overwrites + } + + +def main(): + parser = argparse.ArgumentParser(description='Generate snippet overwrites for the OpenAPI spec') + parser.add_argument('--openapi', type=str, help='Path to the OpenAPI spec') + parser.add_argument('--output', type=str, help='Path to the snippet overwrite file') + args = parser.parse_args() + + operation_mapping = parse_openapi_spec(args.openapi) + + # reverse_mapping = defaultdict(dict) + + # for operation_id, endpoint in operation_mapping.items(): + # reverse_mapping[endpoint[0]][endpoint[1]] = operation_id + + + # with open("fern/apis/master/openapi-overrides.yml", 'r') as f: + # existing_mappings = yaml.load(f, Loader=yaml.FullLoader) + + + # for path, path_obj in existing_mappings['paths'].items(): + # for method, method_obj in path_obj.items(): + # code_samples = method_obj.get('x-fern-examples', [{}])[0].get('code-samples', []) + + # for code_sample in code_samples: + # sdk = code_sample['language'] + # code = code_sample['code'] + + # operation_id = reverse_mapping.get(path, {}).get(method) + # if not operation_id: + # print(f"Operation not found for {path} {method}") + # continue + + # snippet_file = f"snippets/{sdk}/{operation_id}{FILE_EXTENSION_BY_SDK.get(sdk, '.txt')}" + + # create_empty_file(snippet_file) + + # with open(snippet_file, 'w') as f: + # f.write(code) + + + + all_sdks = [sdk.split('/')[-1] for sdk in glob.glob("snippets/*")] + + overwrites = defaultdict(lambda: defaultdict(dict)) + + for sdk in all_sdks: + file_extension = FILE_EXTENSION_BY_SDK.get(sdk, '.txt') + for operation_id, endpoint in operation_mapping.items(): + + snippet_file = f"snippets/{sdk}/{operation_id}{file_extension}" + + file_content = get_file_content_if_exists(snippet_file) + + if not file_content or file_content.strip() == '': + print(f"No snippet found for {operation_id} in {sdk}") + continue + + api_path, method = endpoint + + overwrites[api_path][method][sdk] = file_content + + yaml_overwrites = convert_snippets_to_yaml_format(overwrites) + + with open(args.output, 'w') as f: + yaml.dump(yaml_overwrites, f) + + +if __name__ == '__main__': + main() diff --git a/tools/sync-openapi.sh b/tools/sync-openapi.sh index 8035aad..e8db99e 100644 --- a/tools/sync-openapi.sh +++ b/tools/sync-openapi.sh @@ -23,6 +23,13 @@ cd $PROJECT_ROOT cp qdrant/docs/redoc/master/openapi.json $PROJECT_ROOT/fern/apis/master/openapi.json +# Generate fern overwrites from the snippets + +python tools/generate_snippet_overwrites.py --openapi qdrant/docs/redoc/master/openapi.json --output overwrite-snippets.yml + +# Merge the overwrites with the template + +./yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' fern/openapi-overrides-template.yml overwrite-snippets.yml > $PROJECT_ROOT/fern/apis/master/openapi-overrides.yml # Find latest version inside the repository `docs/redoc` starting with `v*` @@ -76,6 +83,3 @@ done ./yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' $PROJECT_ROOT/fern/docs.yml $VERSIONS_TMP_YAML > $PROJECT_ROOT/fern/docs.tmp.yml mv $PROJECT_ROOT/fern/docs.tmp.yml $PROJECT_ROOT/fern/docs.yml - - -