Back to AI Tools & Agents

qdrant-vector-database-integration

qdrantvector databaselangchain4jjavaspring bootragsemantic searchembeddings
⭐ 282πŸ“„ MITπŸ•’ 2026-06-15Source β†—

Install this skill

npx skills add giuseppe-trisciuoglio/developer-kit

Works across Claude Code, Cursor, Codex, Copilot & Antigravity

The Qdrant vector database integration skill enables Java developers to manage high-dimensional embeddings for semantic search and AI-driven retrieval. Built for compatibility with Spring Boot and the LangChain4j ecosystem, it provides structured patterns for deploying and interacting with the Qdrant engine via gRPC or REST APIs. The integration focuses on collection lifecycle management, including vector parameter definition and distance metric selection, alongside programmatic ingestion of point data. Developers can perform filtered similarity searches and batch upserts directly within their application code. This skill simplifies the process of connecting Java services to Qdrant, ensuring that retrieval pipelines remain performant and scalable for context-aware applications without manually managing low-level socket connections or complex gRPC configurations.

When to Use This Skill

  • β€’Building RAG systems to augment LLM output with domain-specific knowledge
  • β€’Implementing semantic recommendation engines for e-commerce or content platforms
  • β€’Creating document similarity search tools for Spring Boot microservices
  • β€’Developing context-aware chatbot memory layers

How to Invoke This Skill

Example prompts that trigger this skill in Claude Code, Cursor, or Antigravity:

  • β€œHow do I connect Java to Qdrant?
  • β€œSetup Qdrant vector search in Spring Boot
  • β€œCode example for Qdrant client collection creation
  • β€œPerform a filtered similarity search with Qdrant Java client
  • β€œUpsert vector points in Java with Qdrant

Pro Tips

  • πŸ’‘Optimize your Qdrant collection's indexing strategy (e.g., HNSW) and distance metric (e.g., Cosine, Dot product) based on your embedding model and query patterns for peak performance.
  • πŸ’‘Leverage Qdrant's filtering capabilities to combine vector similarity search with structured metadata queries, enabling highly precise and relevant results.
  • πŸ’‘For production deployments, consider Qdrant's distributed and high-availability features, using clustering and replication to ensure robustness and scalability.

What this skill does

  • β€’Programmatic collection management for custom vector dimensions and distance metrics
  • β€’gRPC-based client initialization for secure low-latency communication
  • β€’Batch processing for vector upsert operations
  • β€’Multi-criteria filtering integration during similarity queries
  • β€’Native compatibility with LangChain4j retrieval pipelines

When not to use it

  • βœ•Storing massive amounts of non-vectorized tabular data
  • βœ•Applications that do not require high-speed similarity search algorithms
  • βœ•Environment constrained environments where running a separate containerized database is prohibited

Example workflow

  1. Deploy a Qdrant container using Docker Compose or a standalone image
  2. Include the Qdrant client dependency in your build.gradle or pom.xml file
  3. Initialize the QdrantClient with connection credentials or gRPC parameters
  4. Create a named collection defining the vector size and distance metric (e.g., Cosine)
  5. Map business objects to point structs including payloads and embedding vectors
  6. Execute search queries using vector similarity combined with metadata filters

Prerequisites

  • –Docker installed for local environment hosting
  • –Existing Java 17+ or Spring Boot project
  • –API Key if connecting to a managed or remote instance

Pitfalls & limitations

  • !Mismatched vector dimensions between index configuration and upserted data
  • !Overlooking gRPC port 6334 requirements when troubleshooting connectivity
  • !Failure to handle potential ExecutionException during asynchronous operations

FAQ

Do I need to run Qdrant in a container?
Yes, for local development, the standard approach is to host the Qdrant instance as a Docker container to ensure consistent API availability.
Which distance metrics can I use?
You can configure collections for Cosine, Euclidean, or Dot product metrics depending on your embedding model's requirements.
How does the Java client communicate with Qdrant?
The client uses gRPC on port 6334 by default for optimized, high-performance binary communication, though REST on 6333 is also supported.
Can I filter results while searching?
Yes, you can include payload-based filters in your search request to constrain results based on indexed metadata fields.

How it compares

Integrating via the Qdrant Java client abstracts the overhead of raw HTTP requests and gRPC stream handling, providing type-safe builders that simplify complex vector operations compared to manual REST API implementations.

Source & trust

