diff --git a/boot-opensearch-sample/src/main/java/com/example/opensearch/repositories/CustomRestaurantRepositoryImpl.java b/boot-opensearch-sample/src/main/java/com/example/opensearch/repositories/CustomRestaurantRepositoryImpl.java index 9024adb1d..ae54bb1aa 100644 --- a/boot-opensearch-sample/src/main/java/com/example/opensearch/repositories/CustomRestaurantRepositoryImpl.java +++ b/boot-opensearch-sample/src/main/java/com/example/opensearch/repositories/CustomRestaurantRepositoryImpl.java @@ -207,10 +207,11 @@ public SearchPage aggregateSearch( private void addDateRange(DateRangeAggregationBuilder dateRangeBuilder) { ZonedDateTime zonedDateTime = ZonedDateTime.now().withDayOfMonth(1).toLocalDate().atStartOfDay(ZoneId.of("UTC")); - dateRangeBuilder.addUnboundedTo(zonedDateTime.minusMonths(12)); - for (int i = 12; i > 0; i--) { + dateRangeBuilder.addUnboundedTo(zonedDateTime.minusMonths(12L)); + for (long i = 12; i > 0; i--) { dateRangeBuilder.addRange( - zonedDateTime.minusMonths(i), zonedDateTime.minusMonths(i - 1).minusSeconds(1)); + zonedDateTime.minusMonths(i), + zonedDateTime.minusMonths(i - 1L).minusSeconds(1L)); } dateRangeBuilder.addUnboundedFrom(zonedDateTime); }