def get_metric(self, bucket: "BucketData[_R]") -> int:
        """
        Return a metric, by default doc_count for a bucket.
        """
        if self._metric:
            return cast(int, bucket["metric"]["value"])
        return cast(int, bucket["doc_count"])

        Return a metric, by default doc_count for a bucket.
        
elasticsearch/dsl/faceted_search_base.py