0

I have such problem now, I have a requirement to migrate from spring data elasticsearch to restHighLevelClient, and also have to implement pagination, which was pretty easy in Spring data.

SearchResponse response = esClient.search(new SearchRequest("person")
    .source(new SearchSourceBuilder()
            .query(query)
            .from(from)
            .size(size)
    ));

with this we can specify the whole size of items only, which has nothing to do with pageSize (i.e the item size on each page). Now please any way of specifying the pageSize on "restHighLevelClient"

Hayk Mkhitaryan
  • 388
  • 9
  • 26
  • rest high level client is also deprecated in favout of java client – Amit Dec 12 '22 at 07:03
  • so @Amit can you suggest any way of implementing what I need? – Hayk Mkhitaryan Dec 12 '22 at 07:54
  • Please refer to this. https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html . this will give you an idea how to implement pagination in elatsicsearch. For example, If you mention From = 11 and size = 30, it would return all the records between 11 and 30. – karthick S Dec 12 '22 at 12:21
  • For migrating from the high level rest client, Please refer to this, https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/migrate-hlrc.html#migrate-hlrc – karthick S Dec 12 '22 at 12:27

0 Answers0