Summarize the amount of disk space that data uses

The Stats component returns simple statistics for numeric, string, and date fields within the document set. This can be useful for many tasks, and particularly useful for summarizing how much disk space is used by a query result.

For instance the following query returns the all of the Tiff items in the index

https://odn.voyagersearch.com/solr/v0/select?fq=format%3Aimage\%2Ftiff&fl=*&wt=json&indent=true

Adding “stats” to the query along with the field name “bytes”, where the file size is stored, will return statistics at the end of the results:

&stats=true&stats.field=bytes

The complete query is as follows

https://odn.voyagersearch.com/solr/v0/select?fq=format%3Aimage\\%2Ftiff&fl=*&wt=json&indent=true&stats=true&stats.field=bytes

The results can be found after the “doc” section of the response:

In this example the total number of Terabytes is:

You can learn more about the Stats Component in the Solr Documentation