Reputation: 21
how to set from/size of search result executed using spring Elasticsearchtemplate
.
while same functionality can be performed using out of the box elasticsearch API
NodeBuilder.nodeBuilder().node().client().prepareSearch("wsearchobject") .setQuery(QueryBuilders.matchAllQuery()) .setFrom(10) .setSize(20) .execute().actionGet();
how to set from and size parameters using elasticsearchtemplate
.
Upvotes: 2
Views: 3038
Reputation: 1
Unfortunately, this feature is not available in spring data framework yet.
Link: https://jira.spring.io/browse/DATAES-187&usg=ALkJrhhjX4MjwaEWTnG5v-qucDQBlqVWXg
Upvotes: 0
Reputation: 6218
you can use PageRequest
.
Details can be found at Spring Data Elasticsearch
you can refer Example 2. PagingAndSortingRepository from doc
Upvotes: 1