ElasticSearch doc_count not correct in nested aggregation

I am having an issue with nested + term aggregations. I am searching for a keyword type field, the doc_count in the aggregations is lesser than the expected count. In the example I have uploaded the
--Bin Set--
doc_count = 65.

The --Bins-- is nested in --Bin Set--. Ideally, the sum(doc_count) of all buckets should be equal to 65. i.e 17+17+15+7+3+1+1+1 should be equal to 65. But in my search query the count is less than 65(<65). In other words, the doc_count in the last level of aggregation is lesser than expected.

I have attached the index mapping, settings, query and result as images in the topic.

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