Friday, July 17, 2015

Spring Data REST max page size 1000

When I tried to fetch 2000 entries in Spring Data REST,

I got only 1000 entries.

I didn't know the reason until I saw the following source:

https://github.com/spring-projects/spring-data-rest/blob/master/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/config/RepositoryRestConfiguration.java

It is used in `HateoasPageableHandlerMethodArgumentResolver.enhance()` as follows:

builder.replaceQueryParam(sizePropertyName, pageable.getPageSize() <= getMaxPageSize() ? pageable.getPageSize()
: getMaxPageSize());

If you use Spring Boot and want to change the default value,

you can add the following property to `application.properties`:

spring.data.rest.max-page-size=10000

I didn't find any related documentation except the source.

In my case, it would be nice to have a warning when exceeding the max page size,

but in some cases, it could be irritating, I guess.

1 comment: