Repository navigation
feat(search): add data_contract_search_index - #34304
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Recording a contract result PATCHed a copy fetched without owners and reviewers, so the reindex blanked them in every contract doc. Reload the relationship fields first. Keep the index out of the all alias: team and user asset lists and the domain, tag and data product pickers query all, where contracts would show with no link and be accepted as assets they cannot hold. Lowercase-normalize the entity and testSuite FQN keywords so the asset autocomplete matches mixed-case FQNs. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…arch-index # Conflicts: # openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/DataContractResourceIT.java # openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DataContractRepository.java
The canvas hides the delete control on the last remaining rule, so a builder can never be emptied. Callers that handle an emptied builder themselves (the Collate Automator resets to its 'Add Condition' state) opt in with allowRemoveLastRule; every other builder keeps the default.
…late A contract has no tags, tier, domains, data products, certification or service, so conditions on those common fields matched no contract and reported 0 assets. They are no longer offered while data contracts are selected, alone or alongside other asset types, the same rule that limits entity-specific fields to the ones every selected index shares.
…arch-index # Conflicts: # openmetadata-ui/src/main/resources/ui/src/utils/AdvancedSearchClassBase.test.ts # openmetadata-ui/src/main/resources/ui/src/utils/AdvancedSearchClassBase.ts
… button Co-Authored-By: Claude Opus 5.5 <[email protected]>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
❌ UI Checkstyle Failed❌ Bundle Runtime CheckA route chunk loads but one of its chunks still exports 🔍 ESLint findings in this PR's files — 0 error(s), 4 warning(s)Errors block the build. Warnings do not yet — they are rules whose backlog is still 0 error(s), 4 warning(s) across 2 changed file(s).
All findings
Fix locally (fast - only checks files changed in this branch): make ui-checkstyle-changed |
Code Review ✅ Approved🟡 Medium risk · The new Data Contract search index and result-triggered reindexing could make contracts missing or incorrectly filtered if mappings or updates diverge. Adds a search index for data contracts, enabling governance automations to filter and bulk-update contracts through ES/OpenSearch queries. The index excludes large blocks to avoid mapping explosion, fixes a bug in VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
|



Describe your changes:
Data contracts are a first-class entity (own table, API and FQN, linked
asset --CONTAINS--> dataContract) but had no search index, so nothing could select them with a search query. This addsdata_contract_search_indexso contracts can be filtered by search — the immediate consumer is governance automations, which select entities through ES/OpenSearch query filters and need to bulk-update owners and descriptions on contracts.Type of change:
High-level design:
Index registration —
dataContractinindexMapping.jsonwith aliasdataContractand no parent aliases (same placement asingestionPipeline):dataAsset, so contracts stay out of Explore and search-bar suggestions;all, because team/user asset lists and the domain / tag / data-product asset pickers queryall, where a contract would be listed with no link and accepted as a domain or tag asset it cannot hold;childAliasof any asset: the child cascade deletes by<parentType>.idwhile contracts storeentity.id. The contract's own lifecycle events already delete/update its doc when the asset is soft-deleted, restored or hard-deleted (descendantsCoveredByAncestorCascadestays false).Mappings —
elasticsearch/{en,jp,ru,zh}/data_contract_index_mapping.json, each built from that language's own analysis settings. Common entity fields plusentity/testSuitereferences (FQNkeywordlowercase-normalized, noignore_aboveso long asset FQNs stay filterable),latestResult,reviewers, effective dates,fqnHash.Document builder —
DataContractIndex(aSearchIndex, notTaggableIndex— contracts have no tags) addsentityandtestSuite; everything else comes frompopulateCommonFields. It excludes the large or free-form blocks (schema,semantics,qualityExpectations,odcsQualityRules,odcsElementExtensions,contractUpdates,sla,security,termsOfUse) to avoid mapping explosion.Fix uncovered by indexing —
DataContractRepository.updateLatestResultPATCHed a copy of a contract fetched without owners/reviewers (daily validation app,POST /results,POST /validate). Harmless before, but with an index the reindex after that PATCH blanked owners and reviewers in every contract doc. It now reloadsowners,reviewers,extensionfirst and only changeslatestResult.Python —
ES_INDEX_MAPandENTITY_REFERENCE_CLASS_MAPgainDataContract, sopaginate_es(DataContract, …)works andget_entity_type(DataContract)returnsdataContract(was the lowercase fallbackdatacontract).UI —
SearchIndex.DATA_CONTRACT, bothSearchClassBasemappings (no Explore tab — tabs come fromgetTabsInfo),DataContractSearchSource, and query-builder fields for the contract index: asset type (entity.type), asset (entity.fullyQualifiedName.keyword), contract execution status (latestResult.status) and reviewers. Status, owners, name and description come from the common config.Rollout — the index is created at startup. Contracts that already exist are not in it until Search Indexing runs once with
entities: ["dataContract"](orall).Tests:
Use cases covered
Unit tests
DataContractIndexMappingTest(new): registration, contract fields in all 4 languages, noignore_aboveon asset FQN, lowercase-normalized FQN keywords, free-form blocks and tags not mapped.DataContractIndexTest(new): entity reference with display name, minimal contract, excluded blocks, every doc key mapped.SearchIndexFactoryTest,EntityTypeNameTest: new rows.test_ometa_utils.py:get_entity_type(DataContract)andES_INDEX_MAPentry.SearchClassBase.test.ts,AdvancedSearchClassBase.test.ts: mappings and query-builder fields.IndexMappingNestedFieldConsistencyTest,IndexAnalyzerMappingTest,SearchDocFieldValidationTest,SearchSettingsHandlerTest,SearchRepository*Test.Backend integration tests
DataContractResourceIT:supportsSearchIndex = true(enablescheckCreatedEntity,checkDeletedEntity,checkIndexCreated,updateDescriptionAndCheckInSearch,testSearchFluentAPI), pluspatchOwners_reindexesContractandaddResult_keepsOwnersInSearchDoc. Local run: 396 tests, 0 failures.Ingestion integration tests
Playwright (UI) tests
UI screen recording / screenshots:
Not applicable.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.🤖 Generated with Claude Code