Skip to main content

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

  1. Sign up at Pinecone
  2. 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

Combine vector and metadata search:

Batch Operations

Loading Existing Index

Metrics

Pinecone supports different distance metrics:

Index Stats

Serverless vs Pod-based

Pod-based

Best Practices

  1. Match dimensions: Ensure index dimension matches embedding model
  2. Use namespaces: Organize data by environment or use case
  3. Batch operations: Use appropriate chunk size for performance
  4. Monitor costs: Track storage and query usage
  5. Use metadata filters: Narrow search scope for better results
  6. Choose right metric: Cosine for normalized vectors, dotproduct for speed

Troubleshooting

Index Not Found

Dimension Mismatch

Ensure embedding model dimensions match index:

See Also