Skip to content

Add indices:admin/mappings/get to ml_full_access role for Agentic Search#6076

Draft
owaiskazi19 wants to merge 3 commits intoopensearch-project:mainfrom
owaiskazi19:fix/ml-full-access-mappings-get
Draft

Add indices:admin/mappings/get to ml_full_access role for Agentic Search#6076
owaiskazi19 wants to merge 3 commits intoopensearch-project:mainfrom
owaiskazi19:fix/ml-full-access-mappings-get

Conversation

@owaiskazi19
Copy link
Copy Markdown
Member

Description

Adds indices:admin/mappings/get to the ml_full_access role to support Agentic Search (QueryPlanningTool). QPT needs to retrieve index mappings to generate accurate OpenSearch DSL queries from natural language input.

Dependency

This PR depends on opensearch-project/ml-commons#4785, which changes QueryPlanningTool to use GetMappingsRequest instead of GetIndexRequest. Without that ml-commons change, QPT would require the broader indices:admin/get permission. With it, only indices:admin/mappings/get is needed.

Security implications

This permission does not expose system index mappings. System indices are protected by multiple layers:

  1. System index permission layer — When plugins.security.system_indices.permissions.enabled is true (default), accessing system indices requires the system:admin/system_index permission, which ml_full_access does not have.
  2. Security config index protection — The .opendistro_security index has additional hardcoded protection that filters it from wildcard requests when plugins.security.filter_securityindex_from_all_requests is enabled.
  3. Scoped access — QPT calls getMappings with a specific user-provided index name, not *.

This is a read-only metadata permission — it only exposes field names and types, not document data.

Consistent with existing rolesindices:admin/mappings/get is already used by knn_full_access, query_assistant_access, and reports_read_access with the same index_patterns: ['*'] scope.

Related Issue

opensearch-project/ml-commons#4775

Check List

  • New functionality includes testing
    • N/A (config-only change to a predefined role)
  • New functionality has been documented
    • N/A
  • Commits are signed off as per the DCO using --signoff

@cwperks
Copy link
Copy Markdown
Member

cwperks commented Apr 7, 2026

TY @owaiskazi19 . The changes LGTM but the build on main is broken atm due to Jackson 3.x upgrade in core. I will have a PR raised mometarily for that.

@cwperks
Copy link
Copy Markdown
Member

cwperks commented Apr 7, 2026

@owaiskazi19 it may be good to take this opportunity to extract the ml roles from this repo and provide them as classpath resources from within the ml repo instead. See #6038

- index_patterns:
- '*'
allowed_actions:
- 'indices:admin/mappings/get'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also need indices:data/read/search* because agentic search also samples documents from the index, should we add that too?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. QPT's async chain has two steps: (1) getMappings for index structure, and (2) a search to sample a document. indices:data/read/search* would be needed for it

Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>
Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>
QueryPlanningTool samples documents from the target index using a
matchAllQuery search. This requires indices:data/read/search* permission
which is consistent with other full_access roles (anomaly_full_access,
ppl_full_access, asynchronous_search_full_access, forecast_full_access).

Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>
@owaiskazi19 owaiskazi19 force-pushed the fix/ml-full-access-mappings-get branch from 4eae239 to 75b48d7 Compare April 10, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants