Qdrant is a vector database built for AI applications — semantic search, recommendation systems, and RAG pipelines. REST and gRPC APIs with filtering and payload storage.
Setup
docker run -p 6333:6333 qdrant/qdrant
Create Collection
const response = await fetch('http://localhost:6333/collections/products', {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
vectors: { size: 384, distance: 'Cosine' }
})
});
Index Documents with Embeddings
import { QdrantClient } from '@qdrant/js-client-rest';
const client = new QdrantClient({ url: 'http://localhost:6333' });
// Upsert points with vectors and payload
await client.upsert('products', {
points: [
{
id: 1,
vector: await getEmbedding('Wireless bluetooth headphones with noise cancellation'),
payload: { name: 'Headphones', price: 89.99, category: 'audio' }
},
{
id: 2,
vector: await getEmbedding('Mechanical keyboard with Cherry MX switches'),
payload: { name: 'Keyboard', price: 129.99, category: 'peripherals' }
}
]
});
Semantic Search
const queryVector = await getEmbedding('good headphones for music');
const results = await client.search('products', {
vector: queryVector,
limit: 5,
filter: {
must: [{ key: 'price', range: { lte: 100 } }]
},
with_payload: true
});
// Returns headphones (semantically similar) under $100
Recommendation API
const recommendations = await client.recommend('products', {
positive: [1, 5], // IDs user liked
negative: [3], // IDs user disliked
limit: 10,
filter: { must: [{ key: 'category', match: { value: 'audio' } }] }
});
REST API
# Search
curl -X POST http://localhost:6333/collections/products/points/search \
-d '{"vector":[0.1,0.2,...],"limit":5,"filter":{"must":[{"key":"category","match":{"value":"audio"}}]}}'
# Get collection info
curl http://localhost:6333/collections/products
# Scroll through points
curl -X POST http://localhost:6333/collections/products/points/scroll \
-d '{"limit":10,"with_payload":true}'
Why This Matters
- Built for AI: First-class support for embeddings and RAG
- Filtering: Combine vector search with exact filters
- Payload storage: Store metadata alongside vectors
- Fast: Written in Rust, optimized for billion-scale
Need custom AI search or vector database tools? I build developer tools. Check out my web scraping actors on Apify or reach out at spinov001@gmail.com for custom solutions.
Top comments (0)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.