Distinct values from a field in vespa

Viewed 92

I'm using vespa to view some data. Consider the following data

id product brand 1 a b1 2 b b1 3 c b1 4 d b2 5 e b3

I tried grouping to display the data from brand field. I had a field with price and I wrote a query like this SELECT * FROM s_data where default contains "soap" | all(group(brand) each(output(sum(price)))); Basically, I don't want to calculate the sum of price, all I want is distinct values from the field 'brand'. Is there a way to do that in vespa?

1 Answers

all(group(brand) each(output(count())))

Gives you all the unique values of the brand field attribute along with their occurrences count. If you really don't need the count you can ignore it in the output.

Related