Overview
Pinecone is a managed vector database optimized for similarity search at scale. The LlamaIndex integration provides seamless storage and retrieval of embeddings.Installation
Basic Usage
Constructor Options
string
Pinecone index name (defaults to
PINECONE_INDEX_NAME env var)string
default:""
Namespace for organizing vectors (defaults to
PINECONE_NAMESPACE env var)string
Pinecone API key (defaults to
PINECONE_API_KEY env var)number
default:100
Batch size for upsert operations (defaults to
PINECONE_CHUNK_SIZE env var)string
default:"text"
Metadata key for storing text content
Prerequisites
Create Pinecone Index
- Sign up at Pinecone
- Create an index:
Configuration
Environment Variables
With Custom Client
Querying
Basic Query
Metadata Filtering
Namespaces
Organize vectors into namespaces:Managing Data
Add Documents
Delete by Document ID
Clear Index
Hybrid Search
Combine vector and metadata search:Batch Operations
Loading Existing Index
Metrics
Pinecone supports different distance metrics:Index Stats
Serverless vs Pod-based
Serverless (Recommended)
Pod-based
Best Practices
- Match dimensions: Ensure index dimension matches embedding model
- Use namespaces: Organize data by environment or use case
- Batch operations: Use appropriate chunk size for performance
- Monitor costs: Track storage and query usage
- Use metadata filters: Narrow search scope for better results
- Choose right metric: Cosine for normalized vectors, dotproduct for speed