Spring data offers a convenient way to restrict results to the Top or First keyword.
We can read the Spring Data ES documentation:
Query results can be limited using the first or top keywords, which can be used interchangeably.
This means calling this method, for example:
User findFirstByOrderByLastnameAsc ();
However, the list of supported keywords for Elasticsearch does not contain the Top or First keyword.
I conducted several tests using the latest Spring version of elasticsearch data and effectively, the Top and First keyword does not work.
Remember this.
Spring Documentation Documentation Version 1.3.0.RELEASE, 2015-09-01
source share