If you meant that you are using the Java High Level Rest Client 6.4, the count
was added to it only in v6.6 release. https://github.com/elastic/elasticsearch/pull/34267
The one in 2.4 is based out of Transport client which has been deprecated from 7.0. Elastic recommends to use the HLRC which the I think you are already doing.
HLRC was feature complete with support for all APIs only in 7.0. Since version of client HLRC is tightly dependent on your cluster version you may be restricted, but if possible try to update to >=6.6 version of the library.
If you cannot update your driver version, the option I can think of is
- to call through LLRC (RestClient class) (without support for Object builders)
- or go back and use the Transport Client approach
https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.6/java-rest-high-compatibility.html#java-rest-high-compatibility
The High Level Client is guaranteed to be able to communicate with any
Elasticsearch node running on the same major version and greater or
equal minor version. It doesn’t need to be in the same minor version
as the Elasticsearch nodes it communicates with, as it is forward
compatible meaning that it supports communicating with later versions
of Elasticsearch than the one it was developed for.
The 6.0 client is able to communicate with any 6.x Elasticsearch node,
while the 6.1 client is for sure able to communicate with 6.1, 6.2 and
any later 6.x version, but there may be incompatibility issues when
communicating with a previous Elasticsearch node version, for instance
between 6.1 and 6.0, in case the 6.1 client supports new request body
fields for some APIs that are not known by the 6.0 node(s).