# HibernateSearch 6: fetch limit \> 250 produces inconsistent result

**URL:** <https://discourse.hibernate.org/t/hibernatesearch-6-fetch-limit-250-produces-inconsistent-result/3980>\
**Category:** Hibernate Search\
**Created:** [April 6, 2020, 2:55pm UTC](https://discourse.hibernate.org/t/hibernatesearch-6-fetch-limit-250-produces-inconsistent-result/3980 "2020-04-06T14:55:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbarlabanov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/sbarlabanov/32/1266_2.png) [@sbarlabanov](https://discourse.hibernate.org/u/sbarlabanov)\
**Post date:** [April 6, 2020, 2:55pm UTC](https://discourse.hibernate.org/t/hibernatesearch-6-fetch-limit-250-produces-inconsistent-result/3980/1 "2020-04-06T14:55:01Z")

</div>

Hi,

In our environment with ES 7 with default settings if I submit a Hibernate Search query with fetch limit set to something bigger than 250 (e.g. 1000) I get quite strange result: total hits count is 250 (which is wrong - there are more actually), hits.size is 250 too instead of asked 1000. When using fetch limit \<= 250 everything is fine. This breaks the paging completely.

We use `SearchFetchable#fetch(java.lang.Integer, java.lang.Integer)` to fetch the results. Is it a Hibernate Search problem or some Elastic Search bug or setting?

We use HS 6 Beta 4.

Best regards,  
Sergiy

---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [April 6, 2020, 3:16pm UTC](https://discourse.hibernate.org/t/hibernatesearch-6-fetch-limit-250-produces-inconsistent-result/3980/2 "2020-04-06T15:16:44Z")

</div>

This definitely doesn’t look normal.

Can you try with Hibernate Search 6.0.0.Beta6, to rule out some bug that we may have solved in the meantime?

If you get the same behavior with Beta6, another possible explanation could be a timeout on the Elasticsearch side. Especially if you are requesting the whole source and your documents are large.

Can you post your logs after you enabled the TRACE level for logger `org.hibernate.search.elasticsearch.request`? You should see the exact requests sent by Hibernate Search to Elasticsearch and the exact response. Make sure to remove sensitive data if necessary 🙂

---

<div class="post-metadata">

**Author:** ![sbarlabanov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/sbarlabanov/32/1266_2.png) [@sbarlabanov](https://discourse.hibernate.org/u/sbarlabanov)\
**Post date:** [April 24, 2020, 2:43pm UTC](https://discourse.hibernate.org/t/hibernatesearch-6-fetch-limit-250-produces-inconsistent-result/3980/3 "2020-04-24T14:43:10Z")

</div>

Hi Yoann,

everything is fine. It was our fault. Sorry.

Best regard,  
Sergiy

---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [April 24, 2020, 2:54pm UTC](https://discourse.hibernate.org/t/hibernatesearch-6-fetch-limit-250-produces-inconsistent-result/3980/4 "2020-04-24T14:54:27Z")

</div>

No problem. Thanks for the update!
