Getting Started with Qdrant

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

Qdrant is an open-source vector similarity search engine, written in Rust. It stores high-dimensional vectors alongside arbitrary JSON payloads and answers nearest-neighbor queries — "find the points closest to this one" — rather than the exact-match and range queries a relational or document database is built around. This page covers how to run it, its two APIs, its official clients, and a first end-to-end walkthrough.

Running Qdrant

The fastest way to get a server running locally is the official Docker image, which exposes both of Qdrant’s APIs and persists data to a mounted volume:

docker run -p 6333:6333 -p 6334:6334 \
  -v "$(pwd)/qdrant_storage:/qdrant/storage:z" \
  qdrant/qdrant:latest

That single command is enough to follow the walkthrough below (its flags are explained in Running Containers). For every other way to install and run Qdrant — a plain binary, a Helm chart for Kubernetes, or building from source — see Installation in the official documentation, and Quickstart for the equivalent first steps taken there.

For a managed option with no server to operate, Qdrant Cloud runs the same engine as a hosted service: you create a cluster through the web console or its API, choose a region and size, and get back a URL and an API key instead of a container to maintain. It adds horizontal scaling, backups, and monitoring on top of the same REST/gRPC surface described below, so everything in this reference applies unchanged once a cluster is provisioned.

Once the container reports that it is listening, three unauthenticated probe endpoints tell an orchestrator or a script whether the node is usable. They are cheap and need no collection to exist:

curl http://localhost:6333/healthz   # healthz check passed
curl http://localhost:6333/readyz    # all shards are ready
curl http://localhost:6333/livez     # healthz check passed

/readyz is the one to use as a Kubernetes readiness probe, because it only succeeds once every shard loaded from disk is ready to serve requests. The same URL root also answers GET / with the server version, which is a quick way to confirm which release a container is really running (the examples in this section were run against Qdrant 1.20.0).

flowchart LR subgraph Clients C1["curl / HTTP client
REST, port 6333"] C2["qdrant-client / Java client
gRPC, port 6334"] C3["Web UI
/dashboard"] end subgraph Node["Qdrant node"] API["API layer"] COL["Collection: demo"] SEG["Segments
vectors + payload + HNSW"] WAL["Write-ahead log"] end DISK[("/qdrant/storage
volume")] C1 --> API C2 --> API C3 --> API API --> COL COL --> WAL COL --> SEG WAL --> DISK SEG --> DISK

Both APIs reach the same collections; the volume mounted at /qdrant/storage is the only state, which is why the docker run command mounts it. Without the volume, removing the container removes the data.

The REST and gRPC APIs

Qdrant exposes every operation through two wire protocols, both covered end to end in Interfaces:

  • REST, on port 6333 by default — a JSON-over-HTTP API, with its own interactive OpenAPI/Swagger UI at ui.qdrant.tech, plus a separate Web UI (a collection browser and query console) served at http://localhost:6333/dashboard. The REST API is the simplest way to script against Qdrant with nothing but curl, as the walkthrough below shows.

  • gRPC, on port 6334 by default — a binary protocol built from the same schema as the REST API, used by the official clients internally for lower latency and lower overhead on high-throughput workloads.

Both ports are already published by the docker run command above, so either API is reachable as soon as the container is up.

Official clients

Qdrant maintains client libraries for several languages; the two most relevant here are:

  • Python — the qdrant-client package, installed with pip install qdrant-client. It wraps both the REST and gRPC APIs behind one Python interface and is the client used in the walkthrough below.

  • Java/Kotlin — the io.qdrant:client artifact, published on Maven Central:

    <dependency>
      <groupId>io.qdrant</groupId>
      <artifactId>client</artifactId>
      <version>1.20.0</version>
    </dependency>

    It talks to Qdrant over gRPC and exposes the same collection, point, and search operations used from Python and curl in this reference. A complete, runnable Java round trip is shown in A Java round trip over gRPC.

The Python client also has a local mode that needs no server at all, which is handy in unit tests: passing ":memory:" (or path="./qdrant_local" for a persisted copy) runs the same API in-process. It is meant for tests and prototyping, not for production data.

from qdrant_client import QdrantClient

client = QdrantClient(":memory:")   # same calls as against a server, no Docker needed

This section creates a collection, inserts ("upserts") a handful of points, and searches them — once as raw REST calls, once with qdrant-client. The example uses toy 4-dimensional vectors so it fits on the page; a real embedding model typically produces vectors hundreds or thousands of dimensions wide, but the API calls are identical either way.

Create a collection

A collection fixes the size and distance metric every point in it will use:

curl -X PUT 'http://localhost:6333/collections/demo' \
  -H 'Content-Type: application/json' \
  -d '{
    "vectors": {
      "size": 4,
      "distance": "Cosine"
    }
  }'
