Aggregation over multiple properties in python

Description

Hi community! I tried to do aggregation with group by, and was looking for some examples on grouping by on multiple properties of a collection. However, I could only find examples where it groups by one property at a time, such as the one below -

try:
    collection = client.collections.get("Article")
    response = collection.aggregate.over_all(
        group_by=GroupByAggregate(prop="inPublication"),
        total_count=True,
        return_metrics=wvc.query.Metrics("wordCount").integer(mean=True)
    )

    for g in response.groups:
        print(g.total_count)
        print(g.properties)
        print(g.grouped_by)

finally:
    client.close()

I wonder if it is possible for us to do group_by with multiple properties?

Server Setup Information

  • Weaviate Server Version: 1.25.11
  • Deployment Method: docker
  • Multi Node? Number of Running Nodes: 1
  • Client Language and Version: Python 4.5.7
  • Multitenancy?: No

hi @longspearfish!! Hope you are having a lovely week!

You can only group by one property at a time. :slightly_frowning_face:

Check here a related issue/question on that:

Thanks!

1 Like