Getting Started With Qdrant: Building Intelligent Search Applications With Java
Learn about Qdrant vector search with Java and Eclipse JNoSQL, combining semantic retrieval with structured filtering for enterprise applications.
Enterprise applications seldom rely solely on similarity for information retrieval. For example, e-commerce platforms must recommend products aligned with customer interests while considering availability, pricing, and categories. Document management systems need to retrieve semantically related information while enforcing access permissions. Combining these requirements efficiently is a key challenge in building intelligent search applications. Qdrant, an open-source vector database for similarity search and structured filtering, addresses this challenge effectively.
Qdrant enables Java developers and software architects to build applications that integrate semantic understanding with business constraints. Its support for multiple vector representations, advanced filtering, and hybrid retrieval extends its relevance beyond conversational AI and RAG applications.
This article examines Qdrant's features, demonstrates local configuration with Docker, and shows integration with enterprise Java using Eclipse JNoSQL. Before implementation, we will review what sets Qdrant apart and where it delivers practical value.
Understanding Qdrant: Capabilities and Real-World Applications
Qdrant is an open-source vector database written in Rust that combines similarity search with structured data filtering. Its core data structure, the point, links an identifier, vector representations, and an optional JSON payload. This model is particularly relevant for enterprise systems because it lets you apply business constraints during vector retrieval, eliminating the need for separate application-level filtering.
For example, in a travel booking application, a customer searching for “a quiet seaside hotel suitable for families” can benefit from semantic similarity to identify relevant accommodations. Payload filters then narrow results by destination, price range, and availability. Qdrant uses both vector and payload indexes to optimize these queries, removing the need to retrieve all similar results before filtering them in Java.
In addition to this use case, Qdrant offers several notable capabilities:
- Advanced payload filtering: Combines numerical ranges, keywords, geographical conditions, and other structured constraints with vector search.
- Multiple vector representations: Supports dense, sparse, and multi-vector configurations, including named vectors that associate different representations with the same record.
- Hybrid retrieval: Combines semantic and keyword-oriented retrieval, with ranking fusion strategies that help balance different relevance signals.
- Memory optimization: Supports vector quantization and on-disk storage configurations, allowing architects to balance memory consumption, latency, and search quality.
- Deployment flexibility: Supports local containers, self-hosted distributed deployments, and managed cloud environments.
Although these features are not unique to Qdrant, its combination of payload-aware indexing and flexible retrieval is especially valuable for applications that require both semantic relevance and structured business rules.
Qdrant in Production
Qdrant’s published customer stories illustrate its adoption across several industries:
- Tripadvisor: Uses Qdrant in its AI-powered travel planning experience to retrieve relevant information from a large collection of reviews and travel content.
- HubSpot: Uses Qdrant to support intelligent AI assistant capabilities, connecting enterprise information with semantic retrieval.
- Dailymotion: Applies vector search to video recommendations, helping users discover relevant content.
- OpenTable: Uses Qdrant to improve restaurant discovery through AI-powered recommendations and search.
These examples show that vector search extends beyond chatbot applications. Travel platforms, customer service systems, and media applications can use similarity search to improve how users discover information, products, and services.
However, Qdrant may not suit every application. Maintaining vector indexes, selecting embedding models, configuring payload indexes, and evaluating relevance all introduce operational and architectural costs. Additionally, a dedicated vector database may be unnecessary if existing database capabilities meet the application's requirements.
For Java architects, Qdrant provides a balance between specialized retrieval capabilities and integration flexibility. Next, set up a local environment and explore how Eclipse JNoSQL allows Java applications to interact with Qdrant using a familiar persistence API.
Setting Up Qdrant With Docker
Qdrant offers several deployment options, such as self-hosted instances, distributed clusters, and managed cloud environments. In this example, we will run Qdrant locally with Docker to demonstrate vector persistence without additional infrastructure or cloud services.
Once Docker is installed, start Qdrant using the command from our example repository:
docker run --name qdrant-instance \
-p 6333:6333 -p 6334:6334 \
-d qdrant/qdrant
Qdrant provides two main endpoints: port 6333 for HTTP requests and the dashboard, and port 6334 for gRPC communication. After starting the container, access the dashboard at http://localhost:6333/dashboard to review the database and its collections.
Connecting Qdrant With Enterprise Java
Eclipse JNoSQL offers a persistence abstraction for Java applications that integrates with CDI and Jakarta EE technologies. This enables the use of Qdrant across various application styles, such as REST services, batch processing, and background workers, without tightly coupling business logic to the Qdrant driver. While the framework supports Jakarta EE environments, this example uses Java SE with CDI for simplicity.
The Maven configuration includes the Qdrant integration, Vector Mapping module, and LangChain4j for local embedding generation:
<dependency>
<groupId>org.eclipse.jnosql.databases</groupId>
<artifactId>jnosql-qdrant</artifactId>
<version>${jnosql.databases.version}</version>
</dependency>
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-embeddings-all-minilm-l6-v2-q</artifactId>
<version>${langchain4j.embeddings.version}</version>
</dependency>
Next, configure the connection in META-INF/microprofile-config.properties using the properties from the Qdrant example:
jnosql.vector.database=products
jnosql.qdrant.host=localhost
jnosql.qdrant.port=6334
jnosql.qdrant.tls=false
jnosql.qdrant.collection.distance=COSINE
jnosql.qdrant.collection.vector.size=384
The products collection stores the catalog, and COSINE specifies the similarity metric for vector searches. The vector size is set to 384 to match the dimensions generated by LangChain4j’s local all-MiniLM-L6-v2 embedding model.
Unlike solutions that require an external AI service, this application generates embeddings locally using an ONNX model. As a result, you don't need an API key or cloud account.
With Qdrant running and the connection configured, you can explore how Java applications persist vectors, perform semantic searches, and combine similarity with structured business conditions.
Working With Qdrant Using Eclipse JNoSQL
With the database configured, we now focus on the Java API. Eclipse JNoSQL extends Jakarta NoSQL’s persistence model with VectorTemplate, enabling developers to handle vector data using familiar annotations and operations. In this example, we use a product catalog that lets customers search for items by description instead of exact keywords.
First, we represent a product as a Jakarta NoSQL entity:
@Entity
public class Product {
@Id
private String id;
@Column
private String name;
@Column
private String description;
@Column
private ProductType type;
@Column
private Vector embedding;
// Constructors and getters
}
The @Id annotation identifies the record, while the other attributes store product information and its vector embedding. This mapping is independent of Qdrant’s native data structures, so developers can work with standard Java objects.
Generating and Persisting Vectors
The vector is generated with LangChain4j and converted to Eclipse JNoSQL’s DenseVector format. This conversion is handled by a CDI component:
@ApplicationScoped
public class TextEmbedder {
private final EmbeddingModel model =
new AllMiniLmL6V2QuantizedEmbeddingModel();
public Vector embed(String text) {
float[] values = model.embed(text)
.content()
.vector();
return DenseVector.of(values);
}
}
Eclipse JNoSQL does not generate embeddings; it manages their persistence and retrieval. This separation lets developers update AI integration independently from the database layer, as long as stored and query embeddings remain compatible.
VectorTemplate specializes Jakarta NoSQL’s Template abstraction, retaining standard persistence operations while introducing similarity search.
String text = """
Product: %s
Description: %s
""".formatted(name, description);
Vector embedding = embedder.embed(text);
Product product = new Product(
id, name, description, type, embedding);
template.insert(product);
In this example, the embedding captures the product’s name and description, while the type remains as structured metadata. This approach is especially useful when combining semantic retrieval with business rules.
Semantic Search and Metadata Filtering
For example, if a customer searches for “something comfortable for my animal to rest,” the application generates an embedding for the query and requests Qdrant to retrieve the most similar products:
Vector queryVector = embedder.embed(
"something comfortable for my animal to rest"
);
List<Product> products = template.search(Product.class)
.vector(queryVector)
.limit(Limit.of(3))
.result();
Instead of requiring exact search terms, Qdrant evaluates similarity against stored embeddings. In this catalog, the relevant result is a dog bed described as a comfortable sleeping cushion.
However, semantic similarity alone may not meet all business requirements. For example, to restrict recommendations to pet products:
List<Product> products = template.search(Product.class)
.vector(queryVector)
.where("type").eq(ProductType.PET)
.limit(Limit.of(3))
.result();
The fluent API combines vector similarity with structured metadata filtering, a key capability of Qdrant. The database evaluates searches based on its indexes and filtering strategy, while Eclipse JNoSQL maps results to Java entities.
Repository Support and Jakarta Specifications
Beyond VectorTemplate, Eclipse JNoSQL integrates three complementary Jakarta specifications: Jakarta NoSQL, Jakarta Data, and Jakarta Query.
Jakarta NoSQL defines entity mapping and template-based persistence. Jakarta Data introduces declarative repositories. Jakarta Query provides a common query foundation, though its integration with Eclipse JNoSQL is still in development.
For example, the same product entity can be exposed through a Jakarta Data repository:
@Repository
public interface ProductRepository
extends BasicRepository<Product, String> {
}
This interface offers common persistence operations without manual database access implementation. However, repository operations and vector similarity searches serve different purposes. For specialized similarity retrieval, developers should continue using VectorTemplate.
For enterprise architects, the value is in combining standardized persistence abstractions with specialized database capabilities. Eclipse JNoSQL reduces Java-level dependency on Qdrant while maintaining access to advanced search operations. The complete implementation, including Java SE bootstrap and executable examples, is available in the Qdrant Vector demo.
Conclusion
Qdrant offers an effective way to combine semantic search with structured filtering, making it well-suited for enterprise applications that demand both relevance and business constraints. Using Java and Eclipse JNoSQL, developers can implement vector persistence through familiar APIs while keeping embedding generation separate from the database layer. Understanding Qdrant’s features and trade-offs enables software architects to design intelligent search solutions without added complexity. For implementation details, review the complete source code and learn more about enterprise Java persistence on the Eclipse JNoSQL website.
Opinions expressed by DZone contributors are their own.