Repository navigation
Ontology concepts and properties get their own search index with embeddings - #38465
Conversation
❌ 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 |
Use the ontology fields in lexical queries and serialize term writes across live refreshes and reindex jobs. Remove OpenSearch chunks when their parent or publication fingerprint is stale.
Route manual ontology reindexing through the release-aware writer to keep drafts out of search and retain embedding metadata. Batch bulk term creates, skip refreshes for absent chunk indexes, and resolve binding names at read time. Retain delete and restore refreshes for bound asset IDs and cleanup of existing stale chunks.
Replace mock call counts with real OpenSearch assertions for live writes with embeddings disabled, retained matching chunks, and absent chunk indexes.
Code Review ✅ Approved 🔴 High risk 2 closed / 2 findingsOntology search resolves bound asset IDs to table and column FQNs only for admins, changing an access-control boundary; a leak could expose restricted metadata. Adds dedicated ontology concept and property search indexes with embeddings, kept in sync with active releases, term changes, and binding edits, with bound table FQNs shown only to admins. Two resolved items: the postDelete profiler-purge Javadoc now documents postUpdate, and the chunk-index test no longer relies only on verify() mock wiring. No open issues remain. ✅ 2 closed✅ Quality: postDelete's profiler-purge Javadoc now documents postUpdate
✅ Quality: New chunk-index test only checks mock wiring with verify() calls
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 |
…ice unit tests (#38626) * Fixes #38613: Restore StageStatsTracker.recordProcessBatch #36491 removed it as unused, but #38465 had already added callers in the Elasticsearch and OpenSearch bulk sinks, so main no longer compiles. * Share one database server per dialect in OntologyTestDatabase Each withDatabase call started a new MySQL or PostgreSQL container. Start one per dialect per JVM and give each call its own empty database instead, which keeps the isolation of a fresh container. * Run openmetadata-service unit tests in parallel forks Surefire ran every class serially in one JVM. Fork one JVM per CPU and reuse the forks; each keeps its own static registries and test containers. Decision: ADR:2026-11-24-service-unit-tests-run-in-parallel-forks * Add ScratchDatabase: an empty database on the IT suite's server SQL and migration tests that build their own schema get a database on the lane's MySQL or PostgreSQL container instead of starting their own. * Move group B SQL and migration-step tests into the IT module The 22 classes run on ScratchDatabase (an empty database on the lane's server) instead of starting their own MySQL/Postgres containers. Per-dialect pairs keep both methods and skip the other dialect; dialect-parameterized tests run the lane's dialect only. Per-method scratch databases for the migration tests come from ScratchDatabasePerTest. * Move search, Redis, LocalStack and session-store container tests into the IT module Thirteen Docker-backed service tests (plus their abstract bases) now run on the IT suite's infrastructure: the lane's search engine and Redis, S3Proxy for S3, and new on-demand helpers in TestSuiteBootstrap for LocalStack (S3, Secrets Manager, SSM), dedicated Redis servers (cluster mode, pausable) and a dedicated OpenSearch for fixtures that occupy names the application owns. Adds mockito-core as an IT test dependency. * Move ontology storage tests into the integration-test module The 21 ontology storage, MCP SQL and tag-usage tests, with OntologyTestDatabase and OntologyCaptureFixture, now run as *IT classes against ScratchDatabase on the lane's MySQL or PostgreSQL server instead of starting their own container. Dialect-parameterized tests became plain tests on ScratchDatabase.dialect(); the Fixture-based classes that swap the static Entity registry are @isolated and restore the registry through EntityRegistrySnapshot. mockito-core is added as a test dependency of the module. * Keep container tests out of the service unit suite openmetadata-service drops its Testcontainers test dependencies, so a test that needs a real database, search engine, Redis or AWS service has to be an IT. The IT pom registers the moved @isolated classes in the global-state lane and keeps surefire off *IT classes that live in service packages. The impact map owns the moved ITs, and the decision record now says unit tests are mock-only.
Describe your changes:
Related to #38419. No issue is linked yet.
Ontology Studio concepts and properties are in no search index, so a term is found only when the question contains its label word.
On a test dataset, a semantic lookup reached the intended term for 2 of 21 phrasings:
Glossary terms with the same names are found, because they are indexed with embeddings.
This PR gives ontology terms their own search indexes, with embeddings, outside the data-asset aliases.
Type of change:
High-level design:
Indexes
ontology_concept_search_indexandontology_property_search_index, under the shared aliasontologyTerms.all,dataAssetor Data Insights: they are not data assets.Documents
/search/query,/search/fieldQueryand/nlq/queryresolve them to live FQNs. Other callers, and direct index reads, never get binding FQNs.Which version is indexed
Keeping it current
/search/reindexEntitiesuses the published-term writer and preserves matching embedding metadata. Bulk creates send their deduplicated terms to that writer together.SearchIndexingApplicationreindexes both types. Reads are batched throughDocBuildContext.Embeddings
fingerprint,AvailableEntityTypes).data_asset_embeddings_chunks. On Elasticsearch the vectors stay in the term indexes.Decision record:
docs/decisions/2026-11-23-ontology-terms-have-dedicated-search-indexes.md.Rollout: new indexes appear at startup. Existing installs need a reindex of
ontologyConceptandontologyPropertyto populate them.Tests:
Use cases covered
/search/query,/search/fieldQueryor/nlq/query.Unit tests
SearchRepositoryTestandSearchResourceTestresults from0ab3cbc2: 32 tests passed, with zero failures, errors, or skips. This follow-up changes only tests.OntologyChunkIndexTestwith real OpenSearch integration coverage.Backend integration tests
OntologyTermSearchITon PostgreSQL/OpenSearch — 8 tests passed, with zero failures, errors, or skips, holding theSEARCH_INDEX_APPlock.Local Java test run: PASSED
0ab3cbc2df1d(baserefs/review-fixes/20261123/pr-38465-gitar) — uncommitted changes were present--scope full).Playwright (UI) tests
Manual testing performed


Confidence Score: 5/5
The reviewed changes appear safe to merge.Summary
Adds separate search indexes and embeddings for published ontology concepts and properties.
No new actionable issues were found in the changes since the previous review. The earlier threads are unnumbered and their reported problems are addressed by the current code. Tests were not run during this review.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR Release[Active ontology release] --> Writer[Shared term writer] Owners[Current owners and binding IDs] --> Writer Writer --> Concepts[Concept search index] Writer --> Properties[Property search index] Writer --> Cleanup[Remove stale chunks] Writer --> Lane[Embedding work] Lane --> ES[Elasticsearch term vectors] Lane --> OS[OpenSearch ontology chunks] Concepts --> Search[Search response] Properties --> Search Search --> Admin[Admin gets live binding names] Search --> Reader[Other callers get no binding names]Reviews (5) · Last reviewed commit: "test(search): verify ontology chunk clea..." · Reviewed by Greptile