# How to return more than 10k hits in spring boot without changing the index.max\_result\_window from elasticsearch 8.6

**URL:** https://discuss.elastic.co/t/how-to-return-more-than-10k-hits-in-spring-boot-without-changing-the-index-max-result-window-from-elasticsearch-8-6/327888
**Category:** Elasticsearch
**Created:** [March 16, 2023, 10:00pm UTC](https://discuss.elastic.co/t/how-to-return-more-than-10k-hits-in-spring-boot-without-changing-the-index-max-result-window-from-elasticsearch-8-6/327888 "2023-03-16T22:00:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![BEY\_MEHREZ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bey_mehrez/32/118105_2.png) [@BEY\_MEHREZ](https://discuss.elastic.co/u/BEY_MEHREZ)
#### Post date: [March 16, 2023, 10:00pm UTC](https://discuss.elastic.co/t/how-to-return-more-than-10k-hits-in-spring-boot-without-changing-the-index-max-result-window-from-elasticsearch-8-6/327888/1 "2023-03-16T22:00:33Z")

</div>

Hello ! I want to return **all the documents matching my query** but the limit is set to 10k ? What can I do to return all the documents ( they are so much higher than 10k documents) **without changing the index.max\_result\_window**. As I read in the documentation, I should use the **search\_after** parameter but **I didn't know how to implement it**.  
I am using **elasticsearch 8.6** and a **Low Level REST Client**

```auto
SearchResponse<Example> response =client.search(s -> s
					.index("index-name")
					.query(q->q
							.match(t -> t
									.field("field")
									.query("something"))).size(10000),
					Example.class);
List<Hit<Example>> hits = response.hits().hits();

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [April 13, 2023, 10:01pm UTC](https://discuss.elastic.co/t/how-to-return-more-than-10k-hits-in-spring-boot-without-changing-the-index-max-result-window-from-elasticsearch-8-6/327888/2 "2023-04-13T22:01:20Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