⭐ 282 starsπŸ“„ MITπŸ•’ Updated 2026-06-15
πŸ“„ Full skill instructions β€” original source: giuseppe-trisciuoglio/developer-kit
# Qdrant Vector Database Integration

## Overview

Qdrant is an AI-native vector database for semantic search and similarity retrieval. This skill provides patterns for integrating Qdrant with Java applications, focusing on Spring Boot integration and LangChain4j framework support. Enable efficient vector search capabilities for RAG systems, recommendation engines, and semantic search applications.

## When to Use

Use this skill when implementing:
- Semantic search or recommendation systems in Spring Boot applications
- Retrieval-Augmented Generation (RAG) pipelines with Java and LangChain4j
- Vector database integration for AI and machine learning applications
- High-performance similarity search with filtered queries
- Embedding storage and retrieval for context-aware applications

## Getting Started: Qdrant Setup

To begin integration, first deploy a Qdrant instance.

### Local Development with Docker

# Pull the latest Qdrant image
docker pull qdrant/qdrant

# Run the Qdrant container
docker run -p 6333:6333 -p 6334:6334 \
-v "$(pwd)/qdrant_storage:/qdrant/storage:z" \
qdrant/qdrant


Access Qdrant via:
- **REST API**: http://localhost:6333
- **gRPC API**: http://localhost:6334 (used by Java client)

## Core Java Client Integration

Add dependencies to your build configuration and initialize the client for programmatic access.

### Dependency Configuration

**Maven:**
<dependency>
<groupId>io.qdrant</groupId>
<artifactId>client</artifactId>
<version>1.15.0</version>
</dependency>


**Gradle:**
implementation 'io.qdrant:client:1.15.0'


### Client Initialization

Create and configure the Qdrant client for application use:

import io.qdrant.client.QdrantClient;
import io.qdrant.client.QdrantGrpcClient;

// Basic local connection
QdrantClient client = new QdrantClient(
QdrantGrpcClient.newBuilder("localhost").build());

// Secure connection with API key
QdrantClient secureClient = new QdrantClient(
QdrantGrpcClient.newBuilder("localhost", 6334, false)
.withApiKey("YOUR_API_KEY")
.build());

// Managed connection with TLS
QdrantClient tlsClient = new QdrantClient(
QdrantGrpcClient.newBuilder(channel)
.withApiKey("YOUR_API_KEY")
.build());


## Collection Management

Create and configure vector collections with appropriate distance metrics and dimensions.

### Create Collections

import io.qdrant.client.grpc.Collections.Distance;
import io.qdrant.client.grpc.Collections.VectorParams;
import java.util.concurrent.ExecutionException;

// Create a collection with cosine distance
client.createCollectionAsync("search-collection",
VectorParams.newBuilder()
.setDistance(Distance.Cosine)
.setSize(384)
.build()).get();

// Create collection with configuration
client.createCollectionAsync("recommendation-engine",
VectorParams.newBuilder()
.setDistance(Distance.Euclidean)
.setSize(512)
.build()).get();


## Vector Operations

Perform common vector operations including upsert, search, and filtering.

### Upsert Points

import io.qdrant.client.grpc.Points.PointStruct;
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;

// Batch upsert vector points
List<PointStruct> points = List.of(
PointStruct.newBuilder()
.setId(id(1))
.setVectors(vectors(0.05f, 0.61f, 0.76f, 0.74f))
.putAllPayload(Map.of(
"title", value("Spring Boot Documentation"),
"content", value("Spring Boot framework documentation")
))
.build(),
PointStruct.newBuilder()
.setId(id(2))
.setVectors(vectors(0.19f, 0.81f, 0.75f, 0.11f))
.putAllPayload(Map.of(
"title", value("Qdrant Vector Database"),
"content", value("Vector database for AI applications")
))
.build()
);

client.upsertAsync("search-collection", points).get();


### Vector Search

import io.qdrant.client.grpc.Points.QueryPoints;
import io.qdrant.client.grpc.Points.ScoredPoint;
import static io.qdrant.client.QueryFactory.nearest;
import java.util.List;

// Basic similarity search
List<ScoredPoint> results = client.queryAsync(
QueryPoints.newBuilder()
.setCollectionName("search-collection")
.setLimit(5)
.setQuery(nearest(0.2f, 0.1f, 0.9f, 0.7f))
.build()
).get();

