Skip to main content
Go to documentation:
⌘U
Weaviate Database

Develop AI applications using Weaviate's APIs and tools

Deploy

Deploy, configure, and maintain Weaviate Database

Weaviate Agents

Build and deploy intelligent agents with Weaviate

Weaviate Cloud

Manage and scale Weaviate in the cloud

Additional resources

Academy
Integrations
Contributor guide

Need help?

Weaviate LogoAsk AI Assistant⌘K
Community Forum

Update objects

Weaviate allows partial or complete object updates.

Additional information

Collection (class) Name in Object CRUD Operations

Collections act like namespaces, so two different collections could have duplicate IDs between them.


Prior to Weaviate v1.14 you can manipulate objects without specifying the collection name. This method is deprecated. It will be removed in Weaviate v2.0.0.

Starting in v1.20, you can have multi-tenant datasets. When multi-tenancy is enabled, the tenant name is required.

Always include the collection name, and, when enabled, the tenant name.

Update object properties

This operation replaces the entire value of the specified properties only, leaving the unspecified properties. Provide the collection name, the object id, and the properties to update.

If you update the value of a previously vectorized property, Weaviate re-vectorizes the object automatically. This also reindexes the updated object.

However, if you add a new property to your collection definition, Weaviate only vectorizes the new objects. Weaviate doesn't re-vectorize and re-index existing objects when a new property is defined, only when an existing property is updated.

uuid = "..."  # replace with the id of the object you want to update

jeopardy = client.collections.get("JeopardyQuestion")
jeopardy.data.update(
uuid=uuid,
properties={
"points": 100,
}
)

Update object vector

The object vector can also be updated similarly to properties. For named vectors, provide the data as a dictionary/map similarly to the object creation.

jeopardy = client.collections.get("JeopardyQuestion")
jeopardy.data.update(
uuid=uuid,
properties={
"points": 100,
},
vector=[0.12345] * 1536
)

Replace an entire object

The entire object can be replaced by providing the collection name, id and the new object.

jeopardy = client.collections.get("JeopardyQuestion")
jeopardy.data.replace(
uuid=uuid,
properties={
"answer": "Replaced",
# The other properties will be deleted
},
)

Delete a property

Deleting or updating properties in the collection definition is not yet supported.

At object level, you can replace the object with a copy that has those properties deleted, or set to "" for text properties.

from typing import List
from weaviate import WeaviateClient

def del_props(client: WeaviateClient, uuid_to_update: str, collection_name: str, prop_names: List[str]) -> None:
collection = client.collections.get(collection_name)

# fetch the object to update
object_data = collection.query.fetch_object_by_id(uuid_to_update)
properties_to_update = object_data.properties

# remove unwanted properties
for prop_name in prop_names:
if prop_name in properties_to_update:
del properties_to_update[prop_name]

# replace the properties
collection.data.replace(
uuid=uuid_to_update,
properties=properties_to_update
)


uuid = "..." # replace with the id of the object you want to delete properties from
del_props(client, uuid, "JeopardyQuestion", ["answer"])

Questions and feedback

If you have any questions or feedback, let us know in the user forum.