Skip to content

Fix search failure on user index due to nested owners query#26794

Open
sonika-shah wants to merge 2 commits intomainfrom
nested-owners-query-ignore-unmapped
Open

Fix search failure on user index due to nested owners query#26794
sonika-shah wants to merge 2 commits intomainfrom
nested-owners-query-ignore-unmapped

Conversation

@sonika-shah
Copy link
Collaborator

@sonika-shah sonika-shah commented Mar 26, 2026

Describe your changes:

Fixes #3280

The RBAC layer unconditionally adds nested owners queries to all search
requests. Indexes like user that don't have owners as a nested field
fail with "failed to find nested object under path [owners]".

Add ignore_unmapped=true to all nested queries so they gracefully return
no matches on indexes without the nested field instead of throwing 500.

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.

@sonika-shah sonika-shah requested a review from a team as a code owner March 26, 2026 10:24
@sonika-shah sonika-shah added safe to test Add this label to run secure Github workflows on PRs To release Will cherry-pick this PR into the release branch labels Mar 26, 2026
Copilot AI review requested due to automatic review settings March 26, 2026 10:24
@sonika-shah sonika-shah removed the To release Will cherry-pick this PR into the release branch label Mar 26, 2026
@gitar-bot
Copy link

gitar-bot bot commented Mar 26, 2026

Code Review ✅ Approved

Fixes search failure on the user index caused by nested owners query issues. No issues found.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes search failures when RBAC injects owners nested queries against indexes where owners is not mapped as a nested field by adding ignore_unmapped=true to nested queries (Elasticsearch + OpenSearch), with accompanying test coverage.

Changes:

  • Add ignore_unmapped to nested query builders for Elasticsearch and OpenSearch.
  • Add ignore_unmapped to JSON-based nested query filters (e.g., owners filters) and assert it in unit tests.
  • Re-enable a previously skipped Playwright E2E test related to notification alerts.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
openmetadata-ui/src/main/resources/ui/playwright/e2e/Flow/NotificationAlerts.spec.ts Unskips an alerts permissions E2E flow.
openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/queries/OpenSearchQueryBuilder.java Sets ignoreUnmapped(true) on nested queries built via the OpenSearch query builder.
openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchQueryBuilder.java Sets ignoreUnmapped(true) on the static OpenSearch nested query helper.
openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/queries/ElasticQueryBuilder.java Sets ignoreUnmapped(true) on nested queries built via the Elasticsearch query builder.
openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticQueryBuilder.java Sets ignoreUnmapped(true) on the static Elasticsearch nested query helper.
openmetadata-service/src/main/java/org/openmetadata/service/search/SearchListFilter.java Adds ignore_unmapped:true to the owners nested filter JSON.
openmetadata-service/src/main/java/org/openmetadata/service/search/QueryFilterBuilder.java Adds ignore_unmapped:true to nested query JSON generated by filter builder helpers.
openmetadata-service/src/test/java/org/openmetadata/service/search/security/OpenSearchRBACConditionEvaluatorTest.java Adds tests asserting nested query JSON includes ignore_unmapped:true (OpenSearch).
openmetadata-service/src/test/java/org/openmetadata/service/search/security/ElasticSearchRBACConditionEvaluatorTest.java Adds tests asserting nested query JSON includes ignore_unmapped:true (Elasticsearch).
openmetadata-service/src/test/java/org/openmetadata/service/search/QueryFilterBuilderTest.java Asserts ignore_unmapped is present in nested filters and adds additional nested-query structure checks.
openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/SearchListFilterTest.java Asserts ignore_unmapped is present in owners nested filters and updates expected serialized content.

@github-actions
Copy link
Contributor

OpenMetadata Service New-Code Coverage

PASS. Required changed-line coverage: 90.00% overall and per touched production file.

  • Overall executable changed lines: 7/7 covered (100.00%)
  • Missed executable changed lines: 0
  • Non-executable changed lines ignored by JaCoCo: 1
  • Changed production files: 6
