Qdrant Integration

Qdrant is a high-performance vector search engine designed for production workloads. It provides advanced filtering, real-time updates, and clustering capabilities for enterprise Cognee deployments.
Qdrant excels in production environments where you need high-performance vector search, real-time updates, and advanced filtering capabilities.

Why Qdrant?

High Performance

Optimized Search
  • Sub-millisecond search times
  • Efficient memory usage
  • Parallel query processing
  • Advanced indexing algorithms

Production Ready

Enterprise Features
  • Clustering and replication
  • High availability setup
  • Monitoring and metrics
  • Backup and recovery

Advanced Filtering

Precise Queries
  • Metadata-based filtering
  • Complex query conditions
  • Hybrid search capabilities
  • Real-time updates

Scalability

Horizontal Scaling
  • Distributed architecture
  • Automatic sharding
  • Load balancing
  • Multi-node clusters

Installation & Setup

1

Install Qdrant

Choose your deployment method:Docker (Recommended for development):
docker run -d --name qdrant -p 6333:6333 qdrant/qdrant
Docker Compose:
# docker-compose.yml
version: '3.8'
services:
  qdrant:
    image: qdrant/qdrant
    ports:
      - "6333:6333"
    volumes:
      - ./qdrant_data:/qdrant/storage
Cloud (Qdrant Cloud): Sign up at cloud.qdrant.io
2

Configure Cognee

import os
import cognee

# Qdrant configuration
os.environ["VECTOR_DB_PROVIDER"] = "qdrant"
os.environ["VECTOR_DB_URL"] = "http://localhost:6333"

# For Qdrant Cloud
# os.environ["VECTOR_DB_URL"] = "https://your-cluster.qdrant.io"
# os.environ["VECTOR_DB_KEY"] = "your-qdrant-api-key"

print("Qdrant configured successfully!")
3

Test Connection

import asyncio

async def test_qdrant():
    # Test the connection
    await cognee.add("Qdrant provides high-performance vector search.")
    await cognee.cognify()
    
    # Test search
    results = await cognee.search(
        "high performance vector search",
        query_type=SearchType.CHUNKS
    )
    
    print(f"Found {len(results)} results")
    print(f"Top result score: {results[0]['score']:.3f}")

asyncio.run(test_qdrant())

Configuration Options

import os

# Local Qdrant instance
os.environ["VECTOR_DB_PROVIDER"] = "qdrant"
os.environ["VECTOR_DB_URL"] = "http://localhost:6333"

# Optional: Collection configuration
os.environ["QDRANT_COLLECTION_NAME"] = "cognee_vectors"
os.environ["QDRANT_VECTOR_SIZE"] = "1536"  # Match your embedding dimensions

Advanced Features

Precise Search
# Add data with metadata
await cognee.add(
    "Machine learning improves medical diagnosis accuracy.",
    metadata={
        "domain": "healthcare",
        "topic": "machine_learning", 
        "confidence": 0.95,
        "source": "research_paper"
    }
)

# Search with filters
results = await cognee.search(
    "medical applications",
    query_type=SearchType.CHUNKS,
    filters={
        "domain": "healthcare",
        "confidence": {"gte": 0.9}
    }
)

Monitoring & Analytics

import cognee
import asyncio
import time

async def monitor_performance():
    # Track query performance
    query_times = []
    
    for i in range(10):
        start = time.time()
        
        results = await cognee.search(
            f"test query {i}",
            query_type=SearchType.CHUNKS
        )
        
        query_time = time.time() - start
        query_times.append(query_time)
        
        print(f"Query {i}: {query_time:.3f}s, {len(results)} results")
    
    avg_time = sum(query_times) / len(query_times)
    print(f"Average query time: {avg_time:.3f}s")

asyncio.run(monitor_performance())

Troubleshooting

Cannot Connect to Qdrant
# Test Qdrant connection
import requests

try:
    response = requests.get("http://localhost:6333/health")
    if response.status_code == 200:
        print("✅ Qdrant is running")
    else:
        print(f"❌ Qdrant returned status {response.status_code}")
except Exception as e:
    print(f"❌ Cannot connect to Qdrant: {e}")
API Key Issues
  • Verify API key is correct for Qdrant Cloud
  • Check key permissions and quotas
  • Ensure proper authentication headers

Next Steps