Manage Data


In addition to inserting and querying data, you can also fetch an item ((id, vector) pair) by id, update an item’s vector by id, delete an item by id, or get information about the index.


Get information about an index.

# Connect to index first
index = pinecone.Index("pinecone-index")

# InfoResult(index_size=10000)

Get information about a specific namespace within an index.'namespace-1')


Fetch items by their ids.

index.fetch(ids=["id-1", "id-2"])

# [FetchResult(id='id-1', vector=array([0.99999994, 0.99999994], dtype=float32)),
#  FetchResult(id='id-2', vector=array([1.9999999, 1.9999999], dtype=float32))]

Fetch one item at a time.


# FetchResult(id='id-3', vector=array([3., 3.], dtype=float32))


Updating an item by id is done the same way as inserting items. (Write operations in Pinecone are idempotent.)

Let’s update the value of the item ("id-3", [3., 3.]):

index.unary_upsert(item=("id-3", 3.3 + np.zeros(2)))

Now fetch the item again and we should get ("id-3", [3.3, 3.3]):


# FetchResult(id='id-3', vector=array([3.3, 3.3], dtype=float32))

Delete Items

Delete items by their ids.

acks = index.delete(ids=["id-1", "id-2"])

# [DeleteResult(id='id-1'), DeleteResult(id='id-2')]

DeleteResult(id='id-1') is an acknowledgement that the item with id='id-1' has been deleted from the index.

Delete one item at a time.


# DeleteResult(id='id-3')