As described in SOLR-7214, the unique function seems wildly off, but only if you have enough values.
Here's the fix.
Commit 1677091 from Yonik Seeley in branch 'dev/trunk'
[ https://svn.apache.org/r1677091 ]
SOLR-7494: fix unique() function for high cardinality fields
Commit 1677092 from Yonik Seeley in branch 'dev/branches/branch_5x'
[ https://svn.apache.org/r1677092 ]
Bulk close for 5.2.0.