The metrics aggregations family provides common uses of functions to perform simple mathematical operations on values in one or more fields, and help to analyze grouped sets of documents. We will illustrate each type of aggregation in the metrics family using the fields from the cf_etf, cf_etf_hist_price,
and cf_etf_dividend indexes in the following subsections.
Metrics aggregations
avg
Compute the average of the numeric field value of the records. The following example aims to find the average change of the ACWF ETF in the cf_etf_hist_price index, and the value is 0.0624:
"query": { "match": { "symbol": "ACWF"}},"aggs": {"acwf_avg_close_price":{"avg": ...