

def build_es_query(self, case_type=None, afilter=None, status=None):

    def _domain_term():
        return {
            'term': {
                'domain.exact': self.domain,
            },
        }
    subterms = ([_domain_term(), afilter] if afilter else [_domain_term()])
    if case_type:
        subterms.append({
            'term': {
                'type.exact': case_type,
            },
        })
    if status:
        subterms.append({
            'term': {
                'closed': (status == 'closed'),
            },
        })
    es_query = {
        'query': {
            'filtered': {
                'query': {
                    'match_all': {
                        
                    },
                },
                'filter': {
                    'and': subterms,
                },
            },
        },
        'sort': self.get_sorting_block(),
        'from': self.pagination.start,
        'size': self.pagination.count,
    }
    return case_type

dataset/ETHPy150Open dimagi/commcare-hq/custom/apps/crs_reports/reports.py BaseHNBCReport.build_es_query/VarMisuse@203/271 `es_query`->`case_type`