spring-data-jest
spring-data-jest copied to clipboard
Search After - Scroll problem.
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
Hi @matheussl22 , I think that searchAfter is usable with Jest. I will check how we can integrate it.
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());