from qdrant_client import QdrantClient
from qdrant_client.models import Distance, VectorParams

client = QdrantClient(url="http://localhost:6333")

client.create_collection(
    collection_name="demo",
    vectors_config=VectorParams(size=4, distance=Distance.COSINE),
)

Upsert a few points

Each point carries an ID, a vector, and an optional JSON payload:

curl -X PUT 'http://localhost:6333/collections/demo/points' \
  -H 'Content-Type: application/json' \
  -d '{
    "points": [
      { "id": 1, "vector": [0.05, 0.61, 0.76, 0.74], "payload": { "city": "Berlin" } },
      { "id": 2, "vector": [0.19, 0.81, 0.75, 0.11], "payload": { "city": "London" } },
      { "id": 3, "vector": [0.36, 0.55, 0.47, 0.94], "payload": { "city": "Moscow" } }
    ]
  }'
from qdrant_client.models import PointStruct

client.upsert(
    collection_name="demo",
    points=[
        PointStruct(id=1, vector=[0.05, 0.61, 0.76, 0.74], payload={"city": "Berlin"}),
        PointStruct(id=2, vector=[0.19, 0.81, 0.75, 0.11], payload={"city": "London"}),
        PointStruct(id=3, vector=[0.36, 0.55, 0.47, 0.94], payload={"city": "Moscow"}),
    ],
)

A search takes a query vector and returns the closest points, ranked by the collection’s distance metric:

curl -X POST 'http://localhost:6333/collections/demo/points/query' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": [0.2, 0.1, 0.9, 0.7],
    "limit": 2
  }'
results = client.query_points(
    collection_name="demo",
    query=[0.2, 0.1, 0.9, 0.7],
    limit=2,
).points

for hit in results:
    print(hit.id, hit.score, hit.payload)

Run against a fresh server, the REST call returns this (the version field is the internal operation number that last wrote the point):

{"result":{"points":[{"id":1,"version":1,"score":0.89463294},{"id":3,"version":1,"score":0.83872515}]},"status":"ok","time":0.001649417}

and the Python loop prints:

1 0.89463294 {'city': 'Berlin'}
3 0.83872515 {'city': 'Moscow'}

Both calls rank the same two points, but note one difference that surprises newcomers: the REST API returns neither payload nor vector by default, so the response above carries only ids and scores. Add "with_payload": true to the request body to get {"city":"Berlin"} back. The Python client’s query_points defaults to with_payload=True, which is why its output shows the city.

Reading the response

Every REST response is a JSON envelope with the same three keys, so one error-handling path covers every call:

Key Meaning

status

"ok" on success; on failure an object {"error": "..."} instead.

result

The operation’s result: the points of a query, true for a created collection, or an object with operation_id and status for a write.

time

Server-side processing time in seconds, excluding network.

A write returns "status":"acknowledged" when it has been accepted into the write-ahead log but is not yet applied, and "completed" once it is applied and visible to search. Plain PUT .../points is asynchronous; append ?wait=true (wait=True in the Python client, which is its default) to block until the change is applied. The difference is covered in CRUD & Batch Operations.

Inspecting a collection

GET /collections/demo (client.get_collection("demo")) reports the collection’s configuration and health. The fields to look at first are status (green when the optimizer has nothing pending, yellow while it is optimizing, red after an error), points_count, and indexed_vectors_count:

info = client.get_collection("demo")
print(info.status, info.points_count, info.indexed_vectors_count, info.segments_count)
# green 3 0 5
print(info.config.params.vectors)
# size=4 distance=<Distance.COSINE: 'Cosine'> ...

