Add search support for Roles entity to enable scalable role selection
Summary
The role selection dropdown across the UI, including user creation, bot configuration, and SSO role mapping, still relies on GET /v1/roles with cursor-based pagination. Because of that, roles beyond the first page can be omitted from the dropdown and cannot be reliably selected in the UI.
Backend support for searchable roles is already available, but the frontend role picker flows have not yet been updated to use it. As a result, the UI still depends on paginated list fetching, inflated limits, or page iteration, which does not scale well for larger role sets.
Current Behavior
- Role selection dropdowns fetch roles using the paginated list API (
GET /v1/roles). - Roles beyond the pagination boundary are not shown in the dropdown unless additional pages are fetched.
- Users cannot reliably search or filter roles from the dropdown in larger deployments.
- The frontend works around this by using large limits such as
limit: 1000or looping through pages, which is inefficient and still not ideal for UX.
UI Problem
This issue is visible anywhere the UI uses a role picker.
- Dropdowns do not provide a scalable typeahead experience backed by the available role search support.
- Users must scroll through a partial or incomplete list of roles.
- If the required role is outside the fetched page range, it appears unavailable in the UI.
- The experience becomes increasingly unreliable as the number of roles grows.
In practice, the backend can support the use case, but the frontend is not yet wired to use that capability.
Expected Behavior
Users should be able to find and select any role regardless of how many roles exist.
The UI should:
- use the existing backend role search support
- provide a searchable/typeahead role dropdown
- fetch matching roles dynamically instead of depending on paginated full-list loading
- allow users to reliably select roles even when they are not part of the initially loaded page
Proposed UI Changes
Update role picker components across the UI to use the existing searchable backend support instead of relying on paginated role listing.
Expected UI behavior:
- the role dropdown should allow users to type and search by role name
- matching roles should be fetched dynamically from the backend search-capable endpoint
- the dropdown should show loading, empty, and no-match states appropriately
- role selection should work consistently across all role assignment surfaces
This applies to flows such as:
- user creation and edit
- bot configuration
- SSO role mapping
- any other UI surface that depends on selecting roles
Impact
- Users with 100+ roles cannot reliably assign roles during user creation or configuration.
- Role assignment flows are misleading because missing roles appear unavailable in the dropdown.
- Playwright coverage is impacted as well:
UserCreationWithPersona.spec.tsfails when the target role falls beyond the pagination boundary.
Notes
This is no longer a backend capability gap. The remaining work is to adopt the existing backend role search support in the frontend role selector components and replace the current paginated list-based behavior.
That's sounds interesting, can I work on this
@ShivamChavan01 assigned to you
hi @chirag-madlani may i please work on this issue?
Hi, I’d like to work on this issue. Could you please assign it to me?
Hi @chirag-madlani! I'd love to work on this issue. I've analyzed the codebase and have a clear implementation plan: Root Cause: Roles lack a dedicated search index (RoleIndex class) unlike User and Team which have user_search_index and team_search_index respectively.
My Plan:
1.Create a RoleIndex class in the search indexing layer 2.Add SearchIndex.ROLE mapping on the frontend 3.Wire up the existing /v1/search/query endpoint to support roles 4.Replace paginated list calls in role selection dropdowns with search/typeahead backed calls 5.Fix the failing UserCreationWithPersona.spec.ts Playwright test
I've already forked the repo and am ready to start immediately. This will be a complete end-to-end fix covering backend index mapping, frontend SearchIndex enum, and the dropdown components. Can you assign this to me? 🙏
Hi all.I'm already assigned to this issue. Working on it and will have a PR up soon. 🙏
Hi @chirag-madlani — I’ve completed the full implementation for this issue and also resolved the GitTar bot issues on the PR.
All validation tests are passing successfully, and the PR is now ready for review.
Could you please apply the safe to test label on my PR so the checks can proceed?
PR: https://github.com/open-metadata/OpenMetadata/pull/27556
Thank you! 🙏
@ShivamChavan01 FYI,The backend implementation is already done, you just need to work on the frontend integration for role search api. Backend PR is already merged - https://github.com/open-metadata/OpenMetadata/pull/27335
@ShivamChavan01 FYI,The backend implementation is already done, you just need to work on the frontend integration for role search api. Backend PR is already merged - https://github.com/open-metadata/OpenMetadata/pull/27335
Okay I'll do it ill raise a pr in like few hr
Hey @Rohit0301, The implementation is complete and ready for review! Changes made:
- Added searchRoles() function in rolesAPIV1.ts using Elasticsearch
- Replaced getAllRoles/getRoles with searchRoles in 5 components:
- CreateUserPage.component.tsx
- BotDetails.component.tsx
- LdapRoleMappingWidget.tsx
- SsoRolesSelectField.tsx
- UserProfileRoles.component.tsx
- Added onSearch handlers for server-side typeahead filtering
- Fixed error handling with try/catch
- Added ES character sanitization
- Fixed shared state issue with per-mapping searchResults Map All 3 review comments addressed. PR #27602 ready for re-review