Currently one can use dynamic scripting using .script() clauses in aggregations, but using a script file or indexed script, as described in [Elasticsearch Reference [1.5] » Modules » Scripting](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html) doesn't seem to be supported.