Fixes #30573: search index=mlModelService no longer returns mlModel assets - #30574
Conversation
…ssets index=mlModelService returned mlModel assets because the entityIndexMap key (mlmodelService) differs in casing from the alias clients send (mlModelService), so the resolver's by-key lookup missed and the token fell through to ES alias expansion across mlmodel_search_index. Resolve a token by an entity's own alias (not just its key) so it collapses to the single concrete service index. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The IT flaked on the postgres-opensearch CI lane: the service await timed out because free-text queries on the long underscore-laden entity name matched unreliably in the mlmodel_service index analyzer. Query by id (a keyword field) instead, which behaves identically on Elasticsearch and OpenSearch, and raise the indexing-convergence timeout to 120s for the heavily parallel IT lane. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
✅ Playwright Results — workflow succeededValidated commit ✅ 1013 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 5 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 53m 7s ⏱️ Max setup 2m 58s · max shard execution 16m 45s · max shard-job elapsed before upload 19m 38s · reporting 5s 🌐 189.21 requests/attempt · 2.22 app boots/UI scenario · 15.82% common-shard skew Optimization targets still in progress:
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
Code Review ✅ ApprovedResolves a search alias casing mismatch by adding a fallback lookup from entity aliases to concrete service indexes, preventing mlModel assets from leaking into mlModelService queries. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar | Powered by Gitar — free for open source |
…ssets (#30574) * fix(search): resolve mlModelService alias to its service index, not assets index=mlModelService returned mlModel assets because the entityIndexMap key (mlmodelService) differs in casing from the alias clients send (mlModelService), so the resolver's by-key lookup missed and the token fell through to ES alias expansion across mlmodel_search_index. Resolve a token by an entity's own alias (not just its key) so it collapses to the single concrete service index. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test(search): make MlModelServiceSearchAliasIT engine-independent The IT flaked on the postgres-opensearch CI lane: the service await timed out because free-text queries on the long underscore-laden entity name matched unreliably in the mlmodel_service index analyzer. Query by id (a keyword field) instead, which behaves identically on Elasticsearch and OpenSearch, and raise the indexing-convergence timeout to 120s for the heavily parallel IT lane. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ssets (#30574) * fix(search): resolve mlModelService alias to its service index, not assets index=mlModelService returned mlModel assets because the entityIndexMap key (mlmodelService) differs in casing from the alias clients send (mlModelService), so the resolver's by-key lookup missed and the token fell through to ES alias expansion across mlmodel_search_index. Resolve a token by an entity's own alias (not just its key) so it collapses to the single concrete service index. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test(search): make MlModelServiceSearchAliasIT engine-independent The IT flaked on the postgres-opensearch CI lane: the service await timed out because free-text queries on the long underscore-laden entity name matched unreliably in the mlmodel_service index analyzer. Query by id (a keyword field) instead, which behaves identically on Elasticsearch and OpenSearch, and raise the indexing-convergence timeout to 120s for the heavily parallel IT lane. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Describe your changes:
Fixes #30573
GET /v1/search/query?index=mlModelServicewas returning both mlModel service entities and mlModel asset entities; it should return only services (asdashboardService,databaseService, etc. correctly do).Root cause: the search resolver
SearchRepository.resolveSingleAliasTokenmaps theindextoken to a concrete*_search_indexonly via a by-key lookup inentityIndexMap. The mlModel service's map key ismlmodelService(equal toEntity.MLMODEL_SERVICE), but its alias — the value clients/UI send — ismlModelService(capital M). The casing mismatch makes the by-key lookup miss, so the token falls through to native ES/OpenSearch alias expansion. That alias is attached tomlmodel_search_indextoo (the asset listsmlModelServiceas aparentAlias), so assets leak in. Every other*Servicehas key == alias, so its lookup hits and resolves to the single concrete service index.Fix: resolve a token by an entity's own
alias(not just its map key). A newaliasIndexMap(built inloadIndexMappings(), only for aliases that are not already keys, so by-key resolution always wins) is consulted on a key miss before falling through to ES.index=mlModelServicenow resolves tomlmodel_service_search_indexonly; compound aliases (all,dataAsset,service) still pass through for native expansion;index=mlmodelstill returns assets. No schema, UI, or entity-type change.Type of change:
High-level design:
N/A — small change (3 files, resolver + tests).
Tests:
Use cases covered
GET /v1/search/query?index=mlModelServicereturns only mlModel services, never mlModel assets.GET /v1/search/query?index=mlmodelstill returns mlModel assets.Unit tests
SearchRepositoryBehaviorTest#getIndexOrAliasNameResolvesEntityAliasWhenKeyCasingDiffers(fails before the fix, passes after). Added a key≠alias mapping to the suite and updated the search-entities key-set assertion. Full suite: 124/124 pass.openmetadata-service/src/test/java/org/openmetadata/service/search/SearchRepositoryBehaviorTest.javaBackend integration tests
MlModelServiceSearchAliasIT— creates an mlModel service + asset, waits for indexing, assertsindex=mlModelServicedoes not return the asset (andindex=mlmodeldoes).openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/MlModelServiceSearchAliasIT.javaIngestion integration tests
Playwright (UI) tests
Manual testing performed
Ran the new IT against a full containerized stack (MySQL + Elasticsearch). Server access logs confirmed:
q=<asset>&index=mlModelServicedid not return the asset,q=<asset>&index=mlmodeldid, andq=<service>&index=mlModelServicereturned the service.mvn spotless:checkclean.UI screen recording / screenshots:
Not applicable.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.Greptile Summary
Updates search alias resolution to map entity aliases with key-casing differences to their concrete index.
mlModelServicecasing mismatch.Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Reviews (2): Last reviewed commit: "test(search): make MlModelServiceSearchA..." | Re-trigger Greptile