Commit 8b0f4a7
authored
fix(search): resolve entity-specific aliases to canonical index names (#27813)
Closes #27761.
Background. When the UI started passing the alias `index=table` (instead
of the legacy `index=table_search_index`), every search for tables also
returned column docs. Root cause: ES alias expansion is bidirectional
through the parent/child graph in indexMapping.json. column_search_index
is created with `table` as one of its aliases (because tableColumn lists
"table" in parentAliases), so when ES sees alias `table` it expands it
to both `table_search_index` and `column_search_index`. The same shape
exists for every alias whose entities also act as a parent for some
other entity (testCase, testSuite, database, …).
Fix. Resolve entity-specific aliases at the API boundary into their
canonical `*_search_index` names so we send literal index names to ES,
bypassing alias expansion entirely. Compound aliases (`all`,
`dataAsset`) have no canonical index — they pass through unchanged so
ES expands them natively, preserving the "everything under the
data-asset umbrella" use case the UI's MyData / CuratedAssets / search-
bar widgets rely on.
The change is one method, `SearchRepository.getIndexOrAliasName(String)`:
* entity-specific alias (`"table"`) → `"<cluster>_table_search_index"`
* compound alias (`"dataAsset"`, `"all"`) → `"<cluster>_dataAsset"` (passes through)
* canonical name (`"table_search_index"`) → `"<cluster>_table_search_index"` (legacy callers)
* already cluster-prefixed → returned unchanged (idempotent)
* empty token from `"table,"` / `","` → dropped, with all-empty input preserved
All four search/export/preview/NLQ resource paths already call this
method; `searchByField`, `aggregate`, and `getEntityTypeCounts` already
call it inside the ES/OS managers. So the fix takes effect across every
endpoint that accepts an `index` parameter without changing the public
API surface — no new query params, no schema changes, no signature
churn.
No caller passes an entity-specific alias and expects child entity types
back: UI sites with `SearchIndex.TABLE`/`TOPIC`/etc. all want only that
type (asset-type filter chips, advanced-search builders, lineage
selection, alert rule scoping). UI sites that DO want mixed entity
types use `SearchIndex.ALL` or `SearchIndex.DATA_ASSET`, which are
compound aliases that this change leaves unchanged. Internal Java
callers (RBAC, propagation, DataInsightSystemChartRepository) pass
entity-specific aliases for entity-specific operations — no leakage
expected there either.
Tests pin: entity-alias → canonical resolution; compound-alias passes
through; idempotent prefix; comma-separated input; empty-token
handling; existing canonical-name behavior unchanged.1 parent 6adbe28 commit 8b0f4a7
2 files changed
Lines changed: 112 additions & 4 deletions
File tree
- openmetadata-service/src
- main/java/org/openmetadata/service/search
- test/java/org/openmetadata/service/search
Lines changed: 50 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
644 | 673 | | |
645 | | - | |
| 674 | + | |
646 | 675 | | |
647 | 676 | | |
648 | | - | |
649 | | - | |
650 | | - | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
651 | 697 | | |
652 | 698 | | |
653 | 699 | | |
| |||
Lines changed: 62 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
278 | 340 | | |
279 | 341 | | |
280 | 342 | | |
| |||
0 commit comments