Get a list of all the fields in the index

Get a list of all the fields in the index

Given Solrs somewhat schema list nature, it’s not required for all documents in the index to have all the fields available in the index. Sometimes as the data manager one might want to know what are all the currently used fields in the index.

For instance the following query returns all the fields available in the index including dynamic fields in csv format:

https://odn.voyagersearch.com/solr/v0/select?q=*:*&wt=csv&rows=0&facet

 

The presence of the facet parameter is needed to make this query work on newer versions of Solr. On older versions, it will work without it.

Adding a facet can help restrict the fields by a facet value, for instance, if you wanted to restrict the fields returned by a field called grp_Data_Theme that has one value as Orthoimagery, you can append this:

&fq=grp_Data_Theme:Orthoimagery

 

The complete query is as follows:

https://odn.voyagersearch.com/solr/v0/select?q=*:*&wt=csv&rows=0&facet&fq=grp_Data_Theme:Orthoimagery

 

The results will be a csv of the fields that match your facet.

More details can be found at this StackOverflow post:

https://stackoverflow.com/a/29546298