[Question] Running Aggregate against Weaviate Cloud

Description

I keep getting an error when trying to run a query against the Weavaite cloud:
AttributeError: '_QueryCollection' object has no attribute 'aggregate'
I am lost as to what could be causing it as I have checked the documentation and done all the updates I could.

The code that I am running:

# Establish a connection to Weaviate Cloud
client = weaviate.connect_to_weaviate_cloud(
    cluster_url="",
    auth_credentials=weaviate.AuthApiKey(api_key="")
)

collection = client.collections.get("Test")

# Get collection specific to the required tenant
multi_tenants = collection.with_tenant("test")

multi_tenants.query.aggregate("Test") \
    .with_where({
    "path": ["document_name"],
    "operator": "Equal",
    "valueString": "document1"
}) \
    .with_tenant(tenant_id) \
    .with_fields("date_loaded { minimum maximum }") \
    .do()

Server Setup Information

  • Weaviate Server Version: Weaviate Cloud
  • Deployment Method:
  • Multi Node? Number of Running Nodes:
  • Client Language and Version: Python 3.11, Weaviate v.4.8.1
  • Multitenancy

Any additional Information

Hello @Analitiq,

Welcome to our community! It’s lovely having you here.

You can aggregate with a condition as shown below:

Could you please provide me your cluster endpoint? I will try to replicate and show you the method to aggregate.

I recommend you to update your client and weaviate db to the latest version as client v3 will be deprecated very soon.

Also, I see you’re on Weaviate Cloud. Feel free to email us at support@weaviate.io, which will create a support ticket in our system for our paid customers.

Have a lovely week!

1 Like

I have solved this like this:
response = collection.aggregate.over_all(total_count=True, filters=filters)

1 Like