document_id metadata field.
Each task shows a document index first, then a vector index. The document-index code assumes a chunk_text field declared with embed for integrated embedding, so Pinecone generates the vectors, and requires API version 2026-07 (Python SDK 10.1.0 or later). The vector-index code assumes you generate the vectors yourself.
Pinecone is eventually consistent, so a read right after a write (upsert, update, or delete) may not return the latest data. If you need to read immediately after writing, add a short delay or retry logic.
Upsert chunks
Upsert each chunk with its structured ID anddocument_id, plus any other metadata you want to filter on or display. On a document index with integrated embedding, each upsert is capped at 96 documents instead of 1,000:
- Document index
- Vector index
Python
Search within a document
To search only one source document’s chunks, add a metadata filter ondocument_id. On a document index, you search with query text and Pinecone embeds it:
- Document index
- Vector index
Python
Fetch all chunks of a document
To retrieve all of a source document’s chunks, list their IDs by prefix, and then fetch them. On a document index, you can also fetch them by passing afilter such as {"document_id": {"$eq": "document1"}} to documents.fetch, which returns up to 100 matches per page by default (set limit for up to 10,000):
- Document index
- Vector index
Python
Delete chunks
To delete some or all of a source document’s chunks, filter on their metadata:- Document index
- Vector index
Python
Replace a chunked document
When the number or order of a source document’s chunks changes, delete all of its chunks with a metadata filter, and then upsert the new ones. To change one chunk’s content without changing the chunk count, update it by ID instead.- Document index
- Vector index
Python