I have data in Solr that is being imported from a postgres database. The docs look something like this (much simplified):
"docs": [
{
"id": "1",
"strings_ss": [
"abc",
"bcd",
"efg",
],
"_version_": 1546754105942212600
},
{
"id": "2",
"strings_ss": [
"abc",
"hig",
],
"_version_": 1546754105942212600
},
{
"id": "3",
"strings_ss": [
"bcd",
"aaa",
],
"_version_": 1546754105942212600
}
]
I would like like to get a list of unique values in strings_ss
"abc","bcd","efg","hig","aaa"
With a single value field, I'm using grouping. But, that fails for multi valued fields with the error: can not use FieldCache on multivalued field:
What is the best way to get this list from Solr?
You can use solr facet query to get the unique values for the field. It will give you, unique values of the field and frequency (no of documents have that unique value). For more information, please check the links below,