- When updating a single record, you can change the vector and/or metadata.
- When updating multiple records using a metadata filter, you can change only metadata.
Update a single record
To update the vector and/or metadata of a single record, use theupdate
operation with the following parameters:
namespace
: The namespace containing the record to update. To use the default namespace, set the namespace to"__default__"
.id
: The ID of the record to update.- One or both of the following:
- Updated values for the vector. Specify one of the following:
values
: For dense vectors. Must have the same length as the existing vector.sparse_values
: For sparse vectors.
setMetadata
: The metadata to add or change. When updating metadata, only the specified metadata fields are modified, and if a specified metadata field does not exist, it is added.
- Updated values for the vector. Specify one of the following:
If a non-existent record ID is specified, no records are affected and a
200 OK
status is returned.example-namespace
namespace:
genre
metadata value are changed, but the type
metadata value is unchanged:
Update metadata across multiple records
This feature is in early access and is available only on the
unstable
version of the API. See limitations for details.update
operation with the following parameters:
-
namespace
: The namespace containing the records to update. To use the default namespace, set this to"__default__"
. -
filter
: A metadata filter expression to match the records to update. -
setMetadata
: The metadata to add or change. When updating metadata, only the specified metadata fields are modified. If a specified metadata field does not exist, it is added. -
dry_run
: Optional. Iftrue
, the number of records that match the filter expression is returned, but the records are not updated.Each request updates a maximum of 100,000 records. Use"dry_run": true
to check if you need to run the request multiple times. See the example below for details.
-
To check how many records match the filter expression, send a request with
"dry_run": true
:The response contains the number of records that match the filter expression:curlSince this number exceeds the 100,000 record limit, you’ll need to run the update request multiple times. -
Initiate the first update by sending the request without the
dry_run
parameter:Again, the response contains the total number of records that match the filter expression, but only 100,000 will be updated:curl -
Pinecone is eventually consistent, so there can be a slight delay before your update request is processed. Repeat the
dry_run
request until the number of matching records shows that the first 100,000 records have been updated:curl -
Once the first 100,000 records have been updated, update the remaining records:
curl
-
Repeat the
dry_run
request until the number of matching records shows that the remaining records have been updated:curlOnce the request has completed, all matching records include the author name as metadata:
Limitations
- This feature is available only on the
unstable
version of the API. - Each request updates a maximum of 100,000 records. Use
"dry_run": true
to check if you need to run the request multiple times. See the example above for details. - You can add or change metadata across multiple records, but you cannot remove metadata fields.