Qdrant Embedding Store

Qdrant is a high-performance vector database optimized for semantic search and Retrieval-Augmented Generation (RAG) workloads. This guide explains how to use Qdrant as a vector-capable document store in Quarkus LangChain4j.

Overview

The quarkus-langchain4j-qdrant extension allows you to connect to a Qdrant instance, manage collections, and perform vector similarity search using embedded text segments.

Dependency

To enable Qdrant integration, add the following dependency to your Quarkus project:

<dependency>
    <groupId>io.quarkiverse.langchain4j</groupId>
    <artifactId>quarkus-langchain4j-qdrant</artifactId>
    <version>1.0.2</version>
</dependency>

Dev Services Support

The extension includes Dev Services support for Qdrant. In dev and test modes, a containerized Qdrant instance is automatically started and initialized with a default or user-defined collection.

To configure Dev Services for Qdrant, you must set the following properties:

# Required: collection name
quarkus.langchain4j.qdrant.devservices.service-name=my-collection

# Required: vector size (depends on embedding model)
quarkus.langchain4j.qdrant.devservices.collection.vector-params.size=384

# Required: distance metric (e.g., Cosine, Dot, Euclidean)
quarkus.langchain4j.qdrant.devservices.collection.vector-params.distance=Cosine
The vector size must match the output dimension of your embedding model (e.g., 384 for BGE, 1536 for OpenAI’s ada-002).

Dev Services will use the qdrant/qdrant Docker image by default and expose the gRPC endpoint.

Connecting to an External Qdrant Instance

If you want to use a remote Qdrant instance instead of Dev Services, disable it and provide the connection parameters:

quarkus.langchain4j.qdrant.host=localhost
quarkus.langchain4j.qdrant.port=6334
quarkus.langchain4j.qdrant.use-grpc=true
quarkus.langchain4j.qdrant.collection.name=my-collection
quarkus.langchain4j.qdrant.collection.vector-params.size=384
quarkus.langchain4j.qdrant.collection.vector-params.distance=Cosine

Configuration

You can customize the behavior of the Qdrant extension using the following configuration options:

Configuration property fixed at build time - All other configuration properties are overridable at runtime

Configuration property

Type

Default

Whether Dev Services for Qdrant are enabled or not.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_DEVSERVICES_ENABLED

boolean

true

Container image for Qdrant.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_DEVSERVICES_QDRANT_IMAGE_NAME

string

docker.io/qdrant/qdrant:v1.8.3-unprivileged

Optional fixed port the Qdrant dev service will listen to. If not defined, the port will be chosen randomly.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_DEVSERVICES_PORT

int

Indicates if the Dev Service containers managed by Quarkus for Qdrant are shared.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_DEVSERVICES_SHARED

boolean

true

Service label to apply to created Dev Services containers.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_DEVSERVICES_SERVICE_NAME

string

qdrant

Distance function used for comparing vectors

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_DEVSERVICES_COLLECTION_VECTOR_PARAMS_DISTANCE

unknown-distance, cosine, euclid, dot, manhattan

required

Size of the vectors

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_DEVSERVICES_COLLECTION_VECTOR_PARAMS_SIZE

long

0l

The URL of the Qdrant server.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_HOST

string

required

The gRPC port of the Qdrant server. Defaults to 6334

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_PORT

int

6334

The Qdrant API key to authenticate with.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_API_KEY

string

Whether to use TLS(HTTPS). Defaults to false.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_USE_TLS

boolean

false

The field name of the text segment in the payload. Defaults to "text_segment"

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_PAYLOAD_TEXT_KEY

string

text_segment

The name of the collection.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_COLLECTION_NAME

string

required

Summary

To use Qdrant with Quarkus LangChain4j:

  1. Add the quarkus-langchain4j-qdrant extension

  2. Choose between Dev Services or external Qdrant

  3. Define the collection name, vector size…​

  4. Ingest and retrieve documents via the QdrantEmbeddingStore