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.10.0</version>
</dependency>

Even better, if you use the Quarkus platform BOM (default for projects generated), add the Quarkus Langchain4J BOM and all dependency versions will align:

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>${quarkus.platform.group-id}</groupId>
                <artifactId>${quarkus.platform.artifact-id}</artifactId>
                <version>${quarkus.platform.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>${quarkus.platform.group-id}</groupId>
                <artifactId>quarkus-langchain4j-bom</artifactId> (1)
                <version>${quarkus.platform.version}</version> (2)
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
      <dependency>
        <groupId>io.quarkiverse.langchain4j</groupId>
        <artifactId>quarkus-langchain4j-qdrant</artifactId>
        (3)
      </dependency>
    </dependencies>
1 In your dependencyManagement section, add the quarkus-langchain4j-bom
2 Inherit the version from your platform version
3 Voilà, no need for version alignment anymore

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

Named Stores

You can configure multiple named Qdrant stores, each using a different collection. This is useful when your application needs to manage embeddings for different domains or tenants in separate collections within the same Qdrant instance.

To configure a named store:

quarkus.langchain4j.qdrant.products.collection-name=product_embeddings
quarkus.langchain4j.qdrant.products.host=qdrant.example.com

To inject a named store, use the @EmbeddingStoreName qualifier:

@Inject
@EmbeddingStoreName("products")
EmbeddingStore<TextSegment> productsStore;

The default store and named stores can coexist. If you only need named stores, disable the default store:

quarkus.langchain4j.qdrant.default-store-enabled=false

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 the default (unnamed) Qdrant embedding store should be enabled. Set to false when you only want to use named stores.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT_DEFAULT_STORE_ENABLED

boolean

true

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.16-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

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

default

Named store configurations

Type

Default

The collection name for this named store. This property serves as the build-time key that enables named store discovery. If not set, the collection name from the runtime configuration will be used.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT__STORE_NAME__COLLECTION_NAME

string

The URL of the Qdrant server.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT__STORE_NAME__HOST

string

The gRPC port of the Qdrant server. Defaults to 6334

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT__STORE_NAME__PORT

int

6334

The Qdrant API key to authenticate with.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT__STORE_NAME__API_KEY

string

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

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT__STORE_NAME__USE_TLS

boolean

false

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

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT__STORE_NAME__PAYLOAD_TEXT_KEY

string

text_segment

The name of the collection.

Environment variable: QUARKUS_LANGCHAIN4J_QDRANT__STORE_NAME__COLLECTION_NAME

string

default

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