def METHOD_NAME(domain, sample_size, use_case_search):
    total_bytes = 0
    total_cases = 0
    index_class = CaseSearchES if use_case_search else CaseES
    for case_type in get_case_types_for_domain_es(domain, use_case_search):
        query = (index_class()
                 .domain(domain)
                 .case_type(case_type)
                 .size(sample_size))
        num_cases, avg_size = _get_totals_for_query(query)
        total_bytes += num_cases * avg_size
        total_cases += num_cases
    return total_cases, total_bytes