Prerequisites
- A Pinecone account and API key (get one or view pricing).
Let your agent set it up
The quickest way to start is to let your AI coding agent do the setup: it designs your schema, ingests your data, and runs your first query, all conversationally. The steps below cover Claude Code and Codex, which share the same Pinecone skills. Using Cursor or another agent? See all supported AI coding tools for the equivalent setup.Set your API key and install the plugin
The plugin needs Node.js and uv installed. The quickstart skill uses uv to run its bundled Python scripts.Restart Claude Code to activate the plugin.
- Claude Code
- Codex
Terminal
Installing the plugin requires access to the official Anthropic marketplace. Claude Code adds this access automatically the first time you start it. If the install fails with a
Marketplace "claude-plugins-official" not found error, your network or your organization’s Claude Code setup is probably blocking it.Set it up yourself
Build the index with an SDK or the REST API. Itschunk_text field is set up the same way as the default chunk_text field in the Pinecone console’s create index form. The steps run on sample documents, so you can finish first and then use your own files.
If you already generate your own embeddings, store them in a
dense_vector field instead of declaring embed. For the steps, see Bring your own vectors.Install an SDK
Install the Pinecone SDK for your language. Integrated embedding needs Python SDK The JavaScript examples use top-level
10.1.0 or later (Python 3.10+), Node.js SDK 9.1.0 or later (Node.js 22+), or Go SDK 7.1.0 or later (Go 1.25+, or Go 1.26+ for SDK 7.2.0 and later). The curl examples need no SDK, but they use jq to read the index host.await, so run them as an ES module, such as a .mjs file. The Go examples build one main function: the first block is the full program, and each later block adds to it.Set your API key
Set your API key as an environment variable. The SDKs read it automatically, and the curl examples pass it in a header.
Terminal
Create an index
Declare one
string field with both full_text_search and embed. Pinecone indexes the field’s text for keyword (BM25) search and embeds it for semantic search, so one field supports both. An empty embed config uses the default model, llama-text-embed-v2, at 1,024 dimensions. Only searchable fields go in the schema; other fields are stored on the documents as metadata (capped at 40 KB per document).Load sample documents
Each document has a required
_id, plain text on the chunk_text field, and any metadata you want to filter on, like category here. Pinecone embeds the text on write, so you don’t send vectors. Documents are indexed asynchronously, so the code waits 10 seconds before you search. If a search returns no results, wait a few seconds and run it again.Search by meaning
Score by Only the two policy documents are searched, and the refund policy ranks first:
embed and pass the query as text. Pinecone embeds the query with the same model it used for the documents and ranks them by semantic similarity, so a question finds the right passage even when it shares no words with it. The filter limits the search to documents whose category metadata is policy.Output
Search by exact terms
Score by Only the document that contains the term matches:Either search accepts a
text to rank the same field by BM25 keyword relevance, so an exact identifier like E1042 surfaces the document that contains it.Output
filter. For phrase matching and boolean queries, see the query syntax reference.Use your own files
To search your own documents, upsert text from your files the same way. Pinecone doesn’t extract or chunk files, so do those steps in your code before you upsert. If you already have embeddings for your files, see Bring your own vectors instead.Extract text from your files
Convert each file (PDF, DOCX, HTML, and so on) to plain text using a parser of your choice. The result should be a list of records, each with an ID and text, like the
docs list below.If you’re searching images instead of text, embed them with a multimodal embedding model and store the vectors in a
dense_vector field, as in Bring your own vectors.Chunk the text
Split your text into smaller pieces so each one is a focused, searchable passage. The embedding model reads only the first 2,048 tokens of a value and truncates the rest, so keep chunks well under that. The function below is a simple length-based split. For smarter approaches (by sentence, token, or document structure), see chunking strategies. Each chunk ID starts with its source document’s ID, so you can later fetch, replace, or delete all of a document’s chunks at once.
Upsert the chunks
An index with an For a large dataset in Python, use
embed field accepts up to 96 documents per upsert, so send the chunks in batches. Then search them with the same calls as above.batch_upsert, which sends batches in parallel and returns any failed batches so you can retry them. You can’t bulk import into an index with an embed field.Next steps
- Design a schema for your own data, with more than one searchable field.
- Choose an embedding model or dimension, or add
sparse_embedfor learned-sparse search. - Filter by metadata, including text-match filters on full-text search fields.