Total hits with requestTransformer and collapse


I’am using the field collapse feature of elastic search through the requestTransformer but when but I call the total().hitCount() it returns the total without the collapse.

How can I get the correct value?

From Elasticsearch’s documentation:

The total number of hits in the response indicates the number of matching documents without collapsing. The total number of distinct group is unknown.

So I don’t think you can get the correct value.