(domain, location_ids)
return ret
Returns {user_id: [location_id, location_id, ...], ...}
Returns {user_id: [location_id, location_id, ...], ...}
Returns { user_id : [ location_id location_id ... ] ... }
def get_user_ids_from_assigned_location_ids(domain, location_ids):
    """
    Returns {user_id: [location_id, location_id, ...], ...}
    """
    result = (
        UserES()
        .domain(domain)
        .location(location_ids)
        .non_null('assigned_location_ids')
        .fields(['assigned_location_ids', '_id'])
        .run().hits
    )
    ret = {}
    for r in result:
        if 'assigned_location_ids' in r:
            locs = r['assigned_location_ids']
            if not isinstance(locs, list):
                locs = [r['assigned_location_ids']]
            ret[r['_id']] = locs
    return ret
def get_user_ids_from_assigned_location_ids ( domain , location_ids ) : result = ( UserES ( ) . domain ( domain ) . location ( location_ids ) . non_null ( 'assigned_location_ids' ) . fields ( [ 'assigned_location_ids' , '_id' ] ) . run ( ) . hits ) ret = { } for r in result : if 'assigned_location_ids' in r : locs = r [ 'assigned_location_ids' ] if not isinstance ( locs , list ) : locs = [ r [ 'assigned_location_ids' ] ] ret [ r [ '_id' ] ] = locs return ret