Your script operates on each individual document, not on all the values accross all docs matching your aggregation. To have a script run on all the values collected, you need to use a scripted metric aggregation. However, that is not yet available in kibana: https://github.com/elastic/kibana/issues/2646
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.