Commands Cheat Sheet

Evaluating engineering tools? Get the comparison in Google Sheets

(Perfect for making buy/build decisions or internal reviews.)

Most-used commands
Your email is safe thing.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

Connection and Setup

pc init
Initialize Pinecone client with API key and environment

from pinecone import Pinecone
Import Pinecone in Python

pc = Pinecone(api_key='YOUR_API_KEY')
Create a Pinecone client instance

Index Management

pc.create_index(name='index-name', dimension=1536, metric='cosine')
Create a new vector index

pc.list_indexes()
List all indexes

pc.describe_index(name='index-name')
Get details about an index

pc.delete_index(name='index-name')
Delete an index

Vector Operations

index = pc.Index('index-name')
Connect to a specific index

index.upsert(vectors=[{'id': 'vec1', 'values': [0.1, 0.2, ...], 'metadata': {...}}])
Insert or update vectors

index.query(vector=[0.1, 0.2, ...], top_k=10, include_metadata=True)
Query for similar vectors

index.fetch(ids=['vec1', 'vec2'])
Retrieve specific vectors by ID

index.delete(ids=['vec1', 'vec2'])
Delete vectors by ID

index.delete(filter={'metadata_field': 'value'})
Delete vectors using metadata filter

Namespace Operations

index.describe_index_stats()
Get statistics about the index

index.upsert(vectors=[...], namespace='custom-namespace')
Upsert vectors to a specific namespace

index.query(vector=[...], namespace='custom-namespace')
Query vectors in a specific namespace

index.delete(delete_all=True, namespace='custom-namespace')
Delete all vectors in a namespace

Metadata Filtering

index.query(vector=[...], filter={'category': 'electronics'})
Query with metadata filter

index.delete(filter={'category': 'electronics'})
Delete vectors matching a metadata filter