> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://api.qdrant.tech/v-1-17-x/api-reference/search/query-points/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.qdrant.tech/_mcp/server. # Query points POST http://localhost:6333/collections/{collection_name}/points/query Content-Type: application/json Universally query points. This endpoint covers all capabilities of search, recommend, discover, filters. But also enables hybrid and multi-stage queries. Reference: https://api.qdrant.tech/api-reference/search/query-points ## Authentication - `api-key` header (required) — API Key authentication via header ## Servers - `http://localhost:6333` (http, default) - `https://localhost:6333` (https) ## Request ### Path parameters - `collection_name` (string, required) — Name of the collection to query ### Query parameters - `consistency` (ReadConsistency, optional) — Define read consistency guarantees for the operation - `timeout` (integer, optional) — If set, overrides global timeout for this request. Unit is seconds. ### Body (application/json) This endpoint expects a QueryRequest. - `shard_key` (QueryRequestShardKey, optional) - `prefetch` (QueryRequestPrefetch, optional) — Sub-requests to perform first. If present, the query will be performed on the results of the prefetch(es). - `query` (QueryRequestQuery, optional) — Query to perform. If missing without prefetches, returns points ordered by their IDs. - `using` (string, optional, nullable) — Define which vector name to use for querying. If missing, the default vector is used. - `filter` (QueryRequestFilter, optional) — Filter conditions - return only those points that satisfy the specified conditions. - `params` (QueryRequestParams, optional) — Search params for when there is no prefetch - `score_threshold` (double, optional, nullable) — Return points with scores better than this threshold. - `limit` (integer, optional, nullable) — Max number of points to return. Default is 10. - `offset` (integer, optional, nullable) — Offset of the result. Skip this many points. Default is 0 - `with_vector` (QueryRequestWithVector, optional) — Options for specifying which vectors to include into the response. Default is false. - `with_payload` (QueryRequestWithPayload, optional) — Options for specifying which payload to include or not. Default is false. - `lookup_from` (QueryRequestLookupFrom, optional) — The location to use for IDs lookup, if not specified - use the current collection and the 'using' vector Note: the other collection vectors should have the same vector size as the 'using' vector in the current collection ## Response ### 200 successful operation - `usage` (CollectionsCollectionNamePointsQueryPostResponsesContentApplicationJsonSchemaUsage, optional) - `time` (double, optional) — Time spent to process this request - `status` (string, optional) - `result` (QueryResponse, optional) ## Types ### QueryRequestShardKey ### QueryRequestPrefetch Sub-requests to perform first. If present, the query will be performed on the results of the prefetch(es). ### QueryRequestQuery Query to perform. If missing without prefetches, returns points ordered by their IDs. ### QueryRequestFilter Filter conditions - return only those points that satisfy the specified conditions. ### QueryRequestParams Search params for when there is no prefetch ### QueryRequestWithVector Options for specifying which vectors to include into the response. Default is false. ### QueryRequestWithPayload Options for specifying which payload to include or not. Default is false. ### QueryRequestLookupFrom The location to use for IDs lookup, if not specified - use the current collection and the 'using' vector Note: the other collection vectors should have the same vector size as the 'using' vector in the current collection ### ReadConsistency Read consistency parameter Defines how many replicas should be queried to get the result * `N` - send N random request and return points, which present on all of them * `majority` - send N/2+1 random request and return points, which present on all of them * `quorum` - send requests to all nodes and return points which present on majority of them * `all` - send requests to all nodes and return points which present on all of them Default value is `Factor(1)` ### CollectionsCollectionNamePointsQueryPostResponsesContentApplicationJsonSchemaUsage ### QueryResponse - `points` (list of ScoredPoint, required) ### Prefetch - `prefetch` (PrefetchPrefetch, optional) — Sub-requests to perform first. If present, the query will be performed on the results of the prefetches. - `query` (PrefetchQuery, optional) — Query to perform. If missing without prefetches, returns points ordered by their IDs. - `using` (string, optional, nullable) — Define which vector name to use for querying. If missing, the default vector is used. - `filter` (PrefetchFilter, optional) — Filter conditions - return only those points that satisfy the specified conditions. - `params` (PrefetchParams, optional) — Search params for when there is no prefetch - `score_threshold` (double, optional, nullable) — Return points with scores better than this threshold. - `limit` (integer, optional, nullable) — Max number of points to return. Default is 10. - `lookup_from` (PrefetchLookupFrom, optional) — The location to use for IDs lookup, if not specified - use the current collection and the 'using' vector Note: the other collection vectors should have the same vector size as the 'using' vector in the current collection ### Filter - `should` (FilterShould, optional) — At least one of those conditions should match - `min_should` (FilterMinShould, optional) — At least minimum amount of given conditions should match - `must` (FilterMust, optional) — All conditions must match - `must_not` (FilterMustNot, optional) — All conditions must NOT match ### SearchParams Additional parameters of the search - `hnsw_ef` (integer, optional, nullable) — Params relevant to HNSW index Size of the beam in a beam-search. Larger the value - more accurate the result, more time required for search. - `exact` (boolean, optional, default: false) — Search without approximation. If set to true, search may run long but with exact results. - `quantization` (SearchParamsQuantization, optional) — Quantization params - `indexed_only` (boolean, optional, default: false) — If enabled, the engine will only perform search among indexed or small segments. Using this option prevents slow searches in case of delayed index, but does not guarantee that all uploaded vectors will be included in search results - `acorn` (SearchParamsAcorn, optional) — ACORN search params ### LookupLocation Defines a location to use for looking up the vector. Specifies collection and vector field name. - `collection` (string, required) — Name of the collection used for lookup - `vector` (string, optional, nullable) — Optional name of the vector field within the collection. If not provided, the default vector field will be used. - `shard_key` (LookupLocationShardKey, optional) — Specify in which shards to look for the points, if not specified - look in all shards ### Usage Usage of the hardware resources, spent to process the request - `hardware` (UsageHardware, optional) - `inference` (UsageInference, optional) ### ScoredPoint Search result - `id` (ExtendedPointId, required) — Type, used for specifying point ID in user interface - `version` (uint64, required) — Point version - `score` (double, required) — Points vector distance to the query vector - `payload` (ScoredPointPayload, optional) — Payload - values assigned to the point - `vector` (ScoredPointVector, optional) — Vector of the point - `shard_key` (ScoredPointShardKey, optional) — Shard Key - `order_value` (ScoredPointOrderValue, optional) — Order-by value ### PrefetchPrefetch Sub-requests to perform first. If present, the query will be performed on the results of the prefetches. ### PrefetchQuery Query to perform. If missing without prefetches, returns points ordered by their IDs. ### PrefetchFilter Filter conditions - return only those points that satisfy the specified conditions. ### PrefetchParams Search params for when there is no prefetch ### PrefetchLookupFrom The location to use for IDs lookup, if not specified - use the current collection and the 'using' vector Note: the other collection vectors should have the same vector size as the 'using' vector in the current collection ### FilterShould At least one of those conditions should match ### FilterMinShould At least minimum amount of given conditions should match ### FilterMust All conditions must match ### FilterMustNot All conditions must NOT match ### SearchParamsQuantization Quantization params ### SearchParamsAcorn ACORN search params ### LookupLocationShardKey Specify in which shards to look for the points, if not specified - look in all shards ### UsageHardware ### UsageInference ### ExtendedPointId Type, used for specifying point ID in user interface ### ScoredPointPayload Payload - values assigned to the point ### ScoredPointVector Vector of the point ### ScoredPointShardKey Shard Key ### ScoredPointOrderValue Order-by value ### MinShould - `conditions` (list of Condition, required) - `min_count` (integer, required) ### QuantizationSearchParams Additional parameters of the search - `ignore` (boolean, optional, default: false) — If true, quantized vectors are ignored. Default is false. - `rescore` (boolean, optional, nullable) — If true, use original vectors to re-score top-k results. Might require more time in case if original vectors are stored on disk. If not set, qdrant decides automatically apply rescoring or not. - `oversampling` (double, optional, nullable) — Oversampling factor for quantization. Default is 1.0. Defines how many extra vectors should be pre-selected using quantized index, and then re-scored using original vectors. For example, if `oversampling` is 2.4 and `limit` is 100, then 240 vectors will be pre-selected using quantized index, and then top-100 will be returned after re-scoring. ### AcornSearchParams ACORN-related search parameters - `enable` (boolean, optional, default: false) — If true, then ACORN may be used for the HNSW search based on filters selectivity. Improves search recall for searches with multiple low-selectivity payload filters, at cost of performance. - `max_selectivity` (double, optional, nullable) — Maximum selectivity of filters to enable ACORN. If estimated filters selectivity is higher than this value, ACORN will not be used. Selectivity is estimated as: `estimated number of points satisfying the filters / total number of points`. 0.0 for never, 1.0 for always. Default is 0.4. ### HardwareUsage Usage of the hardware resources, spent to process the request - `cpu` (integer, required) - `payload_io_read` (integer, required) - `payload_io_write` (integer, required) - `payload_index_io_read` (integer, required) - `payload_index_io_write` (integer, required) - `vector_io_read` (integer, required) - `vector_io_write` (integer, required) ### InferenceUsage - `models` (map from string to ModelUsage, required) ### Condition ### ModelUsage - `tokens` (uint64, required) ### FieldCondition All possible payload filtering conditions - `key` (string, required) — Payload key - `match` (FieldConditionMatch, optional) — Check if point has field with a given value - `range` (FieldConditionRange, optional) — Check if points value lies in a given range - `geo_bounding_box` (FieldConditionGeoBoundingBox, optional) — Check if points geolocation lies in a given area - `geo_radius` (FieldConditionGeoRadius, optional) — Check if geo point is within a given radius - `geo_polygon` (FieldConditionGeoPolygon, optional) — Check if geo point is within a given polygon - `values_count` (FieldConditionValuesCount, optional) — Check number of values of the field - `is_empty` (boolean, optional, nullable) — Check that the field is empty, alternative syntax for `is_empty: "field_name"` - `is_null` (boolean, optional, nullable) — Check that the field is null, alternative syntax for `is_null: "field_name"` ### IsEmptyCondition Select points with empty payload for a specified field - `is_empty` (PayloadField, required) — Payload field ### IsNullCondition Select points with null payload for a specified field - `is_null` (PayloadField, required) — Payload field ### HasIdCondition ID-based filtering condition - `has_id` (list of ExtendedPointId, required) ### HasVectorCondition Filter points which have specific vector assigned - `has_vector` (string, required) ### NestedCondition - `nested` (Nested, required) — Select points with payload for a specified nested field ### FieldConditionMatch Check if point has field with a given value ### FieldConditionRange Check if points value lies in a given range ### FieldConditionGeoBoundingBox Check if points geolocation lies in a given area ### FieldConditionGeoRadius Check if geo point is within a given radius ### FieldConditionGeoPolygon Check if geo point is within a given polygon ### FieldConditionValuesCount Check number of values of the field ### PayloadField Payload field - `key` (string, required) — Payload field name ### Nested Select points with payload for a specified nested field - `key` (string, required) - `filter` (Filter, required) ### GeoBoundingBox Geo filter request Matches coordinates inside the rectangle, described by coordinates of lop-left and bottom-right edges - `top_left` (GeoPoint, required) — Geo point payload schema - `bottom_right` (GeoPoint, required) — Geo point payload schema ### GeoRadius Geo filter request Matches coordinates inside the circle of `radius` and center with coordinates `center` - `center` (GeoPoint, required) — Geo point payload schema - `radius` (double, required) — Radius of the area in meters ### GeoPolygon Geo filter request Matches coordinates inside the polygon, defined by `exterior` and `interiors` - `exterior` (GeoLineString, required) — Ordered sequence of GeoPoints representing the line - `interiors` (list of GeoLineString, optional, nullable) — Interior lines (if present) bound holes within the surface each GeoLineString must consist of a minimum of 4 points, and the first and last points must be the same. ### ValuesCount Values count filter request - `lt` (integer, optional, nullable) — point.key.length() \< values\_count.lt - `gt` (integer, optional, nullable) — point.key.length() > values_count.gt - `gte` (integer, optional, nullable) — point.key.length() >= values_count.gte - `lte` (integer, optional, nullable) — point.key.length() \<= values\_count.lte ### GeoPoint Geo point payload schema - `lon` (double, required) - `lat` (double, required) ### GeoLineString Ordered sequence of GeoPoints representing the line - `points` (list of GeoPoint, required) ## Examples **Request** ```json {} ``` **Response** ```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": { "points": [ { "id": 42, "version": 3, "score": 0.75, "payload": {}, "vector": {}, "shard_key": "region_1", "order_value": 42 } ] } } ``` **SDK Code** ```python from qdrant_client import QdrantClient, models client = QdrantClient(url="http://localhost:6333") # Query nearest by ID nearest = client.query_points( collection_name="{collection_name}", query="43cf51e2-8777-4f52-bc74-c2cbde0c8b04", ) # 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, ...]] )) ) # Fusion query hybrid = client.query_points( collection_name="{collection_name}", prefetch=[ models.Prefetch( query=models.SparseVector(indices=[1, 42], values=[0.22, 0.8]), using="sparse", limit=20, ), models.Prefetch( query=[0.01, 0.45, 0.67, ...], # <-- dense vector using="dense", limit=20, ), ], query=models.FusionQuery(fusion=models.Fusion.RRF), ) # 2-stage query refined = client.query_points( collection_name="{collection_name}", prefetch=models.Prefetch( query=[0.01, 0.45, 0.67, ...], # <-- dense vector limit=100, ), query=[ [0.1, 0.2, ...], # <─┐ [0.2, 0.1, ...], # < ├─ multi-vector [0.8, 0.9, ...], # < ┘ ], using="colbert", limit=10, ) # Random sampling (as of 1.11.0) sampled = client.query_points( collection_name="{collection_name}", query=models.SampleQuery(sample=models.Sample.RANDOM) ) # Score boost depending on payload conditions (as of 1.14.0) tag_boosted = client.query_points( collection_name="{collection_name}", prefetch=models.Prefetch( query=[0.2, 0.8, ...], # <-- dense vector limit=50 ), query=models.FormulaQuery( formula=models.SumExpression(sum=[ "$score", models.MultExpression(mult=[0.5, models.FieldCondition(key="tag", match=models.MatchAny(any=["h1", "h2", "h3", "h4"]))]), models.MultExpression(mult=[0.25, models.FieldCondition(key="tag", match=models.MatchAny(any=["p", "li"]))]) ] )) ) # Score boost geographically closer points (as of 1.14.0) geo_boosted = client.query_points( collection_name="{collection_name}", prefetch=models.Prefetch( query=[0.2, 0.8, ...], # <-- dense vector limit=50 ), query=models.FormulaQuery( formula=models.SumExpression(sum=[ "$score", models.GaussDecayExpression( gauss_decay=models.DecayParamsExpression( x=models.GeoDistance( geo_distance=models.GeoDistanceParams( origin=models.GeoPoint( lat=52.504043, lon=13.393236 ), # Berlin to="geo.location" ) ), scale=5000 # 5km ) ) ]), defaults={"geo.location": models.GeoPoint(lat=48.137154, lon=11.576124)} # Munich ) ) ``` ```java import static io.qdrant.client.QueryFactory.fusion; import static io.qdrant.client.QueryFactory.nearest; import static io.qdrant.client.QueryFactory.recommend; import static io.qdrant.client.VectorInputFactory.vectorInput; import java.util.UUID; import io.qdrant.client.QdrantClient; import io.qdrant.client.QdrantGrpcClient; import io.qdrant.client.grpc.Points.Fusion; import io.qdrant.client.grpc.Points.PrefetchQuery; import io.qdrant.client.grpc.Points.QueryPoints; import io.qdrant.client.grpc.Points.RecommendInput; QdrantClient client = new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build()); // Query nearest by ID client .queryAsync( QueryPoints.newBuilder() .setCollectionName("{collection_name}") .setQuery(nearest(UUID.fromString("43cf51e2-8777-4f52-bc74-c2cbde0c8b04"))) .build()) .get(); // Recommend on the average of these vectors client .queryAsync( QueryPoints.newBuilder() .setCollectionName("{collection_name}") .setQuery( recommend( RecommendInput.newBuilder() .addPositive(vectorInput(UUID.fromString("43cf51e2-8777-4f52-bc74-c2cbde0c8b04"))) .addPositive(vectorInput(0.11f, 0.35f, 0.6f)) .addNegative(vectorInput(0.01f, 0.45f, 0.67f)) .build())) .build()) .get(); // Fusion query client .queryAsync( QueryPoints.newBuilder() .setCollectionName("{collection_name}") .addPrefetch( PrefetchQuery.newBuilder() .setQuery(nearest(List.of(0.22f, 0.8f), List.of(1, 42))) .setUsing("sparse") .setLimit(20) .build()) .addPrefetch( PrefetchQuery.newBuilder() .setQuery(nearest(List.of(0.01f, 0.45f, 0.67f))) .setUsing("dense") .setLimit(20) .build()) .setQuery(fusion(Fusion.RRF)) .build()) .get(); // 2-stage query client .queryAsync( QueryPoints.newBuilder() .setCollectionName("{collection_name}") .addPrefetch( PrefetchQuery.newBuilder() .setQuery(nearest(0.01f, 0.45f, 0.67f)) .setLimit(100) .build()) .setQuery( nearest( new float[][] { {0.1f, 0.2f}, {0.2f, 0.1f}, {0.8f, 0.9f} })) .setUsing("colbert") .setLimit(10) .build()) .get(); // Random sampling (as of 1.11.0) client .queryAsync( QueryPoints.newBuilder() .setCollectionName("{collection_name}") .setQuery(sample(Sample.Random)) .build()) .get(); // Score boost depending on payload conditions (as of 1.14.0) client .queryAsync( QueryPoints.newBuilder() .setCollectionName("{collection_name}") .addPrefetch( PrefetchQuery.newBuilder() .setQuery(nearest(0.01f, 0.45f, 0.67f)) .setLimit(100) .build()) .setQuery( formula( Formula.newBuilder() .setExpression( sum( SumExpression.newBuilder() .addSum(variable("$score")) .addSum( mult( MultExpression.newBuilder() .addMult(constant(0.5f)) .addMult( condition( matchKeywords( "tag", List.of("h1", "h2", "h3", "h4")))) .build())) .addSum(mult(MultExpression.newBuilder() .addMult(constant(0.25f)) .addMult( condition( matchKeywords( "tag", List.of("p", "li")))) .build())) .build())) .build())) .build()) .get(); // Score boost geographically closer points (as of 1.14.0) client .queryAsync( QueryPoints.newBuilder() .setCollectionName("{collection_name}") .addPrefetch( PrefetchQuery.newBuilder() .setQuery(nearest(0.01f, 0.45f, 0.67f)) .setLimit(100) .build()) .setQuery( formula( Formula.newBuilder() .setExpression( sum( SumExpression.newBuilder() .addSum(variable("$score")) .addSum( expDecay( DecayParamsExpression.newBuilder() .setX( geoDistance( GeoDistance.newBuilder() .setOrigin( GeoPoint.newBuilder() .setLat(52.504043) .setLon(13.393236) .build()) .setTo("geo.location") .build())) .setScale(5000) .build())) .build())) .putDefaults( "geo.location", value( Map.of( "lat", value(48.137154), "lon", value(11.576124)))) .build())) .build()) .get(); ``` ```go package client import ( "context" "fmt" "github.com/qdrant/go-client/qdrant" ) func query() { client, err := qdrant.NewClient(&qdrant.Config{ Host: "localhost", Port: 6334, }) if err != nil { panic(err) } // Query nearest by ID points, err := client.Query(context.Background(), &qdrant.QueryPoints{ CollectionName: "{collection_name}", Query: qdrant.NewQueryID(qdrant.NewID("43cf51e2-8777-4f52-bc74-c2cbde0c8b04")), }) if err != nil { panic(err) } fmt.Println("Query results: ", points) // Recommend on the average of these vectors points, err = client.Query(context.Background(), &qdrant.QueryPoints{ CollectionName: "{collection_name}", Query: qdrant.NewQueryRecommend(&qdrant.RecommendInput{ Positive: []*qdrant.VectorInput{ qdrant.NewVectorInputID(qdrant.NewID("43cf51e2-8777-4f52-bc74-c2cbde0c8b04")), qdrant.NewVectorInput(0.11, 0.35, 0.6), }, Negative: []*qdrant.VectorInput{ qdrant.NewVectorInput(0.01, 0.45, 0.67), }, }), }) if err != nil { panic(err) } fmt.Println("Query results: ", points) // Fusion query points, err = client.Query(context.Background(), &qdrant.QueryPoints{ CollectionName: "{collection_name}", Prefetch: []*qdrant.PrefetchQuery{ { Query: qdrant.NewQuerySparse([]uint32{1, 42}, []float32{0.22, 0.8}), Using: qdrant.PtrOf("sparse"), }, { Query: qdrant.NewQuery(0.01, 0.45, 0.67), Using: qdrant.PtrOf("dense"), }, }, Query: qdrant.NewQueryFusion(qdrant.Fusion_RRF), }) if err != nil { panic(err) } fmt.Println("Query results: ", points) // 2-stage query points, err = client.Query(context.Background(), &qdrant.QueryPoints{ CollectionName: "{collection_name}", Prefetch: []*qdrant.PrefetchQuery{ { Query: qdrant.NewQuery(0.01, 0.45, 0.67), }, }, Query: qdrant.NewQueryMulti([][]float32{ {0.1, 0.2}, {0.2, 0.1}, {0.8, 0.9}, }), Using: qdrant.PtrOf("colbert"), }) if err != nil { panic(err) } fmt.Println("Query results: ", points) // Random sampling (as of 1.11.0) points, err = client.Query(context.Background(), &qdrant.QueryPoints{ CollectionName: "{collection_name}", Query: qdrant.NewQuerySample(qdrant.Sample_Random), }) if err != nil { panic(err) } fmt.Println("Query results: ", points) // Score boost depending on payload conditions (as of 1.14.0) points, err = client.Query(context.Background(), &qdrant.QueryPoints{ CollectionName: "{collection_name}", Prefetch: []*qdrant.PrefetchQuery{ { Query: qdrant.NewQuery(0.01, 0.45, 0.67), }, }, Query: qdrant.NewQueryFormula(&qdrant.Formula{ Expression: qdrant.NewExpressionSum(&qdrant.SumExpression{ Sum: []*qdrant.Expression{ qdrant.NewExpressionVariable("$score"), qdrant.NewExpressionMult(&qdrant.MultExpression{ Mult: []*qdrant.Expression{ qdrant.NewExpressionConstant(0.5), qdrant.NewExpressionCondition(qdrant.NewMatchKeywords("tag", "h1", "h2", "h3", "h4")), }, }), qdrant.NewExpressionMult(&qdrant.MultExpression{ Mult: []*qdrant.Expression{ qdrant.NewExpressionConstant(0.25), qdrant.NewExpressionCondition(qdrant.NewMatchKeywords("tag", "p", "li")), }, }), }, }), }), }) // Score boost geographically closer points (as of 1.14.0) client.Query(context.Background(), &qdrant.QueryPoints{ CollectionName: "{collection_name}", Prefetch: []*qdrant.PrefetchQuery{ { Query: qdrant.NewQuery(0.2, 0.8), }, }, Query: qdrant.NewQueryFormula(&qdrant.Formula{ Expression: qdrant.NewExpressionSum(&qdrant.SumExpression{ Sum: []*qdrant.Expression{ qdrant.NewExpressionVariable("$score"), qdrant.NewExpressionExpDecay(&qdrant.DecayParamsExpression{ X: qdrant.NewExpressionGeoDistance(&qdrant.GeoDistance{ Origin: &qdrant.GeoPoint{ Lat: 52.504043, Lon: 13.393236, }, To: "geo.location", }), }), }, }), Defaults: qdrant.NewValueMap(map[string]any{ "geo.location": map[string]any{ "lat": 48.137154, "lon": 11.576124, }, }), }), }) } ``` ```typescript import { QdrantClient } from "@qdrant/js-client-rest"; const client = new QdrantClient({ host: "localhost", port: 6333 }); // Query nearest by ID let _nearest = client.query("{collection_name", { query: "43cf51e2-8777-4f52-bc74-c2cbde0c8b04" }); // Recommend on the average of these vectors let _recommendations = client.query("{collection_name}", { query: { recommend: { positive: ["43cf51e2-8777-4f52-bc74-c2cbde0c8b04", [0.11, 0.35, 0.6]], negative: [0.01, 0.45, 0.67] } } }); // Fusion query let _hybrid = client.query("{collection_name}", { prefetch: [ { query: { values: [0.22, 0.8], indices: [1, 42], }, using: 'sparse', limit: 20, }, { query: [0.01, 0.45, 0.67], using: 'dense', limit: 20, }, ], query: { fusion: 'rrf', }, }); // 2-stage query let _refined = client.query("{collection_name}", { prefetch: { query: [1, 23, 45, 67], limit: 100, }, query: [ [0.1, 0.2], [0.2, 0.1], [0.8, 0.9], ], using: 'colbert', limit: 10, }); // Random sampling (as of 1.11.0) let _sampled = client.query("{collection_name}", { query: { sample: "random" }, }); // Score boost depending on payload conditions (as of 1.14.0) const tag_boosted = await client.query("{collection_name}", { prefetch: { query: [0.2, 0.8, 0.1, 0.9], limit: 50 }, query: { formula: { sum: [ "$score", { mult: [ 0.5, { key: "tag", match: { any: ["h1", "h2", "h3", "h4"] }} ] }, { mult: [ 0.25, { key: "tag", match: { any: ["p", "li"] }} ] } ] } } }); // Score boost geographically closer points (as of 1.14.0) const distance_boosted = await client.query("{collection_name}", { prefetch: { query: [0.2, 0.8, ...], limit: 50 }, query: { formula: { sum: [ "$score", { gauss_decay: { x: { geo_distance: { origin: { lat: 52.504043, lon: 13.393236 }, // Berlin to: "geo.location" } }, scale: 5000 // 5km } } ] }, defaults: { "geo.location": { lat: 48.137154, lon: 11.576124 } } // Munich } }); ``` ```rust use qdrant_client::qdrant::{ Condition, DecayParamsExpressionBuilder, Expression, FormulaBuilder, Fusion, GeoPoint, PointId, PrefetchQueryBuilder, Query, QueryPointsBuilder, RecommendInputBuilder, Sample, }; use qdrant_client::Qdrant; let client = Qdrant::from_url("http://localhost:6334").build()?; // Query nearest by ID let _nearest = client.query( QueryPointsBuilder::new("{collection_name}") .query(PointId::from("43cf51e2-8777-4f52-bc74-c2cbde0c8b04")) ).await?; // Recommend on the average of these vectors let _recommendations = client.query( QueryPointsBuilder::new("{collection_name}") .query(Query::new_recommend( RecommendInputBuilder::default() .add_positive(vec![0.1; 8]) .add_negative(PointId::from(0)) )) ).await?; // Fusion query let _hybrid = client.query( QueryPointsBuilder::new("{collection_name}") .add_prefetch(PrefetchQueryBuilder::default() .query(vec![(1, 0.22), (42, 0.8)]) .using("sparse") .limit(20u64) ) .add_prefetch(PrefetchQueryBuilder::default() .query(vec![0.01, 0.45, 0.67]) .using("dense") .limit(20u64) ) .query(Fusion::Rrf) ).await?; // 2-stage query let _refined = client.query( QueryPointsBuilder::new("{collection_name}") .add_prefetch(PrefetchQueryBuilder::default() .query(vec![0.01, 0.45, 0.67]) .limit(100u64) ) .query(vec![ vec![0.1, 0.2], vec![0.2, 0.1], vec![0.8, 0.9], ]) .using("colbert") .limit(10u64) ).await?; // Random sampling (as of 1.11.0) let _sampled = client .query( QueryPointsBuilder::new("{collection_name}") .query(Query::new_sample(Sample::Random)) ) .await?; // Score boost depending on payload conditions (as of 1.14.0) let _tag_boosted = client.query( QueryPointsBuilder::new("{collection_name}") .add_prefetch(PrefetchQueryBuilder::default() .query(vec![0.01, 0.45, 0.67]) .limit(100u64) ) .query(FormulaBuilder::new(Expression::sum_with([ Expression::score(), Expression::mult_with([ Expression::constant(0.5), Expression::condition(Condition::matches("tag", ["h1", "h2", "h3", "h4"])), ]), Expression::mult_with([ Expression::constant(0.25), Expression::condition(Condition::matches("tag", ["p", "li"])), ]), ]))) .limit(10) ).await?; // Score boost geographically closer points (as of 1.14.0) let _geo_boosted = client.query( QueryPointsBuilder::new("{collection_name}") .add_prefetch( PrefetchQueryBuilder::default() .query(vec![0.01, 0.45, 0.67]) .limit(100u64), ) .query( FormulaBuilder::new(Expression::sum_with([ Expression::score(), Expression::exp_decay( DecayParamsExpressionBuilder::new(Expression::geo_distance_with( // Berlin GeoPoint { lat: 52.504043, lon: 13.393236 }, "geo.location", )) .scale(5_000.0), ), ])) // Munich .add_default("geo.location", GeoPoint { lat: 48.137154, lon: 11.576124 }), ) .limit(10), ) .await?; ``` ```csharp using Qdrant.Client; using Qdrant.Client.Grpc; var client = new QdrantClient("localhost", 6334); // Query nearest by ID await client.QueryAsync( collectionName: "{collection_name}", query: Guid.Parse("43cf51e2-8777-4f52-bc74-c2cbde0c8b04") ); // Recommend on the average of these vectors 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 } } } ); // Fusion query await client.QueryAsync( collectionName: "{collection_name}", prefetch: new List { new() { Query = new (float, uint)[] { (0.22f, 1), (0.8f, 42), }, Using = "sparse", Limit = 20 }, new() { Query = new float[] { 0.01f, 0.45f, 0.67f }, Using = "dense", Limit = 20 } }, query: Fusion.Rrf ); // 2-stage query await client.QueryAsync( collectionName: "{collection_name}", prefetch: new List { new() { Query = new float[] { 0.01f, 0.45f, 0.67f }, Limit = 100 } }, query: new float[][] { [0.1f, 0.2f], [0.2f, 0.1f], [0.8f, 0.9f] }, usingVector: "colbert", limit: 10 ); // Random sampling (as of 1.11.0) await client.QueryAsync( collectionName: "{collection_name}", query: Sample.Random ); // Score boost depending on payload conditions (as of 1.14.0) await client.QueryAsync( collectionName: "{collection_name}", prefetch: [ new PrefetchQuery { Query = new float[] { 0.01f, 0.45f, 0.67f }, Limit = 100 }, ], query: new Formula { Expression = new SumExpression { Sum = { "$score", new MultExpression { Mult = { 0.5f, Match("tag", ["h1", "h2", "h3", "h4"]) }, }, new MultExpression { Mult = { 0.25f, Match("tag", ["p", "li"]) } }, }, }, }, limit: 10 ); // Score boost geographically closer points (as of 1.14.0) await client.QueryAsync( collectionName: "{collection_name}", prefetch: [ new PrefetchQuery { Query = new float[] { 0.01f, 0.45f, 0.67f }, Limit = 100 }, ], query: new Formula { Expression = new SumExpression { Sum = { "$score", WithExpDecay( new() { X = new GeoDistance { Origin = new GeoPoint { Lat = 52.504043, Lon = 13.393236 }, To = "geo.location", }, Scale = 5000, } ), }, }, Defaults = { ["geo.location"] = new Dictionary { ["lat"] = 48.137154, ["lon"] = 11.576124, }, }, } ); ``` ```ruby require 'uri' require 'net/http' url = URI("http://localhost:6333/collections/collection_name/points/query") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Post.new(url) request["api-key"] = '' request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```php request('POST', 'http://localhost:6333/collections/collection_name/points/query', [ 'body' => '{}', 'headers' => [ 'Content-Type' => 'application/json', 'api-key' => '', ], ]); echo $response->getBody(); ``` ```swift import Foundation let headers = [ "api-key": "", "Content-Type": "application/json" ] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:6333/collections/collection_name/points/query")! 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() ```