Collapse feature and total_hist after collapse

As Elastisearch documantion said: The total number of hits in the response indicates the number of matching documents without collapsing. The total number of distinct group is unknown.

I am using a search with pagination and i want the exact number of total hits. I also needs to remove some duplicated stuff(i am doing it with collapse option). The problem is that i can't get the total number of hits.
We have to mention that an aggregation with cardinality will provide wrong total hits value.
Is there a way to get the total number of distinct group from collapse ? Is there a way(something like post_collapse) to apply collapse option after must conditions and aggregations are calculated ? I want to get distinct doc based on a field and also the exact total value of it.
Thank you in advance

1 Like

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