spring-data-jest icon indicating copy to clipboard operation
spring-data-jest copied to clipboard

Search After - Scroll problem.

Open matheussl22 opened this issue 6 years ago • 2 comments

I have been problem with the uso of scroll. "Result window is too large, from + size must be less than or equal to: [10000] but was [10020]"

I need use "Search After" to fix, but I not found on Jest. https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-search-after.html

Any help to fix?

More reference about problem: https://stackoverflow.com/questions/42972508/how-to-get-more-than-10-thousand-documents-at-a-time-from-elasticsearch-using-je https://stackoverflow.com/questions/35206409/elasticsearch-2-1-result-window-is-too-large-index-max-result-window

matheussl22 avatar Jan 22 '19 15:01 matheussl22

Hi @matheussl22 , I think that searchAfter is usable with Jest. I will check how we can integrate it.

VanRoy avatar Feb 14 '19 20:02 VanRoy

SearchRequest searchRequest = new SearchRequest(INDEX_NAME); SearchSourceBuilder source = searchRequest.source(); source.query(QueryBuilders.termQuery("condition","1")); source.sort("condition",SortOrder.DESC); source.searchAfter(new Object[]{id}); source.from(0); source.size(size); SearchResponse search = restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT); org.elasticsearch.search.SearchHits hits = search.getHits(); List<Map<String, Object>> collect = Arrays.stream(hits.getHits()).map(temp -> temp.getSourceAsMap()).collect(Collectors.toList());

leslielililee avatar Nov 27 '23 07:11 leslielililee