I would like to do the equivalent of this SQL but with Solr as my data store.
SELECT
DISTINCT txt
FROM
my_table;
What syntax would fo
Use the StatsComponent with parameter stats.calcdistinct to get a list of distinct values for a certain field:
Solr 7 https://lucene.apache.org/solr/guide/7_7/the-stats-component.html
Solr 6 https://cwiki.apache.org/confluence/display/solr/The+Stats+Component
It will also give you the count of distinct values.
stats.calcdistinct is probably available since 4.7.
http://wiki.apache.org/solr/StatsComponent
is outdated as it does not cover stats.calcdistinct
/select?stats=on&stats.field=region&rows=0&stats.calcdistinct=true
"stats":{
"stats_fields":{
"region":{
"min":"GB",
"max":"GB",
"count":20276,
"missing":0,
"distinctValues":["GB"],
"countDistinct":1}}}}
In case of facets you need to know the count to request all, or you set the facet.limit to something really high and count the result yourself. Also, you need a string field for making facets work the way you need it here.