Skip to content

Commit

Permalink
Fix #545 combined datehistogram interval is deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
alainbodiguel committed Sep 6, 2021
1 parent e2c10c1 commit 637bb30
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -564,7 +564,11 @@ private DateHistogramAggregationBuilder buildDateHistogramAggregation(Aggregatio
default:
throw new InvalidParameterException(INVALID_DATE_UNIT);
}
dateHistogramAggregationBuilder = dateHistogramAggregationBuilder.dateHistogramInterval(intervalUnit);
if ((Integer)aggregationModel.interval.value > 1) {
dateHistogramAggregationBuilder = dateHistogramAggregationBuilder.fixedInterval(intervalUnit);
} else {
dateHistogramAggregationBuilder = dateHistogramAggregationBuilder.calendarInterval(intervalUnit);
}
//get the field, format, collect_field, collect_fct, order, on
dateHistogramAggregationBuilder = (DateHistogramAggregationBuilder) setAggregationParameters(aggregationModel, dateHistogramAggregationBuilder);
dateHistogramAggregationBuilder = (DateHistogramAggregationBuilder) setHitsToFetch(aggregationModel, dateHistogramAggregationBuilder);
Expand Down

0 comments on commit 637bb30

Please sign in to comment.