// Search with filters
List<ScoredPoint> filteredResults = client.searchAsync(
SearchPoints.newBuilder()
.setCollectionName("search-collection")
.addAllVector(List.of(0.6235f, 0.123f, 0.532f, 0.123f))
.setFilter(Filter.newBuilder()
.addMust(range("rand_number",
Range.newBuilder().setGte(3).build()))
.build())
.setLimit(5)
.build()).get();


## Spring Boot Integration

Integrate Qdrant with Spring Boot using dependency injection and proper configuration.

### Configuration Class

import io.qdrant.client.QdrantClient;
import io.qdrant.client.QdrantGrpcClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class QdrantConfig {

@Value("${qdrant.host:localhost}")
private String host;

@Value("${qdrant.port:6334}")
private int port;

@Value("${qdrant.api-key:}")
private String apiKey;

@Bean
public QdrantClient qdrantClient() {
QdrantGrpcClient grpcClient = QdrantGrpcClient.newBuilder(host, port, false)
.withApiKey(apiKey)
.build();

return new QdrantClient(grpcClient);
}
}


### Service Layer Implementation

import org.springframework.stereotype.Service;
import java.util.List;
import java.util.concurrent.ExecutionException;

@Service
public class VectorSearchService {

private final QdrantClient qdrantClient;

public VectorSearchService(QdrantClient qdrantClient) {
this.qdrantClient = qdrantClient;
}

public List<ScoredPoint> search(String collectionName, List<Float> queryVector) {
try {
return qdrantClient.queryAsync(
QueryPoints.newBuilder()
.setCollectionName(collectionName)
.setLimit(5)
.setQuery(nearest(queryVector))
.build()
).get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException("Qdrant search failed", e);
}
}

public void upsertPoints(String collectionName, List<PointStruct> points) {
try {
qdrantClient.upsertAsync(collectionName, points).get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException("Qdrant upsert failed", e);
}
}
}


## LangChain4j Integration

Leverage LangChain4j for high-level vector store abstractions and RAG implementations.

### Dependency Setup

**Maven:**
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-qdrant</artifactId>
<version>1.7.0</version>
</dependency>


### QdrantEmbeddingStore Configuration

import dev.langchain4j.data.segment.TextSegment;
import dev.langchain4j.embedding.EmbeddingModel;
import dev.langchain4j.embedding.allminilml6v2.AllMiniLmL6V2EmbeddingModel;
import dev.langchain4j.store.embedding.EmbeddingStore;
import dev.langchain4j.store.embedding.EmbeddingStoreIngestor;
import dev.langchain4j.store.embedding.qdrant.QdrantEmbeddingStore;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class Langchain4jConfig {

@Bean
public EmbeddingStore<TextSegment> embeddingStore() {
return QdrantEmbeddingStore.builder()
.collectionName("rag-collection")
.host("localhost")
.port(6334)
.apiKey("YOUR_API_KEY")
.build();
}

@Bean
public EmbeddingModel embeddingModel() {
return new AllMiniLmL6V2EmbeddingModel();
}

@Bean
public EmbeddingStoreIngestor embeddingStoreIngestor(
EmbeddingStore<TextSegment> embeddingStore,
EmbeddingModel embeddingModel) {
return EmbeddingStoreIngestor.builder()
.embeddingStore(embeddingStore)
.embeddingModel(embeddingModel)
.build();
}
}


### RAG Service Implementation

import dev.langchain4j.data.segment.TextSegment;
import dev.langchain4j.embedding.EmbeddingModel;
import dev.langchain4j.store.embedding.EmbeddingStore;
import dev.langchain4j.store.embedding.EmbeddingStoreIngestor;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class RagService {

private final EmbeddingStoreIngestor ingestor;

public RagService(EmbeddingStoreIngestor ingestor) {
this.ingestor = ingestor;
}

public void ingestDocument(String text) {
TextSegment segment = TextSegment.from(text);
ingestor.ingest(segment);
}

public List<TextSegment> findRelevant(String query) {
EmbeddingStore<TextSegment> embeddingStore = ingestor.getEmbeddingStore();
return embeddingStore.findRelevant(
ingestor.getEmbeddingModel().embed(query).content(),
5,
0.7
).stream()
.map(match -> match.embedded())
.toList();
}
}


## Examples

### Basic Search Implementation

// Create simple search endpoint
@RestController
@RequestMapping("/api/search")
public class SearchController {

private final VectorSearchService searchService;

public SearchController(VectorSearchService searchService) {
this.searchService = searchService;
}

@GetMapping
public List<ScoredPoint> search(@RequestParam String query) {
// Convert query to embedding (requires embedding model)
List<Float> queryVector = embeddingModel.embed(query).content().vectorAsList();
return searchService.search("documents", queryVector);
}
}


