# Elasticsearch：Moving average aggregation 介绍

(1 + 2 + 3 + 4 + 5) / 5 = 3
(2 + 3 + 4 + 5 + 6) / 5 = 4
(3 + 4 + 5 + 6 + 7) / 5 = 5

# 定制 Moving average aggregation

{
"window": 10,
"script": "MovingFunctions.linearWeightedAvg(values)"
}