Metadata properties

Description

What is behavior of creation time and last_update time in metadata.
Why creation_time is always updating.


import weaviate.classes.config as wcc
import weaviate.classes as wvc

client.collections.create(
    name="Test_time",
    vectorizer_config=wcc.Configure.Vectorizer.text2vec_transformers(),
    inverted_index_config=wcc.Configure.inverted_index(
        index_timestamps = True
    ),
    properties=[
        wcc.Property(
            name="question",
            data_type=wcc.DataType.TEXT,
            tokenization=wcc.Tokenization.WORD,
        ),
        wcc.Property(
            name="answer",
            data_type=wcc.DataType.TEXT,
            tokenization=wcc.Tokenization.FIELD,
        )
    ],
)
dddd = [
    
    {"question": "What is 2 + 2?", "answer": "41"},
    {"question": "What is the largest ocean?", "answer": "Pacific Ocea1n"},
   ]
from weaviate.util import generate_uuid5
import numpy as np
count=0
with client.batch.dynamic() as batch:
    for idd in dddd:
        count+=1
        batch.add_object(
            properties=idd,
            vector=np.random.rand(1536),
            collection="Test_time",
            uuid=generate_uuid5(f"test_time-id-{count}")
        )
if client.batch.failed_objects:
    print("Failed Objects: ", client.batch.failed_objects)

If I again use add_object with update data like
dddd = [

{"question": "What is 2 + 2?", "answer": "4"},
{"question": "What is the largest ocean?", "answer": "Pacific Ocean"},

]
Why creation time gets updated ?

Server Setup Information

  • Weaviate Server Version:
  • Deployment Method:
  • Multi Node? Number of Running Nodes:
  • Client Language and Version:
  • Multitenancy?:

Any additional Information

Good morning @2020ashish, Happy Friday! :hugs:

In Weaviate, each data object has two primary timestamps:

creationTimeUnix: The timestamp when the object was initially created.

lastUpdateTimeUnix: The timestamp of the object’s most recent update.

Both timestamps will remain identical until the object is explicitly updated using the update_object method, which only modifies the lastUpdateTimeUnix while keeping the creationTimeUnix intact.

However, in batch operations with add_object, if the same UUID is provided, Weaviate will overwrite the existing object, treating it as a new insertion. If the UUID is different, no overwriting occurs.

Does that make sense?

Thanks @Mohamed_Shahin
Curretly facing huge read/write operation in mentioned case.
can you help me optimize my code I am getting hnsw_vector_cache_prefill frequently - #5 by 2020ashish

1 Like