## Best Practices

### Vector Database Configuration
- Use appropriate distance metrics: Cosine for text, Euclidean for numerical data
- Optimize vector dimensions based on embedding model specifications
- Configure proper collection naming conventions
- Monitor performance and optimize search parameters

### Spring Boot Integration
- Always use constructor injection for dependency injection
- Handle async operations with proper exception handling
- Configure connection timeouts and retry policies
- Use proper bean configuration for production environments

### Security Considerations
- Never hardcode API keys in code
- Use environment variables or Spring configuration properties
- Implement proper authentication and authorization
- Use TLS for production connections

### Performance Optimization
- Batch operations for bulk upserts
- Use appropriate limits and filters
- Monitor memory usage and connection pooling
- Consider sharding for large datasets

## Advanced Patterns

### Multi-tenant Vector Storage
// Implement collection-based multi-tenancy
public class MultiTenantVectorService {
private final QdrantClient client;

public void upsertForTenant(String tenantId, List<PointStruct> points) {
String collectionName = "tenant_" + tenantId + "_documents";
client.upsertAsync(collectionName, points).get();
}
}


### Hybrid Search with Filters
// Combine vector similarity with metadata filtering
public List<ScoredPoint> hybridSearch(String collectionName, List<Float> queryVector,
String category, Date dateRange) {
Filter filter = Filter.newBuilder()
.addMust(range("created_at",
Range.newBuilder().setGte(dateRange.getTime()).build()))
.addMust(exactMatch("category", category))
.build();

return client.searchAsync(
SearchPoints.newBuilder()
.setCollectionName(collectionName)
.addAllVector(queryVector)
.setFilter(filter)
.build()
).get();
}


## References

For comprehensive technical details and advanced patterns, see:
- [Qdrant API Reference](references/references.md) - Complete client API documentation
- [Complete Spring Boot Examples](references/examples.md) - Full application implementations
- [Official Qdrant Documentation](https://qdrant.tech/documentation/) - Core documentation
- [LangChain4j Documentation](https://langchain4j.dev/) - Framework-specific patterns

How to Use This Skill Unit

Option A: Project-Specific (Recommended)

  1. Click "Download" above
  2. In your project, create the directory: .agent/skills/qdrant/
  3. Save the file as SKILL.md
  4. The agent will automatically discover the skill based on its description.

Option B: Global Installation (All Agents)

Save the file to these locations to make it available across all projects:

  • Claude Code: ~/.claude/skills/giuseppe-trisciuoglio/developer-kit/qdrant/SKILL.md
  • Cursor: ~/.cursor/skills/giuseppe-trisciuoglio/developer-kit/qdrant/SKILL.md
  • Antigravity: ~/.gemini/antigravity/skills/giuseppe-trisciuoglio/developer-kit/qdrant/SKILL.md

πŸš€ Install with CLI:
npx skills add giuseppe-trisciuoglio/developer-kit

Read the Master Guide: Mastering Agent Skills β†’

Recommended Rules

View more rules β†’

Recommended Workflows

View more workflows β†’

Recommended MCP Servers

View more MCP servers β†’

Take It Further

Maximize your productivity with these powerful resources

πŸ“‹

Define Your Standards

Set up coding standards to ensure this workflow produces consistent, high-quality results.

Browse Rules Library
πŸ“–

Master Workflows

Learn how to create custom workflows, use Turbo Mode, and build your automation library.

Complete Guide

How to use this Skill in Claude Code & Cursor

For Claude Code (CLI)

To use this skill in Claude Code, copy the rule content into your project's custom instructions or follow our Add-Skill CLI guide. This ensures Claude follows your standards during every code generation.

For Cursor & Windsurf

For Cursor or Windsurf, individual skills are best used in the "Rules for AI" section. This specific unit helps the agent avoid ai tools & agents issues, leading to cleaner, more efficient code.

Why the skill format matters: the standardized Agent Skills format lets your AI agent load detailed instructions only when they are relevant, keeping your prompt clean while improving results.

Source & attribution

This skill is categorized under AI Tools & Agents and is published by Giuseppe Trisciuoglio, maintained in giuseppe-trisciuoglio/developer-kit.

← Browse All Agent Skills
Sponsored AI assistant. Recommendations may be paid.