{"id":17133020,"url":"https://github.com/agraphie/es-searchafter","last_synced_at":"2026-05-05T04:10:58.634Z","repository":{"id":149590819,"uuid":"494526634","full_name":"Agraphie/es-searchafter","owner":"Agraphie","description":"Iterator and thread-safe spliterator for Elasticsearch search_after queries","archived":false,"fork":false,"pushed_at":"2022-06-01T21:02:09.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-29T11:28:33.578Z","etag":null,"topics":["elasticsearch","iterator","search-after","spliterator"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Agraphie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-20T16:01:06.000Z","updated_at":"2022-05-21T07:13:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"38629283-f6b5-4f9a-983a-9792f9cb18d2","html_url":"https://github.com/Agraphie/es-searchafter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Agraphie%2Fes-searchafter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Agraphie%2Fes-searchafter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Agraphie%2Fes-searchafter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Agraphie%2Fes-searchafter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Agraphie","download_url":"https://codeload.github.com/Agraphie/es-searchafter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245217792,"owners_count":20579297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elasticsearch","iterator","search-after","spliterator"],"created_at":"2024-10-14T19:29:08.622Z","updated_at":"2026-05-05T04:10:53.594Z","avatar_url":"https://github.com/Agraphie.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Elasticsearch SearchAfter\nThis repo is an example of how to implement an iterator and a parallel-safe spliterator for the\nSearchAfter[^1] operation in Elasticsearch.\n\n## Why?\nAs scrolling and deep pagination is discouraged[^2], these iterators provider a more performant way.\n\n\n## Usage\nTo use them, copy and paste the needed classes into your project. You might have to adjust\nthe imports.\n\nYou need to specify a sort value as defined by the Elasticsearch documentation!\n\n## Examples\n### Iterator\n```JAVA\nSearchAfterIterable searchAfterIterable =\n  new SearchAfterIterable(\n      searchSourceBuilder,\n      searchRequest -\u003e {\n        try {\n          return client.search(searchRequest, RequestOptions.DEFAULT);\n        } catch (IOException e) {\n          throw new RuntimeException(e);\n        }\n      },\n      \"mydocuments\");\n\nfor (SearchHit documentFields : searchAfterIterable) {\nSystem.out.println(documentFields);\n}\n```\n\n### Spliterator\n```JAVA\nSearchSourceBuilder searchSourceBuilder =\n  new SearchSourceBuilder().size(5000).query(QueryBuilders.matchAllQuery()).sort(\"_id\");\nSearchAfterSpliterator searchAfterSpliterator =\n  new SearchAfterSpliterator(\n      searchSourceBuilder,\n      searchRequest -\u003e {\n        try {\n          return client.search(searchRequest, RequestOptions.DEFAULT);\n        } catch (IOException e) {\n          throw new RuntimeException(e);\n        }\n      },\n      \"mydocuments\");\n\nStreamSupport.stream(searchAfterSpliterator, true).forEach(System.out::println);\n```\n[^1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html#search-after\n[^2]: https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagraphie%2Fes-searchafter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagraphie%2Fes-searchafter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagraphie%2Fes-searchafter/lists"}