Grouping values of specific field with count

I can't find a query to get all distinct values of a field grouped and with a count of their occurrance.

So i have e.g. 10 documents with a field "info". "Info" has various values.
Output should be something like:
["infoValue1"] = 3;
["infoValueXYZ"] = 1;
["infoValueWhatever"] = 6;

Do you have an idea please, how I can achieve this?

Use terms aggregation.Here

Ah I see! Thank you very much.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.