Quickstart
This guide shows you how to set up a Pinecone vector database in minutes.
Before you begin
-
If you haven’t already, sign up for a Standard or Enterprise Pinecone account. You’ll get $100 in serverless credits that will last you far beyond this quickstart.
-
If you’re on the Starter plan, upgrade to Standard or Enterprise to get your $100 in serverless credits.
-
If you don’t want to provide a credit card, you can create a free pod-based index.
1. Install a Pinecone client
Pinecone exposes a simple REST API for interacting with its vector database. You can use the API directly, or you can use one of the official Python or Node.js clients:
2. Get your API key
You need an API key to make API calls to your Pinecone project. To get your key, follow these steps:
- Open the Pinecone Console.
- Go to API Keys.
- Copy your API key.
3. Initialize your client connection
Using your API key, initialize your client connection to Pinecone:
Api-Key
header that specifies your API key. You’ll see this in all subsequent curl
examples. 4. Create a serverless index
In Pinecone, you store vector embeddings in indexes. The vectors in any index you create must share the same dimensionality and distance metric for measuring similarity.
Use the following code to create a serverless index named “quickstart” that performs nearest-neighbor search using the Euclidean distance similarity metric for vectors of 8 dimensions:
5. Upsert vectors
Now that you’ve created your index, upsert sample vectors into 2 distinct namespaces.
Namespaces let you partition vectors within a single index. Although optional, they are a best practice for speeding up queries, which can be filtered by namespace, and for complying with multi-tenancy requirements.
-
Create a client instance that targets the “quickstart” index:
-
Use the
upsert
operation to write 8 8-dimensional vectors into 2 distinct namespaces:
6. Check the index
Pinecone is eventually consistent, so there can be a delay before your upserted vectors are available to query. Use the describe_index_stats
operation to check if the current vector count matches the number of vectors you upserted:
7. Run a similarity search
Query each namespace in your index for the 3 vectors that are most similar to an example 8-dimensional vector using the Euclidean distance metric you specified for the index:
This is a simple example. As you put more demands on Pinecone, you’ll see it returning low-latency, accurate results at huge scales, with indexes of up to billions of vectors.
8. Clean up
When you no longer need the “quickstart” index, use the delete_index
operation to delete it:
Next steps
Now that you have a serverless index and experience with basic Pinecone operations, check out our notebooks anbd sample applications using common AI patterns, tools, and algorithms, or start upserting your own vector embeddings.
Was this page helpful?