5

Spring data offers a convenient way to limit results with the keyword Top or First.

We can read in the Spring Data ES documentation :

The results of query methods can be limited via the keywords first or top, which can be used interchangeably.

Which means calling this method for instance :

User findFirstByOrderByLastnameAsc();

Nonetheless, the list of supported keywords for Elasticsearch does not contain the keyword Top or First.

I ran several tests using the latest version of spring data elasticsearch and effectively, the Top and First keyword does not work.

Be aware of that.

The Spring Data ES documentation Version 1.3.0.RELEASE, 2015-09-01

Florian Courtial
  • 930
  • 1
  • 11
  • 20

0 Answers0