Elasticsearch 返回参数含义
{ "content": [ { ], "pageable": { "sort": { "sorted": false, "unsorted": true, "empty": true }, "pageNumber": 0, "pageSize": 2, "offset": 0, "paged": true, "unpaged": false }, "last": true, "totalPages": 1, "totalElements": 2, "numberOfElements": 2, "first": true, "number": 0, "size": 2, "sort": { "sorted": false, "unsorted": true, "empty": true }, "empty": false }
这是 Spring Data Elasticsearch 返回的一个分页查询结果对象,其中各参数的含义如下:
content:查询到的实体列表。pageable:分页信息,包括排序方式、页码、每页大小等。last:当前是否为最后一页。totalPages:总页数。totalElements:总记录数。numberOfElements:本页记录数。first:当前是否为第一页。number:当前页码。size:每页大小。sort:排序信息,包括是否已排序、使用的排序方式等。empty:当前页是否为空。
其中,pageable 参数表示分页信息,它包含了排序方式、页码、每页大小等信息。sort 参数表示排序信息,它包含了是否已排序、使用的排序方式等信息。empty 参数表示当前页是否为空。
例如,在上面的示例中,分页信息为第1页,每页大小为2条记录,未指定排序方式,因此 sort 参数中 sorted 和 unsorted 都为 false,empty 参数为 false 表示当前页不为空,其中 content 参数是查询到的实体列表,共有两个元素。

浙公网安备 33010602011771号