Upsert documents
Documents are the unit of data in a document index. Each field in a document is indexed according to the configuration you declared for it in the schema, not just its type. For example, astring field can be indexed for BM25 with the full_text_search config, and a separate dense_vector field can store vector values you provide at upsert time. A string field can also declare embed or sparse_embed so Pinecone embeds its text with integrated embedding.
The following example upserts two documents into the articles namespace with the Documents API. Each document is indexed for BM25 ranking on body. The category field isnโt declared in the schema, so itโs stored as metadata and automatically indexed for filtering:
The Documents API requires API version
2026-07 or later.string fields with full_text_search, embed, or sparse_embed, plus dense_vector and sparse_vector fields. Any other field you upsert is stored on the document as metadata, returned with include_fields, and indexed for filtering.
Field names must be unique, non-empty strings of up to 64 bytes. They canโt start with _, which is reserved for system fields such as _id and _score, or with $, which is reserved for filter operators.
Upsert replaces the whole document for a given _id. To change individual fields, see Update documents. For document, field, and request size limits, see Upsert limits. For more examples and the response schema, see Full-text search.
Upsert dense vectors
To upsert dense vectors into a document index, use the Upsert documents operation:- Specify the
namespaceto upsert into. If the namespace doesnโt exist, itโs created. To use the default namespace, set the namespace to"__default__". - Format your input data as documents, each with the following:
- An
_idfield with a unique document identifier for the index namespace. - The
dense_vectorfield declared in the index schema, with the vector values. This example uses a field namedembedding. - Optionally, other fields, which are stored as metadata. When you search the index, you can use metadata to filter search results.
- An
Upsert sparse vectors
Upsert sparse vectors when your data is encoded by a learned sparse model, such aspinecone-sparse-english-v0, or when your application generates the sparse vectors itself. For BM25 keyword search over raw text without managing a model, see Upsert documents.
To upsert sparse vectors into a document index, use the Upsert documents operation:
- Specify the
namespaceto upsert into. If the namespace doesnโt exist, itโs created. To use the default namespace, set the namespace to"__default__". - Format your input data as documents, each with the following:
- An
_idfield with a unique document identifier for the index namespace. - The
sparse_vectorfield declared in the index schema, withindicesandvaluesarrays. This example uses a field namedsparse_embedding. - Optionally, other fields, which are stored as metadata. When you search the index, you can use metadata to filter search results.
- An
Upsert in batches
Send upserts in batches to help increase throughput. A request can contain up to 1,000 documents and 2 MB, or up to 96 documents when the schema declaresembed or sparse_embed. The lower limit comes from the hosted embedding models used during integrated embedding.
In Python, index.documents.batch_upsert splits a larger list into batches, sends them in parallel, and halves any batch the server rejects as too large.
Upsert in parallel
Send multiple upserts in parallel to help increase throughput. Each upsert call blocks until the response arrives, so send several at once. In Python,batch_upsert sends batches in parallel. Set max_concurrency to cap the number of requests in flight. In JavaScript and Go, send the batches concurrently yourself:
Upsert limits
The limit for text is lower because Pinecone converts that text to vectors at upsert time with integrated embedding, and 96 is the max batch size of the hosted embedding models doing the conversion.
The 40 KB filterable metadata limit doesnโt apply to
full_text_search text fields.