How do I search through a field like field_a for its unique values and then return the counts of each value in a new table?
How do I return a table that looks like this:
In reality I have hundreds of values so the query needs to be able to find all unique values, not just "purple", "gold", and "black".
Give this a try your_base_search | top limit=0 field_a | fields field_a count
your_base_search | top limit=0 field_a | fields field_a count
top command, can be used to display the most common values of a field, along with their count and percentage.
fields command, keeps fields which you specify, in the output.
View solution in original post
This can be achieved by using a simple stats count by command
your base search | stats count by field_a
I completely forgot about top. This works, thanks!