Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

findAllByX incorrectly limited to 10 results

In Spring Data Elasticsearch - I noticed something that looks like a bug with the generated findAllByFoo type methods. These seem to be limited to the default size (of 10) - which goes against the semantics you would expect from a findAll operation.

The main findAll() operation does work correctly however and does return all documents.

So - is this a bug or is there something I'm missing? Cheers, Eugen.

like image 973
Eugen Avatar asked Dec 09 '14 20:12

Eugen


1 Answers

It doesn't look like a bug.

According to elasticsearch's documentation (from/size) it looks like 10 is the default number of results that elasticsearch will return from a search query.

You can modify the page size with an appropriate Pageable parameter, e.g.:

Page<User> users = repository.findAll(new PageRequest(1, 20))
like image 143
Mark McLaren Avatar answered Nov 15 '22 08:11

Mark McLaren