Collapse not working for nested fields

We are using elasticsearch version 5.4 . We have used collapse to aggregate result on the basis of nested field. But the result we are getting is just one record as a result even when it shows total no. of hits as 4 . Out of these 4 records, 3 should be displayed but it is displaying just 1 record..
Collapse is working totally fine with non nested fields. We also tried to include inner_hits. But as soon as we define inner hits in collapse, it is showing all the nested documents without aggregating it.

Please help.

Thanks in advance.

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