简体   繁体   中英

Elasticsearch pagination with Java and Spring Data Elasticsearch

I am trying to paginate the results of a query to sent them to a front-end. This front-end will be requesting additional pages of data in the next few minutes. I have been reading the official documentation about this here .

I understand that search_after + pit_id would satisfy my need.

The problem appears when I want to implement this with Java and spring-data-elasticsearch. I have been looking into the spring-data-elasticsearch doc but I was not able to find anything about search_after or pit_id .

So, my question is, is this use case supported by spring-data-elasticsearch or is it possible to do a kind of workaround to achieve it? Is there any example of it?

Thanks in advance.

search_after is not currently supported, there is an issue for that .

Neither is the pit point in time API. You might create an issue for that if you want.

Besides that, you can use Spring Data Repository functions for paging by passing in a Pageable parameter, you can uses paging when using the (Reactive)ElasticsearchTemplate classes as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM