Sum, average, min, and max aggregations

Finding the sum of a field, the minimum value for a field, the maximum value for a field, or an average, are very common operations. For people who are familiar with SQL, the query to find the sum is as follows:

SELECT sum(downloadTotal) FROM usageReport;

The preceding query will calculate the sum of the downloadTotal field across all the records in the table. This requires going through all the records of the table or all the records in the given context and adding the values of the given fields.

In Elasticsearch, a similar query can be written using the sum aggregation. Let's look at the sum aggregation first.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.195.91