Problem: I want to have a bucket with range aggregation on win probability. But instead of having Bucket of "WON" based on win probability, have it on Constants.REVENUE_STATUS is "WON" or "WON_PENDING".
Condition:
- PIPELINE = REVN_WIN_PROBABILITY (9, 31)
- UPSIDE = REVN_WIN_PROBABILITY (39, 51)
- FORECAST = REVN_WIN_PROBABILITY (59,101)
- WON = REVENUE_STATUS = "WON" or "WON_PENDING"
Existing Code:
AbstractAggregationBuilder getRevenueWinProbAggregationBuilder() {
    AbstractAggregationBuilder rangeAggBuilder = AggregationBuilders
            .range(FORECAST_STATUS_TYPE_AGGREGATION_NAME)
            .field(Constants.REVN_WIN_PROBABILITY)
            .addRange(ForecastType.PIPELINE.toString(), 9, 31)
            .addRange(ForecastType.UPSIDE.toString(), 39, 51)
            .addRange(ForecastType.FORECAST.toString(), 59, 101)
            .addRange(ForecastType.WON.toString(), 99, 101);
    return rangeAggBuilder;
}