Is there any alternatives for extracting the distinct count in the aggregate function

hi @sandeep_gajula !!

Welcome to our community :hugs:

Can you elaborate more?

Or maybe share a data sample and the outcome you want.

Thanks!

Sorry for the delay,

I have tried to extract the distinct count of the property but it has not worked properly.

In Weaviate, Iā€™m trying to get distinct counts for specific fields grouped by another field. For example, how many unique entries exist for itemType grouped by categoryName. Currently, the Aggregate query provides total counts but not distinct counts. Is there a way to retrieve only unique values in this setup, or an alternative approach within Weaviate?

Hi!

Is this what you want? From one of our recipes:

response = collection.aggregate.over_all(group_by="source")
for group in response.groups:
    print(group.grouped_by.value, group.total_count)

and it would output:

netherlands-wikipedia-article-text.pdf 274
brazil-wikipedia-article-text.pdf 247

More info here:

See the below sql query . how can i achieve similar response using weaviate

SELECT
client_name,
COUNT(DISTINCT application) AS distinct_applications,
COUNT(DISTINCT pdf) AS distinct_pdfs
FROM
your_table_name
GROUP BY
client_name;

Hi! This is not yet supported.