def convert_document_aggregations(result, output, args):
    aggs = result.get('aggregations', {})
    scoped = aggs.get('scoped', {})
    sources = scoped.get('source', {}).get('source', {})
    output['sources'] = convert_sources(sources)
    entities = aggs.get('entities', {}).get('inner', {})
    entities = entities.get('entities', {})
    output['entities'] = convert_entities(entities)
    return convert_facets(result, output, args)
Traverse and get all facets.
dataset/ETHPy150Open pudo/aleph/aleph/search/facets.py/convert_document_aggregations