File Covered Missed Executable Non-exec Coverage Uncovered lines
openmetadata-service/src/main/java/org/openmetadata/service/search/QueryFilterBuilder.java 3 0 3 0 100.00% -
openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticQueryBuilder.java 1 0 1 0 100.00% -
openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/queries/ElasticQueryBuilder.java 1 0 1 0 100.00% -
openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchQueryBuilder.java 1 0 1 0 100.00% -
openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/queries/OpenSearchQueryBuilder.java 1 0 1 0 100.00% -
openmetadata-service/src/main/java/org/openmetadata/service/search/SearchListFilter.java 0 0 0 1 N/A -

Only changed executable lines under openmetadata-service/src/main/java are counted. Test files, comments, imports, and non-executable lines are excluded.

@github-actions
Copy link
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 64%
64.85% (58126/89627) 44.67% (30722/68764) 47.69% (9199/19289)

@sonarqubecloud
Copy link

@sonarqubecloud
Copy link

@github-actions
Copy link
Contributor

🟡 Playwright Results — all passed (21 flaky)

✅ 3394 passed · ❌ 0 failed · 🟡 21 flaky · ⏭️ 216 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 451 0 4 2
🟡 Shard 2 602 0 1 32
🟡 Shard 3 602 0 7 27
🟡 Shard 4 600 0 3 47
🟡 Shard 5 586 0 1 67
🟡 Shard 6 553 0 5 41
🟡 21 flaky test(s) (passed on retry)
  • Features/DataAssetRulesDisabled.spec.ts › Verify the Dashboard entity item action after rules disabled (shard 1, 1 retry)
  • Features/DataAssetRulesDisabled.spec.ts › Verify the DashboardDataModel entity item action after rules disabled (shard 1, 1 retry)
  • Features/CustomizeDetailPage.spec.ts › Glossary Term - customization should work (shard 1, 1 retry)
  • Pages/UserCreationWithPersona.spec.ts › Create user with persona and verify on profile (shard 1, 1 retry)
  • Features/BulkEditEntity.spec.ts › Glossary (shard 2, 1 retry)
  • Features/NestedColumnsExpandCollapse.spec.ts › should not duplicate rows when expanding and collapsing nested columns with same names in Explore Summary Panel (shard 3, 1 retry)
  • Features/Permissions/GlossaryPermissions.spec.ts › Team-based permissions work correctly (shard 3, 1 retry)
  • Features/RTL.spec.ts › Verify Following widget functionality (shard 3, 1 retry)
  • Features/TestSuiteMultiPipeline.spec.ts › TestSuite multi pipeline support (shard 3, 1 retry)
  • Features/UserProfileOnlineStatus.spec.ts › Should not show online status for inactive users (shard 3, 1 retry)
  • Flow/ExploreDiscovery.spec.ts › Should not display soft deleted assets in search suggestions (shard 3, 1 retry)
  • Flow/PersonaFlow.spec.ts › Set default persona for team should work properly (shard 3, 1 retry)
  • Pages/Customproperties-part2.spec.ts › entityReferenceList shows item count, scrollable list, no expand toggle (shard 4, 1 retry)
  • Pages/Domains.spec.ts › Multiple consecutive domain renames preserve all associations (shard 4, 1 retry)
  • Pages/Entity.spec.ts › Glossary Term Add, Update and Remove for child entities (shard 4, 1 retry)
  • Pages/EntityDataSteward.spec.ts › Tier Add, Update and Remove (shard 5, 1 retry)
  • Pages/Glossary.spec.ts › Drag and Drop Glossary Term (shard 6, 1 retry)
  • Pages/Glossary.spec.ts › Delete Glossary and Glossary Term using Delete Modal (shard 6, 1 retry)
  • Pages/Users.spec.ts › Permissions for table details page for Data Consumer (shard 6, 1 retry)
  • Pages/Users.spec.ts › Check permissions for Data Steward (shard 6, 1 retry)
  • VersionPages/EntityVersionPages.spec.ts › Directory (shard 6, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants