(domain, search_string, limit, offset)
return user_es.start(offset).size(limit).sort('username.exact')
returns a UserES object
    :param domain:
    :param search_string: A query string that searches in the specified search fields
    :param limit: Number of records to return
    :param offset: Offset to start query
returns a UserES object
    :param domain:
    :param search_string: A query string that searches in the specified search fields
    :param limit: Number of records to return
    :param offset: Offset to start query
returns a UserES object : param domain : : param search_string : A query string that searches in the specified search fields : param limit : Number of records to return : param offset : Offset to start query
def get_search_users_in_domain_es_query(domain, search_string, limit, offset):
    """
    returns a UserES object
    :param domain:
    :param search_string: A query string that searches in the specified search fields
    :param limit: Number of records to return
    :param offset: Offset to start query
    """
    default_search_fields = ["base_username", "last_name", "first_name"]

    user_es = UserES().domain(domain)

    if RESTRICT_LOGIN_AS.enabled(domain):
        user_es = user_es.OR(users.metadata('login_as_user', search_string),
                             queries.search_string_query(search_string, default_search_fields))
    else:
        user_es = user_es.search_string_query(search_string, default_search_fields)

    return user_es.start(offset).size(limit).sort('username.exact')
def get_search_users_in_domain_es_query ( domain , search_string , limit , offset ) : default_search_fields = [ "base_username" , "last_name" , "first_name" ] user_es = UserES ( ) . domain ( domain ) if RESTRICT_LOGIN_AS . enabled ( domain ) : user_es = user_es . OR ( users . metadata ( 'login_as_user' , search_string ) , queries . search_string_query ( search_string , default_search_fields ) ) else : user_es = user_es . search_string_query ( search_string , default_search_fields ) return user_es . start ( offset ) . size ( limit ) . sort ( 'username.exact' )