Key features
- Serverless deployment: Auto-scaling with pay-per-use pricing
- Native hybrid search: Built-in sparse-dense vector fusion
- Namespace isolation: Logical partitioning for multi-tenancy
- Metadata filtering: Automatic flattening for nested structures
- Distance metrics: Cosine, Euclidean, dotproduct
- Pod-based deployment: Dedicated infrastructure for consistent performance
Installation
Pinecone requires the gRPC client for production use:Connection
Cloud configuration
Configuration options
pinecone.yaml
Index creation
Serverless index
Recommended for most use cases with automatic scaling:Pod-based index
For consistent performance and advanced features:Recreate existing index
Upserting documents
From Haystack documents
From raw dictionaries
Metadata flattening
Pinecone requires scalar metadata values. Nested dictionaries are automatically flattened:Querying
Dense vector search
Hybrid search
Combine dense and sparse vectors for semantic + keyword matching:Metadata filtering
Filter results using Pinecone’s query syntax:Supported filter operators
Multi-tenancy with namespaces
Create namespace-isolated data
List namespaces
Delete namespace
Pinecone supports up to 100,000 namespaces per index. For more tenants, use payload filtering with Qdrant or partition keys with Milvus.
Fetching documents
Retrieve documents by ID without vector search:Deleting documents
Delete by IDs
Delete all in namespace
Index statistics
Advanced features
Estimate match count
Wait for index readiness
Best practices
Batch upserts for efficiency
Batch upserts for efficiency
Use larger batch sizes (100-500) for faster ingestion:
Namespace strategy for multi-tenancy
Namespace strategy for multi-tenancy
Use namespaces for logical isolation, not physical isolation:
- Good: Separating dev/staging/prod environments
- Good: Isolating 100-10,000 tenants
- Avoid: Millions of namespaces (use Milvus partition keys instead)
Metadata design
Metadata design
Keep metadata flat and scalar for optimal filtering:
Index configuration
Index configuration
Choose the right metric for your embeddings:
- Cosine: Normalized vectors (most common)
- Euclidean: Unnormalized vectors with absolute distances
- Dotproduct: Maximum inner product search
Error handling
Source reference
Implementation:src/vectordb/databases/pinecone.py
Key classes and methods:
PineconeVectorDB.__init__(): src/vectordb/databases/pinecone.py:71create_index(): src/vectordb/databases/pinecone.py:167upsert(): src/vectordb/databases/pinecone.py:267query(): src/vectordb/databases/pinecone.py:334query_with_sparse(): src/vectordb/databases/pinecone.py:377hybrid_search(): src/vectordb/databases/pinecone.py:424