# Elastic search fails to index the records once it reaches 10000

**URL:** <https://discuss.elastic.co/t/elastic-search-fails-to-index-the-records-once-it-reaches-10000/199603>\
**Category:** Elasticsearch\
**Created:** [September 16, 2019, 8:13am UTC](https://discuss.elastic.co/t/elastic-search-fails-to-index-the-records-once-it-reaches-10000/199603 "2019-09-16T08:13:02Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nimisha\_Salian](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nimisha_salian/32/54254_2.png) [@Nimisha\_Salian](https://discuss.elastic.co/u/Nimisha_Salian)\
**Post date:** [September 16, 2019, 8:13am UTC](https://discuss.elastic.co/t/elastic-search-fails-to-index-the-records-once-it-reaches-10000/199603/1 "2019-09-16T08:13:02Z")

</div>

Hello,

I'm new to elastic search so pardon me if you think this question is silly. So i'm facing issues while adding the records to my index. As soon as 10000 records are added to the index, my index doesn't take the records beyond that. Like for example if i'm trying to insert 20000 records at once, only 10000 records gets indexed. No documents are indexed after 10000 records.  
I tried increasing the heap size still no improvement. This issue persist not only for single index but also for the multiple index having records above 10000.  
Please help.  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![derk](https://avatars.discourse-cdn.com/v4/letter/d/ac91a4/32.png) [@derk](https://discuss.elastic.co/u/derk)\
**Post date:** [September 16, 2019, 10:18am UTC](https://discuss.elastic.co/t/elastic-search-fails-to-index-the-records-once-it-reaches-10000/199603/3 "2019-09-16T10:18:06Z")

</div>

Hi,  
How are you querying your index to determine how many items it holds?  
Could it be that you are running into the top hits feature of ES7?  
[https://www.elastic.co/guide/en/elasticsearch/reference/7.3/search-request-body.html#request-body-search-track-total-hits](https://www.elastic.co/guide/en/elasticsearch/reference/7.3/search-request-body.html#request-body-search-track-total-hits)  
Derk

---

<div class="post-metadata">

**Author:** ![Nimisha\_Salian](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nimisha_salian/32/54254_2.png) [@Nimisha\_Salian](https://discuss.elastic.co/u/Nimisha_Salian)\
**Post date:** [September 16, 2019, 11:13am UTC](https://discuss.elastic.co/t/elastic-search-fails-to-index-the-records-once-it-reaches-10000/199603/4 "2019-09-16T11:13:26Z")

</div>

Hi Derk,

Thanks for the reply.  
yes you are right i was passing the wrong query to see the number of items in the index.  
I used \_count to check the total number of items in the index and its showing right.  
Thank you so much.. Also i wanted to fetch all the items inside my index but currently only 10000 records is returned. Any workaround to fetch all the records from index?

Thanks

---

<div class="post-metadata">

**Author:** ![derk](https://avatars.discourse-cdn.com/v4/letter/d/ac91a4/32.png) [@derk](https://discuss.elastic.co/u/derk)\
**Post date:** [September 16, 2019, 12:17pm UTC](https://discuss.elastic.co/t/elastic-search-fails-to-index-the-records-once-it-reaches-10000/199603/5 "2019-09-16T12:17:02Z")

</div>

Hi Nimisha,

If you want to loop through a complete resultset, you should use the scroll api.  
[https://www.elastic.co/guide/en/elasticsearch/reference/7.3/search-request-body.html#request-body-search-scroll](https://www.elastic.co/guide/en/elasticsearch/reference/7.3/search-request-body.html#request-body-search-scroll)

Derk

---

<div class="post-metadata">

**Author:** ![Nimisha\_Salian](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nimisha_salian/32/54254_2.png) [@Nimisha\_Salian](https://discuss.elastic.co/u/Nimisha_Salian)\
**Post date:** [September 16, 2019, 5:15pm UTC](https://discuss.elastic.co/t/elastic-search-fails-to-index-the-records-once-it-reaches-10000/199603/6 "2019-09-16T17:15:41Z")

</div>

I have used scroll to fetch the records..But my motive is to retrieve 6-7Lakhs of data on one go. In my current scenario i'm fetching 5k data at a time using scroll with while loop. I actually want to overcome the loop so as to avoid overhead.

---

<div class="post-metadata">

**Author:** ![derk](https://avatars.discourse-cdn.com/v4/letter/d/ac91a4/32.png) [@derk](https://discuss.elastic.co/u/derk)\
**Post date:** [September 17, 2019, 9:16am UTC](https://discuss.elastic.co/t/elastic-search-fails-to-index-the-records-once-it-reaches-10000/199603/7 "2019-09-17T09:16:08Z")

</div>

Hi Nimisha,  
Ok, I get your point, although I still believe that the scroll api is the way to go.  
If you really wanted to, you could override the `index.max_result_window` setting, although I don't believe that is recommended, since it would eat into the heap memory and might cause OOM exceptions at some point.  
Derk

---

<div class="post-metadata">

**Author:** ![Nimisha\_Salian](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nimisha_salian/32/54254_2.png) [@Nimisha\_Salian](https://discuss.elastic.co/u/Nimisha_Salian)\
**Post date:** [September 17, 2019, 10:41am UTC](https://discuss.elastic.co/t/elastic-search-fails-to-index-the-records-once-it-reaches-10000/199603/8 "2019-09-17T10:41:11Z")

</div>

Thanks derk it helped..Thank you so much 🙂

---

<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:** [October 15, 2019, 10:41am UTC](https://discuss.elastic.co/t/elastic-search-fails-to-index-the-records-once-it-reaches-10000/199603/9 "2019-10-15T10:41:12Z")

</div>

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