> ## Documentation Index
> Fetch the complete documentation index at: https://upstash.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Update

## Methods

The `update` method enables you to update the `vector`, `metadata`, or `data`
of a vector.

## Update Example

```python theme={"system"}
from upstash_vector import Index

index = Index.from_env()

updated = index.update(
    id="id1",
    metadata={"new": "metadata"},
    data="new-data",
)

print(updated)
```

## Patch Metadata Example

It is also possible to patch metadata (update or delete existing fields or
set new fields) according the [JSON Merge Patch](https://datatracker.ietf.org/doc/html/rfc7386) algorithm.

```python theme={"system"}
from upstash_vector import Index
from upstash_vector.types import MetadataUpdateMode

index = Index.from_env()

updated = index.update(
    id="id2",
    metadata={
        "existing-field": "new-value",
        "existing-field-to-delete": None,
        "new-field": "new-value",
    },
    metadata_update_mode=MetadataUpdateMode.PATCH,
)

print(updated)
```

Also, you can specify a namespace to operate on. When no namespace
is provided, the default namespace will be used.

```python theme={"system"}
index.update(..., namespace="ns")
```


## Related topics

- [Upserting Vectors](/docs/vector/sdks/php/commands/upsert-vectors.md)
- [Document Updates](/docs/redis/search/document-updates.md)
- [Update Vector](/docs/vector/api/endpoints/update.md)
- [Update Regions](/docs/devops/developer-api/redis/update_regions.md)
- [Update a Workflow](/docs/workflow/howto/changes.md)
