# Property totalHits always 0

**URL:** <https://discuss.elastic.co/t/property-totalhits-always-0/281789>\
**Category:** Elasticsearch\
**Created:** [August 18, 2021, 8:18am UTC](https://discuss.elastic.co/t/property-totalhits-always-0/281789 "2021-08-18T08:18:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christophe\_NOWOSAD](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christophe_nowosad/32/81341_2.png) [@Christophe\_NOWOSAD](https://discuss.elastic.co/u/Christophe_NOWOSAD)\
**Post date:** [August 18, 2021, 8:18am UTC](https://discuss.elastic.co/t/property-totalhits-always-0/281789/1 "2021-08-18T08:18:25Z")

</div>

Hello,

I am using Elastic client in our Springboot API (client version 6.5.4).  
My application is using 2 different indexes, one is on version 6, the second on version 7.  
For the version 6, everything is working fine, for the version 7, the issue is that the totalHits number is always 0.  
I read the issue described here: [property totalHits is al](https://github.com/elastic/elasticsearch/issues/53267), and the solution provided is to upgrade the client version to 7. I tried and it is working fine.  
Unfortunatly it is not backward compatible, so the index on version 6 is not working anymore.

How is it possible to have both versions working in the same API?

Thanks a lot

---

<div class="post-metadata">

**Author:** ![Christophe\_NOWOSAD](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christophe_nowosad/32/81341_2.png) [@Christophe\_NOWOSAD](https://discuss.elastic.co/u/Christophe_NOWOSAD)\
**Post date:** [August 18, 2021, 9:09am UTC](https://discuss.elastic.co/t/property-totalhits-always-0/281789/2 "2021-08-18T09:09:09Z")

</div>

I reply, if you have the same issue, you only have to upgrade to version 6.8.3 (fix provided!).

> **[Elasticsearch version 6.8.3 | Elasticsearch Guide \[6.8\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/release-notes-6.8.3.html)**

Features/Java High Level REST Client

- Add rest\_total\_hits\_as\_int in HLRC’s search requests [#46076](https://github.com/elastic/elasticsearch/pull/46076) (issue: [#43925](https://github.com/elastic/elasticsearch/issues/43925))

---

<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:** [September 15, 2021, 9:09am UTC](https://discuss.elastic.co/t/property-totalhits-always-0/281789/3 "2021-09-15T09:09:51Z")

</div>

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