I have been reading about the term level queries at
The cardinaility of our aggregation buckets is very high and blows up in memory, so I have been using a query filter with a prefix filter to divide and conquer the aggregation. So for example, to divide the bucket set by 10, I use the prefixes 0 through 9 to filter the data set before aggregating. To divide the bucket set by 100, I use the prefixes 00 through 99 to filter the data set before aggregating.
However, I notice our data set is not uniformly distributed by prefix. For example, prefixes of 0, 1, and 2 are most common. Prefixes of 7 through 9 are non-existent in our data set.
Is there a query boolean filter for suffix? I think our data set is more uniformly distributed over ending digits than preceding digits. I have see the wildcard and regex filters, but I think the time to run the filter might increase drastically.