Advanced aggs

Add script input for terms and ranges, add filters to significant terms.

Closes all but 1 potential input in #1527