Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

The Stats component returns simple statistics for numeric, string, and date fields within the document set. This is useful for many tasks. It’s 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:

stats: {
  stats_fields: {
    bytes: {
      min: 0,
      max: 21340766014,
      count: 12419673,
      missing: 344732,
      sum: 500288101188175,
      sumOfSquares: 1.0591308004924849e+23,
      mean: 40281906.06855551,
      stddev: 83097631.23762643
    }
  }
}

In this example the total number of Terabytes is:

500,288,101,188,175 Bytes ÷ 1,099,511,627,776 = 500.3 Terabytes

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

  • No labels