from pinecone import Pinecone
pc = Pinecone(api_key="YOUR_API_KEY")
# To get the unique host for an index,
# see https://docs.pinecone.io/guides/manage-data/target-an-index
index = pc.Index(host="INDEX_HOST")
index.upsert_records(
"example-namespace",
[
{
"_id": "rec1",
"chunk_text": "Apples are a great source of dietary fiber.",
"category": "digestive system",
},
{
"_id": "rec2",
"chunk_text": "Apples originated in Central Asia.",
"category": "cultivation",
}
]
)
Vectors
Upsert text
Upsert text into a namespace. Pinecone converts the text to vectors automatically using the hosted embedding model associated with the index.
Upserting text is supported only for indexes with integrated embedding.
For guidance, examples, and limits, see Upsert data.
POST
/
records
/
namespaces
/
{namespace}
/
upsert
from pinecone import Pinecone
pc = Pinecone(api_key="YOUR_API_KEY")
# To get the unique host for an index,
# see https://docs.pinecone.io/guides/manage-data/target-an-index
index = pc.Index(host="INDEX_HOST")
index.upsert_records(
"example-namespace",
[
{
"_id": "rec1",
"chunk_text": "Apples are a great source of dietary fiber.",
"category": "digestive system",
},
{
"_id": "rec2",
"chunk_text": "Apples originated in Central Asia.",
"category": "cultivation",
}
]
)
from pinecone import Pinecone
pc = Pinecone(api_key="YOUR_API_KEY")
# To get the unique host for an index,
# see https://docs.pinecone.io/guides/manage-data/target-an-index
index = pc.Index(host="INDEX_HOST")
index.upsert_records(
"example-namespace",
[
{
"_id": "rec1",
"chunk_text": "Apples are a great source of dietary fiber.",
"category": "digestive system",
},
{
"_id": "rec2",
"chunk_text": "Apples originated in Central Asia.",
"category": "cultivation",
}
]
)
Authorizations
Headers
Required date-based version header
Path Parameters
The namespace to upsert records into.
Body
application/x-ndjson
Each record in the request body must include an _id field and a field that matches your index's field_map configuration (such as chunk_text or data). All other fields are stored as metadata.
The unique ID of the record to upsert. Note that id can be used as an alias for _id.
Response
A successful response.
Was this page helpful?
⌘I