Metadata is empty

Hi. i’m trying to save data into collection and then read similar data with near_text function. but after insert data into collection metadata object is null. is it normal?

 def __init__(self):
        self.client = weaviate.use_async_with_weaviate_cloud(
            cluster_url="---", 
            auth_credentials=Auth.api_key("---"),  
            headers={'X-OpenAI-Api-key': "----"}  # 
        )
 async def create_collection(self, collection_name: str, properties, vectorizer_config=None):
        async with self.client:
            try:
                if vectorizer_config is None:
                    vectorizer_config = weaviate.classes.config.Configure.Vectorizer.text2vec_openai()
                
                if not await self.client.collections.exists(collection_name):
                    await self.client.collections.create(
                        name=collection_name,
                        vectorizer_config=vectorizer_config,
                        properties=properties
                    )
                    print(f"Collection '{collection_name}' created successfully!")
                else:
                    print(f"Collection '{collection_name}' already exists.")
            except Exception as e:
                print(f"Error creating collection: {e}")
async def upload_data(self, collection_name: str, data, uuid_property: str):
        async with self.client:
            try:
                collection = self.client.collections.get(collection_name)
                for item in data:
                    item_dict = item.model_dump()

                    # Validate that the uuid_property exists
                    if uuid_property not in item_dict:
                        raise ValueError(f"Missing UUID property '{uuid_property}' in data: {item_dict}")

                    which_uuid = item_dict[uuid_property]

                    # Check if the object already exists
                    if await collection.data.exists(which_uuid):
                        print(f"Updating existing object with UUID: {which_uuid}")
                        await collection.data.update(
                            uuid=which_uuid,
                            properties=item_dict
                        )
                    else:
                        print(f"Inserting new object with UUID: {which_uuid}")
                        await collection.data.insert(
                            properties=item_dict,
                            uuid=which_uuid,
                        )

            except Exception as e:
                print(f"Error uploading data: {e}")
async def get_data_by_query(self, collection_name: str, content: str, limit: int = 10):
        async with self.client:
            collection = self.client.collections.get(collection_name)
            result = await collection.query.near_text(
                query=content,
                limit=limit,
                
            )
            return result

result from get_data_by_query

{
    "objects": [
        {
            "uuid": "3b7a8252-e44c-4ab9-b94b-f99b62716a2c",
            "metadata": {
                "creation_time": null,
                "last_update_time": null,
                "distance": null,
                "certainty": null,
                "score": null,
                "explain_score": null,
                "is_consistent": null,
                "rerank_score": null
            },
            "properties": {
                "session_uuid": "3b7a8252-e44c-4ab9-b94b-f99b62716a2c",
                "summary": "hello world",
                "brand_id": 1234
            },
            "references": null,
            "vector": {},
            "collection": "SummaryCollection"
        }
    ]
}

hi @Davit_Makharashvili !!

Welcome to our community :hugs:

This is the expected result. As documented here, you need to explicitly request the metadata to be returned.

So the query need to be:

collection.query.near_text(query=content,
    limit=limit,
    return_metadata=wvc.query.MetadataQuery(distance=True)        
)

Let me know if this helps!

Thanks!