@requires_search
def get_counts(count_query, clean=True):
    count_query['aggregations'] = {
        'counts': {
            'terms': {
                'field': '_type',
            }
        }
    }

    res = es.search(index=INDEX, doc_type=None, search_type='count', body=count_query)
    counts = {x['key']: x['doc_count'] for x in res['aggregations']['counts']['buckets'] if ALIASES.keys() in x['key']}

    counts['total'] = sum([val for val in counts.values()])
    return counts
dataset/ETHPy150Open CenterForOpenScience/osf.io/website/search/elastic_search.py/get_counts/swapped operands of `in`