// query Long[] offsets = {offset}; ElasticSearchHandler.addAfterSearch(searchSourceBuilder, offsets); // result SearchHits searchHits = search.getHits(); SearchHit[] hits = searchHits.getHits(); for (SearchHit sh : hits) { sh.getSortValues() } // Use last searchHit's sortValues for next offset