This repository contains a comprehensive tutorial for learning Qdrant vector database with Python.
- Python 3.7+
- Docker (for running Qdrant)
- Qdrant running on http://localhost:6333
If you want to start Qdrant without authentication for local development:
docker pull qdrant/qdrant
docker run -p 6333:6333 -p 6334:6334 -v $(pwd)/qdrant_storage:/qdrant/storage qdrant/qdrantFor a more secure setup with API key authentication:
docker run -d --name qdrant-secured \
-p 6333:6333 -p 6334:6334 \
-v $(pwd)/qdrant_storage:/qdrant/storage \
-e QDRANT__SERVICE__API_KEY=my-secure-admin-key-123 \
-e QDRANT__SERVICE__READ_ONLY_API_KEY=my-secure-readonly-key-456 \
qdrant/qdrantThis sets up:
- An admin API key (
my-secure-admin-key-123) with full access - A read-only API key (
my-secure-readonly-key-456) for search operations only
Install the required packages:
pip install qdrant-client numpy sentence-transformersThis tutorial is organized into several files:
- qdrant_basics.md - Conceptual introduction to Qdrant and vector databases
- 01_basic_operations.py - Basic operations with Qdrant (connecting, creating collections, adding vectors, basic search)
- 02_semantic_search.py - Using Qdrant for semantic search with text embeddings
- 03_advanced_features.py - Advanced Qdrant features (batch operations, complex filtering, pagination, collection management)
- qdrant_security.md - Guide to securing Qdrant with API keys and best practices
- api_key_authentication.md - Comprehensive guide to API key authentication in Qdrant
- api_key_example.py - Example of how to use API keys with Qdrant
- advanced_api_key_usage.py - Advanced example of using different API keys with different permission levels
- test_api_keys.py - Script to test API key authentication with Qdrant
- admin_vs_readonly.py - Demonstration of the difference between admin and read-only API keys
Each Python file is a standalone script that you can run:
python 01_basic_operations.py
python 02_semantic_search.py
python 03_advanced_features.py# Start Qdrant with API key authentication first
docker run -d --name qdrant-secured \
-p 6333:6333 -p 6334:6334 \
-v $(pwd)/qdrant_storage:/qdrant/storage \
-e QDRANT__SERVICE__API_KEY=my-secure-admin-key-123 \
-e QDRANT__SERVICE__READ_ONLY_API_KEY=my-secure-readonly-key-456 \
qdrant/qdrant
# Then run the security examples
python test_api_keys.py
python admin_vs_readonly.py
python api_key_example.py
python advanced_api_key_usage.py- Basic concepts of vector databases
- How to connect to Qdrant from Python
- Creating and managing collections
- Adding vectors with metadata (payload)
- Performing vector similarity search
- Filtering search results
- Batch processing for efficient vector operations
- Pagination and scroll API for large result sets
- Collection management operations
- Updating and deleting vectors
- Securing Qdrant with API key authentication
- Implementing admin and read-only permission levels
- Best practices for API key management
- Testing API key authentication
- Configuring Qdrant for secure deployments
After completing this tutorial, you can:
- Integrate Qdrant into your own applications
- Experiment with different embedding models
- Explore more advanced features like quantization and clustering
- Scale up to larger datasets
- Deploy Qdrant in a production environment