### Recommend Points (Python) Source: https://api.qdrant.tech/api-reference/search/query-points This example demonstrates how to get recommendations based on a set of positive and negative example vectors. It's useful for personalized search or content suggestions. ```python # Recommend on the average of these vectors recommended = client.query_points( collection_name="{collection_name}", query=models.RecommendQuery(recommend=models.RecommendInput( positive=["43cf51e2-8777-4f52-bc74-c2cbde0c8b04", [0.11, 0.35, 0.6, ...]], negative=[[0.01, 0.45, 0.67, ...]] )) ) ``` -------------------------------- ### Recommend Points (C#) Source: https://api.qdrant.tech/api-reference/search/query-points This example demonstrates how to get recommendations based on a set of positive and negative example vectors. It's useful for personalized search or content suggestions. ```csharp await client.QueryAsync( collectionName: "{collection_name}", query: new RecommendInput { Positive = { Guid.Parse("43cf51e2-8777-4f52-bc74-c2cbde0c8b04"), new float[] { 0.11f, 0.35f, 0.6f } }, Negative = { new float[] { 0.01f, 0.45f, 0.67f } } } ); ``` -------------------------------- ### Go SDK for Readiness Probe Source: https://api.qdrant.tech/api-reference/service/readyz Example using Go's standard net/http package to make a GET request to the /readyz endpoint. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "http://localhost:6333/readyz" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("api-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### List Collections using Qdrant Go SDK Source: https://api.qdrant.tech/api-reference/collections/get-collections Provides a Go example for listing collections. It includes context setup and error handling. ```go package client import ( "context" "fmt" "github.com/qdrant/go-client/qdrant" ) func listCollections() { client, err := qdrant.NewClient(&qdrant.Config{ Host: "localhost", Port: 6334, }) if err != nil { panic(err) } collections, err := client.ListCollections(context.Background()) if err != nil { panic(err) } fmt.Println("Collections: ", collections) } ``` -------------------------------- ### Java SDK for Readiness Probe (Unirest) Source: https://api.qdrant.tech/api-reference/service/readyz Example using the Unirest library in Java to perform a GET request to the /readyz endpoint. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("http://localhost:6333/readyz") .header("api-key", "") .asString(); ``` -------------------------------- ### Retrieve Instance Details with Ruby Source: https://api.qdrant.tech/api-reference/service/root A Ruby example demonstrating how to fetch Qdrant instance details using Net::HTTP. It shows setting the API key and making the GET request. ```ruby require 'uri' require 'net/http' url = URI("http://localhost:6333/") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Get.new(url) request["api-key"] = '' response = http.request(request) puts response.read_body ``` -------------------------------- ### Ruby SDK Example for Liveness Probe Source: https://api.qdrant.tech/api-reference/service/livez Demonstrates how to make a GET request to the /livez endpoint using Ruby's Net::HTTP library. ```ruby require 'uri' require 'net/http' url = URI("http://localhost:6333/livez") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Get.new(url) request["api-key"] = '' response = http.request(request) puts response.read_body ``` -------------------------------- ### Retrieve Points (Go) Source: https://api.qdrant.tech/api-reference/points/get-points Example of retrieving points using the Qdrant Go client. This snippet demonstrates client initialization and the Get method for fetching points by IDs. ```go package client import ( "context" "fmt" "github.com/qdrant/go-client/qdrant" ) func getPoints() { client, err := qdrant.NewClient(&qdrant.Config{ Host: "localhost", Port: 6334, }) if err != nil { panic(err) } points, err := client.Get(context.Background(), &qdrant.GetPoints{ CollectionName: "{collection_name}", Ids: []*qdrant.PointId{ qdrant.NewIDNum(0), qdrant.NewID("3"), qdrant.NewIDNum(100), }, }) if err != nil { panic(err) } fmt.Println("Points: ", points) } ``` -------------------------------- ### List Full Snapshots (PHP) Source: https://api.qdrant.tech/api-reference/snapshots/list-full-snapshots This PHP example uses Guzzle HTTP client to make a GET request to the Qdrant API for listing snapshots. An API key is required for authentication. ```php request('GET', 'http://localhost:6333/snapshots', [ 'headers' => [ 'api-key' => '', ], ]); echo $response->getBody(); ``` -------------------------------- ### Create Full Snapshot (Java) Source: https://api.qdrant.tech/api-reference/snapshots/create-full-snapshot Set up the Qdrant client with host and port, then call createFullSnapshotAsync. ```java import io.qdrant.client.QdrantClient; import io.qdrant.client.QdrantGrpcClient; QdrantClient client = new QdrantClient( QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); client.createFullSnapshotAsync().get(); ``` -------------------------------- ### Get Cluster Status (PHP) Source: https://api.qdrant.tech/api-reference/distributed/cluster-status This PHP example uses the Guzzle HTTP client to get the cluster status. It includes the API key in the request headers. Make sure you have Guzzle installed via Composer and replace `` with your actual API key. ```php request('GET', 'http://localhost:6333/cluster', [ 'headers' => [ 'api-key' => '', ], ]); echo $response->getBody(); ?> ``` -------------------------------- ### Discover Points using Go SDK Source: https://api.qdrant.tech/api-reference/search/discover-points This Go example demonstrates discovering points using the Qdrant Go client. It shows how to configure the client and construct a query for discovering points with context. ```go package client import ( "context" "fmt" "github.com/qdrant/go-client/qdrant" ) func discover() { client, err := qdrant.NewClient(&qdrant.Config{ Host: "localhost", Port: 6334, }) if err != nil { panic(err) } results, err := client.Query(context.Background(), &qdrant.QueryPoints{ CollectionName: "{collection_name}", Query: qdrant.NewQueryDiscover(&qdrant.DiscoverInput{ Target: qdrant.NewVectorInput(0.2, 0.1, 0.9, 0.7), Context: &qdrant.ContextInput{ Pairs: []*qdrant.ContextInputPair{{ Positive: qdrant.NewVectorInputID(qdrant.NewIDNum(100)), Negative: qdrant.NewVectorInputID(qdrant.NewIDNum(718)), }, { Positive: qdrant.NewVectorInputID(qdrant.NewIDNum(200)), Negative: qdrant.NewVectorInputID(qdrant.NewIDNum(300)), }}, }, }), }) if err != nil { panic(err) } fmt.Println("Results: ", results) } ``` -------------------------------- ### Get Issues API Response Example Source: https://api.qdrant.tech/api-reference/beta/get-issues An example of a successful JSON response from the GET /issues endpoint. ```json {} ``` -------------------------------- ### Get Point using PHP GuzzleHttp Source: https://api.qdrant.tech/api-reference/points/get-point Retrieve a point using the GuzzleHttp client in PHP. This example shows how to set up the request with headers and echo the response body. Ensure you have GuzzleHttp installed via Composer. Replace '' with your actual API key. ```php request('GET', 'http://localhost:6333/collections/collection_name/points/42', [ 'headers' => [ 'api-key' => '', ], ]); echo $response->getBody(); ?> ``` -------------------------------- ### Get Collection Cluster Info (C#) Source: https://api.qdrant.tech/api-reference/distributed/collection-cluster-info Use the RestSharp library in C# to get collection cluster information. This example configures the GET request and adds the API key header. ```csharp using RestSharp; var client = new RestClient("http://localhost:6333/collections/collection_name/cluster"); var request = new RestRequest(Method.GET); request.AddHeader("api-key", ""); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Create Full Snapshot (Go) Source: https://api.qdrant.tech/api-reference/snapshots/create-full-snapshot Configure the Qdrant client and use the CreateFullSnapshot method with a background context. ```go package client import ( "context" "fmt" "github.com/qdrant/go-client/qdrant" ) func createFullSnapshot() { client, err := qdrant.NewClient(&qdrant.Config{ Host: "localhost", Port: 6334, }) if err != nil { panic(err) } snapshot, err := client.CreateFullSnapshot(context.Background()) if err != nil { panic(err) } fmt.Println("Snapshot created: ", snapshot.Name) } ``` -------------------------------- ### List Full Snapshots (Go) Source: https://api.qdrant.tech/api-reference/snapshots/list-full-snapshots Fetch all full snapshots using the Qdrant Go client. This example demonstrates basic client initialization and error handling. ```go package client import ( "context" "fmt" "github.com/qdrant/go-client/qdrant" ) func listFullSnapshots() { client, err := qdrant.NewClient(&qdrant.Config{ Host: "localhost", Port: 6334, }) if err != nil { panic(err) } snapshots, err := client.ListFullSnapshots(context.Background()) if err != nil { panic(err) } fmt.Println("Full snapshots: ", snapshots) } ``` -------------------------------- ### Get Collection Info (Ruby) Source: https://api.qdrant.tech/api-reference/collections/get-collection Retrieve collection information using Ruby's Net::HTTP. This example shows how to construct the GET request with necessary headers. ```ruby require 'uri' require 'net/http' url = URI("http://localhost:6333/collections/collection_name") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Get.new(url) request["api-key"] = '' response = http.request(request) puts response.read_body ``` -------------------------------- ### Get Collection Info (Rust) Source: https://api.qdrant.tech/api-reference/collections/get-collection Use the Qdrant Rust client to get collection information. This example demonstrates building the client from a URL and making the API call. ```rust use qdrant_client::Qdrant; let client = Qdrant::from_url("http://localhost:6334").build()?; client.collection_info("{collection_name}").await?; ``` -------------------------------- ### Get Collection Optimizations Status (JavaScript) Source: https://api.qdrant.tech/api-reference/collections/get-optimizations Fetch the optimization status of a collection using JavaScript. This example demonstrates how to make a GET request and handle the JSON response. ```javascript const url = 'http://localhost:6333/collections/collection_name/optimizations'; const options = {method: 'GET', headers: {'api-key': ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Go SDK - Discover Batch Source: https://api.qdrant.tech/api-reference/search/discover-batch-points Example using the Go SDK to perform batch discovery. It shows how to initialize the client, construct batch query points with discover queries, and execute the batch query. ```APIDOC ## Go SDK - Discover Batch This example demonstrates how to use the Go client to perform a batch discovery of points. It constructs a `QueryBatchPoints` object with multiple `QueryPoints` each containing a `QueryDiscover`. ### Method Signature ```go client.QueryBatch(context.Background(), &qdrant.QueryBatchPoints{...}) ``` ### Request Body Example ```json { "collection_name": "{collection_name}", "query_points": [ { "collection_name": "{collection_name}", "query": { "discover": { "target": { "single": { "vector": [0.2, 0.1, 0.9, 0.7] } }, "context": { "pairs": [ { "positive": {"id": {"num": 100}}, "negative": {"id": {"num": 718}} }, { "positive": {"id": {"num": 200}}, "negative": {"id": {"num": 300}} } ] } } } }, { "collection_name": "{collection_name}", "query": { "discover": { "target": { "single": { "vector": [0.5, 0.3, 0.2, 0.3] } }, "context": { "pairs": [ { "positive": {"id": {"num": 342}}, "negative": {"id": {"num": 213}} }, { "positive": {"id": {"num": 100}}, "negative": {"id": {"num": 200}} } ] } } } } ] } ``` ``` -------------------------------- ### C# SDK Example for Liveness Probe Source: https://api.qdrant.tech/api-reference/service/livez Example using the RestSharp library in C# to make a GET request to the /livez endpoint. Add the RestSharp NuGet package to your project. ```csharp using RestSharp; var client = new RestClient("http://localhost:6333/livez"); var request = new RestRequest(Method.GET); request.AddHeader("api-key", ""); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Recommend Groups using Go SDK Source: https://api.qdrant.tech/api-reference/search/recommend-point-groups Example of how to use the Qdrant Go SDK to recommend point groups. Requires go-client. ```go package client import ( "context" "fmt" "github.com/qdrant/go-client/qdrant" ) func recommendGroups() { client, err := qdrant.NewClient(&qdrant.Config{ Host: "localhost", Port: 6334, }) if err != nil { panic(err) } groupSize := uint64(5) results, err := client.QueryGroups(context.Background(), &qdrant.QueryPointGroups{ CollectionName: "{collection_name}", Query: qdrant.NewQueryRecommend(&qdrant.RecommendInput{ Positive: []*qdrant.VectorInput{ qdrant.NewVectorInputID(qdrant.NewIDNum(100)), qdrant.NewVectorInputID(qdrant.NewIDNum(231)), }, Negative: []*qdrant.VectorInput{ qdrant.NewVectorInputID(qdrant.NewIDNum(718)), }, }), GroupBy: "document_id", GroupSize: &groupSize, }) if err != nil { panic(err) } fmt.Println("Results: ", results) } ``` -------------------------------- ### Recommend Points (Swift) Source: https://api.qdrant.tech/api-reference/search/recommend-points Example of how to recommend points using Swift. This snippet demonstrates setting up headers and the request body for the API call. ```swift import Foundation let headers = [ "api-key": "", "Content-Type": "application/json" ] let parameters = ["limit": 1] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:6333/collections/collection_name/points/recommend")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Get Collection Cluster Info (JavaScript) Source: https://api.qdrant.tech/api-reference/distributed/collection-cluster-info Fetch collection cluster details using JavaScript's fetch API. This example demonstrates a GET request with an API key header. ```javascript const url = 'http://localhost:6333/collections/collection_name/cluster'; const options = {method: 'GET', headers: {'api-key': ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Create Full Snapshot (Rust) Source: https://api.qdrant.tech/api-reference/snapshots/create-full-snapshot Initialize the Qdrant client from a URL and execute the snapshot creation. ```rust use qdrant_client::Qdrant; let client = Qdrant::from_url("http://localhost:6334").build()?; client.create_full_snapshot().await?; ``` -------------------------------- ### Get Issues using Python Requests Source: https://api.qdrant.tech/api-reference/beta/get-issues How to call the GET /issues endpoint using the Python Requests library. Ensure you have the library installed and replace '' with your actual API key. ```python import requests url = "http://localhost:6333/issues" headers = {"api-key": ""} response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Recommend Points using Go SDK Source: https://api.qdrant.tech/api-reference/search/recommend-points This Go code snippet demonstrates how to recommend points using the Qdrant client. It shows how to set up the client, define positive and negative inputs (IDs or vectors), specify a strategy, and apply a filter. ```go package client import ( "context" "fmt" "github.com/qdrant/go-client/qdrant" ) func recommend() { client, err := qdrant.NewClient(&qdrant.Config{ Host: "localhost", Port: 6334, }) if err != nil { panic(err) } results, err := client.Query(context.Background(), &qdrant.QueryPoints{ CollectionName: "{collection_name}", Query: qdrant.NewQueryRecommend(&qdrant.RecommendInput{ Positive: []*qdrant.VectorInput{ qdrant.NewVectorInputID(qdrant.NewIDNum(100)), qdrant.NewVectorInputID(qdrant.NewIDNum(231)), }, Negative: []*qdrant.VectorInput{ qdrant.NewVectorInputID(qdrant.NewIDNum(718)), qdrant.NewVectorInput(0.2, 0.3, 0.4, 0.5), }, Strategy: qdrant.RecommendStrategy_AverageVector.Enum(), }), Filter: &qdrant.Filter{ Must: []*qdrant.Condition{ qdrant.NewMatch("city", "London"), }, }, }) if err != nil { panic(err) } fmt.Println("Results: ", results) } ``` -------------------------------- ### List Snapshots via HTTP GET Request (Swift) Source: https://api.qdrant.tech/api-reference/snapshots/list-snapshots Example of listing snapshots for a collection using Swift's URLSession. It configures an NSMutableURLRequest with the necessary headers and makes the GET request. ```swift import Foundation let headers = ["api-key": ""] let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:6333/collections/collection_name/snapshots")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Retrieve Instance Details with JavaScript (Fetch API) Source: https://api.qdrant.tech/api-reference/service/root Use the Fetch API in JavaScript to get instance details. This example demonstrates making a GET request with the required API key header. ```javascript const url = 'http://localhost:6333/'; const options = {method: 'GET', headers: {'api-key': ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### List Collections using Qdrant C# SDK Source: https://api.qdrant.tech/api-reference/collections/get-collections Demonstrates how to list all collections using the Qdrant C# SDK. Ensure you have initialized the QdrantClient with your host and port. ```csharp using Qdrant.Client; var client = new QdrantClient("localhost", 6334); await client.ListCollectionsAsync(); ``` -------------------------------- ### Ruby SDK for Readiness Probe Source: https://api.qdrant.tech/api-reference/service/readyz Demonstrates how to check the Qdrant instance's readiness using Ruby's Net::HTTP library. ```ruby require 'uri' require 'net/http' url = URI("http://localhost:6333/readyz") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Get.new(url) request["api-key"] = '' response = http.request(request) puts response.read_body ``` -------------------------------- ### Get Collection Optimizations Status (Ruby) Source: https://api.qdrant.tech/api-reference/collections/get-optimizations Make a GET request in Ruby to retrieve collection optimization status. This example includes setting the API key header and printing the response body. ```ruby require 'uri' require 'net/http' url = URI("http://localhost:6333/collections/collection_name/optimizations") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Get.new(url) request["api-key"] = '' response = http.request(request) puts response.read_body ``` -------------------------------- ### Create Collection Example Source: https://api.qdrant.tech/api-reference/collections/create-collection This Swift example demonstrates how to create a collection using the Qdrant API. It includes basic error handling and response logging. ```swift let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Get Aliases via HTTP (Swift) Source: https://api.qdrant.tech/api-reference/aliases/get-collections-aliases Perform an HTTP GET request to retrieve aliases using Swift's URLSession. This example shows how to set up the request with headers and handle the response. ```swift import Foundation let headers = ["api-key": ""] let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:6333/aliases")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Recommend Groups using C# SDK Source: https://api.qdrant.tech/api-reference/search/recommend-point-groups Example of how to use the Qdrant C# SDK to recommend point groups. Requires Qdrant.Client NuGet package. ```csharp 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 ); ``` -------------------------------- ### Get Issues using PHP Guzzle Source: https://api.qdrant.tech/api-reference/beta/get-issues How to call the GET /issues endpoint using the PHP Guzzle HTTP client. Ensure you have Guzzle installed via Composer and replace '' with your actual API key. ```php request('GET', 'http://localhost:6333/issues', [ 'headers' => [ 'api-key' => '', ], ]); echo $response->getBody(); ?> ``` -------------------------------- ### Discover Points Source: https://api.qdrant.tech/api-reference/search/discover-points Discover points similar to a target vector, using context examples to guide the search. This method is useful for finding points that are semantically related to a query, with the ability to provide positive and negative examples to influence the results. ```APIDOC ## POST /discover/{collection_name} ### Description Discover points similar to a target vector, using context examples to guide the search. This method is useful for finding points that are semantically related to a query, with the ability to provide positive and negative examples to influence the results. ### Method POST ### Endpoint /discover/{collection_name} ### Parameters #### Query Parameters - **limit** (integer) - Optional - The maximum number of points to return. #### Request Body - **target** (object) - Required - Defines the target vector for discovery. - **single** (object) - Required - Specifies a single vector example. - **vector** (array[number]) - Required - The target vector. - **multi** (object) - Optional - Specifies multiple named vectors. - **vector** (string) - Required - The name of the vector. - **values** (array[number]) - Required - The target vector values. - **context** (array[object]) - Required - A list of context examples to refine the search. - **positive** (object) - Required - A positive example. - **id** (integer | string) - Required - The ID of the positive example point. - **vector** (array[number]) - Optional - The vector of the positive example. - **negative** (object) - Required - A negative example. - **id** (integer | string) - Required - The ID of the negative example point. - **vector** (array[number]) - Optional - The vector of the negative example. ### Request Example ```json { "limit": 1, "target": { "single": { "vector": [0.2, 0.1, 0.9, 0.7] } }, "context": [ { "positive": {"id": 100}, "negative": {"id": 718} }, { "positive": {"id": 200}, "negative": {"id": 300} } ] } ``` ### Response #### Success Response (200) - **usage** (object) - Information about resource usage. - **hardware** (object) - Hardware resource usage. - **cpu** (integer) - CPU time used. - **payload_io_read** (integer) - Payload read I/O operations. - **payload_io_write** (integer) - Payload write I/O operations. - **payload_index_io_read** (integer) - Payload index read I/O operations. - **payload_index_io_write** (integer) - Payload index write I/O operations. - **vector_io_read** (integer) - Vector read I/O operations. - **vector_io_write** (integer) - Vector write I/O operations. - **inference** (object) - Inference resource usage. - **models** (object) - Details about inference models used. - **time** (number) - The time taken for the operation in seconds. - **status** (string) - The status of the operation (e.g., "ok"). - **result** (array[object]) - A list of discovered points. - **id** (integer | string) - The ID of the point. - **version** (integer) - The version of the point. - **score** (number) - The relevance score of the point. - **payload** (object) - The payload associated with the point. - **vector** (object) - The vector associated with the point. - **shard_key** (string) - The shard key of the point. - **order_value** (number) - The order value of the point. #### Response Example ```json { "usage": { "hardware": { "cpu": 1, "payload_io_read": 1, "payload_io_write": 1, "payload_index_io_read": 1, "payload_index_io_write": 1, "vector_io_read": 1, "vector_io_write": 1 }, "inference": { "models": {} } }, "time": 0.002, "status": "ok", "result": [ { "id": 42, "version": 3, "score": 0.75, "payload": {}, "vector": {}, "shard_key": "region_1", "order_value": 42 } ] } ``` ``` -------------------------------- ### List Aliases (Go) Source: https://api.qdrant.tech/api-reference/aliases/get-collections-aliases Retrieve aliases using the Go client for Qdrant. This example demonstrates client initialization and making the ListAliases call with context. ```go package client import ( "context" "fmt" "github.com/qdrant/go-client/qdrant" ) func listAliases() { client, err := qdrant.NewClient(&qdrant.Config{ Host: "localhost", Port: 6334, }) if err != nil { panic(err) } aliases, err := client.ListAliases(context.Background()) if err != nil { panic(err) } fmt.Println("Aliases: ", aliases) } ``` -------------------------------- ### Get Point using Java Unirest Source: https://api.qdrant.tech/api-reference/points/get-point Fetch a point using the Unirest library in Java. This example demonstrates a concise way to make the GET request with the required API key header. Replace '' with your actual API key. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("http://localhost:6333/collections/collection_name/points/42") .header("api-key", "") .asString(); ``` -------------------------------- ### Recommend Groups using Java SDK Source: https://api.qdrant.tech/api-reference/search/recommend-point-groups Example of how to use the Qdrant Java SDK to recommend point groups. Requires qdrant-client library. ```java 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()); ``` -------------------------------- ### C# SDK for Readiness Probe (RestSharp) Source: https://api.qdrant.tech/api-reference/service/readyz Example using the RestSharp library in C# to make a GET request to the /readyz endpoint. ```csharp using RestSharp; var client = new RestClient("http://localhost:6333/readyz"); var request = new RestRequest(Method.GET); request.AddHeader("api-key", ""); IRestResponse response = client.Execute(request); ``` -------------------------------- ### List Full Snapshots (Swift) Source: https://api.qdrant.tech/api-reference/snapshots/list-full-snapshots This Swift example demonstrates how to fetch full snapshots using URLSession. It includes setting up the request with necessary headers and handling the response. ```swift import Foundation let headers = ["api-key": ""] let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:6333/snapshots")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Go SDK Example for Liveness Probe Source: https://api.qdrant.tech/api-reference/service/livez Example of how to check the liveness probe endpoint using Go's standard net/http package. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "http://localhost:6333/livez" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("api-key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Example JSON Request for Get Points Source: https://api.qdrant.tech/api-reference/points/get-points A sample JSON payload for requesting points by their IDs. This format is used in direct HTTP requests. ```json { "ids": [ 42 ] } ``` -------------------------------- ### List Snapshots using Go SDK Source: https://api.qdrant.tech/api-reference/snapshots/list-snapshots Provides a Go example for listing snapshots of a collection. It includes error handling and prints the retrieved snapshots. ```go package client import ( "context" "fmt" "github.com/qdrant/go-client/qdrant" ) func listSnapshots() { client, err := qdrant.NewClient(&qdrant.Config{ Host: "localhost", Port: 6334, }) if err != nil { panic(err) } snapshots, err := client.ListSnapshots(context.Background(), "{collection_name}") if err != nil { panic(err) } fmt.Println("Snapshots: ", snapshots) } ``` -------------------------------- ### Create Full Snapshot (Python) Source: https://api.qdrant.tech/api-reference/snapshots/create-full-snapshot Instantiate the Qdrant client and call the create_full_snapshot method. ```python from qdrant_client import QdrantClient client = QdrantClient(url="http://localhost:6333") client.create_full_snapshot() ``` -------------------------------- ### Download Snapshot using Java Unirest Source: https://api.qdrant.tech/api-reference/snapshots/get-full-snapshot Example of downloading a snapshot using the Java Unirest library. Note the setup required for Unirest. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("http://localhost:6333/snapshots/snapshot_name") .header("api-key", "") .asString(); ``` -------------------------------- ### PHP: Initialize Client Source: https://api.qdrant.tech/api-reference/points/batch-update This PHP snippet shows the basic setup for initializing the Qdrant client using Guzzle HTTP. Further operations would follow this initialization. ```php request('POST', 'http://localhost:6333/collections/collection_name/points/recommend', [ 'body' => '{ "limit": 1 }', 'headers' => [ 'Content-Type' => 'application/json', 'api-key' => '', ], ]); echo $response->getBody(); ?> ``` -------------------------------- ### Recommend Points (Ruby) Source: https://api.qdrant.tech/api-reference/search/recommend-points Example of how to recommend points using Ruby. This snippet shows a basic request with a limit. ```Ruby request.body = "{\"limit\": 1}" response = http.request(request) puts response.read_body ``` -------------------------------- ### Recommend Groups using Python SDK Source: https://api.qdrant.tech/api-reference/search/recommend-point-groups Example of how to use the Qdrant Python SDK to recommend point groups. Requires qdrant-client package. ```python 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, ) ``` -------------------------------- ### Get Collection Info (TypeScript) Source: https://api.qdrant.tech/api-reference/collections/get-collection Fetch collection details using the Qdrant TypeScript client. This example demonstrates initializing the client and making the request. ```typescript import { QdrantClient } from "@qdrant/js-client-rest"; const client = new QdrantClient({ host: "localhost", port: 6333 }); client.getCollection("{collection_name}"); ``` -------------------------------- ### List Full Snapshots (TypeScript) Source: https://api.qdrant.tech/api-reference/snapshots/list-full-snapshots Use the Qdrant client for JavaScript/TypeScript to list full snapshots. Initialize the client with the host and port of your Qdrant instance. ```typescript import { QdrantClient } from "@qdrant/js-client-rest"; const client = new QdrantClient({ host: "localhost", port: 6333 }); client.listFullSnapshots(); ``` -------------------------------- ### Python SDK Example for Liveness Probe Source: https://api.qdrant.tech/api-reference/service/livez Demonstrates how to call the /livez endpoint using the Python requests library. Ensure you have the 'requests' library installed. ```python import requests url = "http://localhost:6333/livez" headers = {"api-key": ""} response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### List Collections using Qdrant Python SDK Source: https://api.qdrant.tech/api-reference/collections/get-collections Shows how to get a list of all collections with the Qdrant Python SDK. Initialize the client with the correct URL. ```python from qdrant_client import QdrantClient client = QdrantClient(url="http://localhost:6333") client.get_collections() ```