indexed_vectors_count is 0 for this three-point collection and that is correct: a collection below the indexing threshold is searched by scanning every vector, which is exact and faster than walking a graph. The HNSW graph appears only once enough data accumulates; see Vector Indexing & HNSW for when and why.

Errors you will meet first

The messages are specific, and every one below was produced by the walkthrough’s own calls:

PUT /collections/demo (twice)        -> 400 Wrong input: Collection `demo` already exists!
GET /collections/zzz                 -> 404 Not found: Collection `zzz` doesn't exist!
query with a 2-dimensional vector    -> 400 Wrong input: Vector dimension error: expected dim: 4, got 2
upsert with the id "not-a-uuid"      -> 400 value not-a-uuid is not a valid point ID, valid values are
                                           either an unsigned integer or a UUID

The Python client raises UnexpectedResponse carrying the same text, and client.collection_exists("demo") is the idempotent way to guard a create_collection in a setup script.

A Java round trip over gRPC

The Java client talks to port 6334. This program creates a collection, upserts two points and runs a filtered query; it was compiled with io.qdrant:client:1.20.0 and run against a local container, and it prints 1 0.99494714 Studio headphones:

import io.qdrant.client.ConditionFactory;
import io.qdrant.client.QdrantClient;
import io.qdrant.client.QdrantGrpcClient;
import io.qdrant.client.QueryFactory;
import io.qdrant.client.WithPayloadSelectorFactory;
import io.qdrant.client.grpc.Collections.Distance;
import io.qdrant.client.grpc.Collections.VectorParams;
import io.qdrant.client.grpc.Common.Filter;
import io.qdrant.client.grpc.Points.PointStruct;
import io.qdrant.client.grpc.Points.QueryPoints;
import io.qdrant.client.grpc.Points.ScoredPoint;

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;

public class Demo {
    public static void main(String[] args) throws Exception {
        try (QdrantClient client = new QdrantClient(
                QdrantGrpcClient.newBuilder("localhost", 6334, false).build())) {

            client.createCollectionAsync("products",
                    VectorParams.newBuilder().setDistance(Distance.Cosine).setSize(4).build()).get();

            client.upsertAsync("products", List.of(
                PointStruct.newBuilder().setId(id(1))
                    .setVectors(vectors(0.9f, 0.1f, 0.0f, 0.1f))
                    .putAllPayload(Map.of("name", value("Studio headphones"),
                                          "category", value("audio"))).build(),
                PointStruct.newBuilder().setId(id(2))
                    .setVectors(vectors(0.1f, 0.9f, 0.1f, 0.0f))
                    .putAllPayload(Map.of("name", value("Mechanical keyboard"),
                                          "category", value("computing"))).build())).get();

            List<ScoredPoint> hits = client.queryAsync(QueryPoints.newBuilder()
                    .setCollectionName("products")
                    .setQuery(QueryFactory.nearest(0.85f, 0.15f, 0.05f, 0.05f))
                    .setFilter(Filter.newBuilder()
                            .addMust(ConditionFactory.matchKeyword("category", "audio")).build())
                    .setLimit(3)
                    .setWithPayload(WithPayloadSelectorFactory.enable(true))
                    .build()).get();

            for (ScoredPoint p : hits) {
                System.out.println(p.getId().getNum() + " " + p.getScore() + " "
                        + p.getPayloadMap().get("name").getStringValue());
            }
        }
    }
}

Every gRPC call has an Async suffix and returns a ListenableFuture, so .get() blocks for the result. The protobuf builders are verbose compared with Python, but the shape is identical to the REST body: a collection name, a query vector, an optional filter, a limit.

The running example

The rest of this reference uses one small, consistent data set so that every page’s output can be compared with the others: a product catalog named products. Six products, each with a hand-made 4-dimensional vector whose axes can be read as audio-ness, computing-ness, kitchen-ness and portability (a real system would use the output of an embedding model instead), and a payload with a name, category, price, brand, stock flag and a location. The headphones, speaker and soundbar sit close together; the keyboard and mouse form a second group; the espresso machine is alone. Hybrid search and RAG pages add an articles and a kb_chunks collection built the same way. Each following page states exactly which calls produced its output.

Where to go next