Field Filtering and Basic Math With Painless

Configuring a bucket script in TSVB and I want to filter on one field and then do some basic math on another. I've looked at the documentation in the Elasticsearch reference but it's not formatted the same as what Kibana is looking for, or at least I think it isn't. I know some of the painless language but not all so if someone can show me what the proper syntax is for where I am wrong below, I'd appreciate it.

Bucket aggregations can only be used to perform per bucket computations on specified metrics. Bucket aggregations can not be used to filter documents and do not have access to document properties.

Try using a filter aggregation before the bucket script aggregation to perform the filtering. You will also need a metric aggregation to calculate some metric on EdgeBytes such as sum, min, max, avg. You can then use the sum, min, max, or avg value in a bucket script aggregation.

I'm looking through the aggregation methods in TSVB Metric but I don't see one specifically called filter and I don't believe filter ratio will give me what I'm looking for. What am I missing?

Aggregations can be nested. The filter aggregation filters the data. then the bucket script aggregation can be used to process the results from the filter aggregation

The problem I am having is all the documentation is geared towards making queries directly against Elasticsearch. I know that's what Kibana is doing but I don't see an interface exposed to me that allows it to be done. I am also not seeing how to accomplish this in the GUI, the filter aggregate itself is not present. In TSVB>Metric, if I select the Options tab, I see the ability to filter but that will filter all aggregations for that series. It also doesn't look like I can reference an aggregation from one series in another.