Skip to content

Fixes #30830: Add Korean (KO) search index mapping language with the nori analyzer - #30831

Merged
mohityadav766 merged 8 commits into
open-metadata:mainfrom
kyun6318:feat/ko-nori-mapping
Oct 21, 2026
Merged

mohityadav766 merged 8 commits into
open-metadata:mainfrom
kyun6318:feat/ko-nori-mapping

Conversation

@kyun6318

@kyun6318 kyun6318 commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #30830

Korean is not one of the supported searchIndexMappingLanguage values, so Korean text is indexed with om_analyzer — a standard tokenizer plus word_delimiter and kstem. Korean writes compounds without spaces, so a phrase like 주문상세내역 ("order detail history") becomes one opaque term and free-text search over description effectively does not work.

This adds KO alongside JP, ZH and RU, following the zh pattern: reference the analysis plugin's built-in analyzer directly rather than hand-assembling one. ko/ is derived from zh/ and routes the same field set, so there is no Korean-specific policy to maintain — the only differences are ik_max_word → nori, and dropping the ik_smart search_analyzer since nori has no max/smart split.

zh:  "analyzer": "ik_max_word", "search_analyzer": "ik_smart"
ko:  "analyzer": "nori"

Field routing is identical to zh/ — the same 178 dotted paths carry the language analyzer, and everything else (om_analyzer, om_ngram, om_compound_analyzer, ngram settings) is unchanged. Where zh applies its analyzer to a field that en leaves unanalyzed (66 such paths), ko does the same; there is no path where ko and zh diverge.

Why the built-in analyzer rather than hand-assembling one

jp builds om_analyzer_jp from kuromoji_tokenizer plus four filters, so it is fair to ask why ko does not do the same — Korean is agglutinative like Japanese, not isolating like Chinese.

The reason is that the two languages need different things from their plugins. analysis-nori ships a built-in nori analyzer that already chains nori_tokenizer + nori_part_of_speech + nori_readingform + lowercase, which is exactly what Korean needs — particles and verb endings dropped, Hanja folded to Hangul:

회원의 가입    → [회원, 가입]        # subject particle 의 dropped
검색하는 기능  → [검색, 기능]        # verb ending 하는 dropped
顧客 情報      → [고객, 정보]        # Hanja → Hangul reading
고객주문내역   → [고객, 주문, 내역]  # compound split

Hand-assembling the same chain reproduces this token for token, so it would add a settings block to 43 files without changing behaviour. jp assembles its own because it wants a slightly different set than the built-in kuromoji analyzer (kuromoji_number added, ja_stop omitted); ko has no such deviation to make.

Why decompound_mode is left at its default

nori_tokenizer takes a decompound_mode, and mixed looked promising — it keeps the original compound alongside its parts, which improves ranking when the query is exactly that compound. I measured it and it does help there:

query "사업자번호" against a corpus containing a relevant doc and a decoy
  discard : relevant 0.488, decoy 0.443   (1.1x — barely separated)
  mixed   : relevant 0.992, decoy 0.208   (4.8x)

But it breaks match_phrase. Lucene does not persist positionLength at index time, so the compound token is stored with width 1, while query-time analysis emits it as a width-2 graph token wrapped in a spanOr. The span never lines up:

match_phrase("고객 사업자번호 마스터") against the document of that exact name
  discard : hit
  mixed   : no hit

That matters here because matchType: phrase is not limited to searchFields. It also appears in ranking.stages[phraseName] (weight 70.0, applied to every asset type since no assetTypeConfigurations entry overrides ranking), which covers fullyQualifiedName, and in buildHierarchyQuery, which hard-codes matchPhrase on name, displayName, fullyQualifiedName and the glossary.* variants independently of searchSettings.json. Quoted query_string input reaches description through buildComplexQueryV2 as well.

Restricting mixed to fields that take no phrase query does not save it either, because the ranking gain does not survive measurement: across 92 match queries mixed improved recall on zero of them and lost recall on 6 (6.5%). discard already emits the constituent parts, so the only thing mixed adds is the compound original — which helps ranking in narrow cases and costs phrase matching everywhere.

Mirroring zh's asymmetric pair (index=mixed / search=discard) is not an option for nori either: ik_smart still emits multi-character words, but nori's discard never emits the compound original, so the indexed token would never be queried. Phrase stays safe and the gain is exactly zero.

Plugin requirement

analysis-nori must be installed on the cluster, exactly as analysis-kuromoji is for JP and analysis-ik is for ZH. Behaviour on a stock OpenSearch 3.4.0 node with no analysis plugins, creating table_index_mapping:

language result reason
EN 200 no plugin needed
JP 400 om_analyzer_jp failed to find tokenizer [kuromoji_tokenizer]
ZH 400 analyzer [ik_smart] has not been configured
KO 400 analyzer [nori] has not been configured

So this adds no new class of requirement. Only deployments that explicitly set ELASTICSEARCH_INDEX_MAPPING_LANG=KO are affected, EN stays plugin-free, and the failure is a loud 400 at index creation rather than silent degradation.

analysis-nori is an official Elasticsearch/OpenSearch bundled plugin — opensearch-plugin install --batch analysis-nori resolves from the official repository, unlike analysis-ik which the integration-test image already pulls from a third-party release URL.

Known limitation

nori's dictionary does not cover every compound, and an unknown one is mis-segmented rather than left whole:

주문상세내역 → [주문, 내역]   # 상세 is split into 상/세 and then dropped as affixes
월간보고서   → [월간, 보]

Searching for 상세 will not find that document. This is inherent to nori without a user_dictionary, and it is still a clear improvement over the status quo, where the whole string is one term and no substring search works at all:

query, against a document named 주문상세내역 관리 테이블 EN today KO
주문상세내역 hit hit
주문내역 — hit
내역 — hit
상세 — —

Testing

SearchConsumerFieldBehaviorIT derives its language list from IndexMappingLanguage.values(), so adding the enum constant makes it exercise ko automatically. Two lines keep it green: the test image installs analysis-nori, and LANGUAGE_SAMPLE_TEXT gains a ko entry. 17/17 pass, including the analyzer segmentation check (월간 매출 보고서 → 매출).

Also verified locally against OpenSearch 3.4.0 with analysis-nori:

  • All 62/62 ko/ mappings create successfully through the same OsUtils.enrichIndexMappingForOpenSearch path the service uses.
  • Every analyzer referenced by a ko/ mapping is either defined in the file or provided by the plugin — no dangling references.
  • Field routing matches zh/ exactly, path for path.
  • match_phrase on name, displayName and fullyQualifiedName returns the document for its own full name.
  • Romanized identifiers still split as expected: fact_order → [fact, order].

Unit suites touching the language list pass: IndexMappingNestedFieldConsistencyTest (6), DataProductIndexMappingTest (2), IndexMappingVersionTrackerTest (24).

Note on reindexing

IndexMappingVersionTracker hashes the bundled mappings across all languages to decide which indexes need recreating, so adding ko to that array changes the hash for every entity type. A minor upgrade already forces a full reindex, so this should ride a minor release rather than a patch backport.

Files

  • elasticSearchConfiguration.json — KO added to the enum
  • openmetadata-spec/src/main/resources/elasticsearch/ko/ — 62 new mappings
  • IndexMappingVersionTracker and three test classes — ko added to the language arrays
  • SearchTestImages / SearchConsumerFieldBehaviorIT — install analysis-nori, cover ko
  • generated TS (23 files) and ApplicationSchemas/SearchIndexingApplication.json — regenerated enum

Type of change:

  • New feature

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. — not needed: this only appends a value to an existing enum, no stored value changes meaning or is removed. searchIndexingAppConfig.json picks it up through its existing $ref.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge for the stated minor release.

Summary

Adds KO as a search mapping language and supplies Korean mappings that use nori on the fields selected by the existing zh mappings.

  • Korean search mappings split Korean text with OpenSearch’s nori analyzer.

Reviews (5) · Last reviewed commit: "Merge branch 'main' into feat/ko-nori-ma..." · Reviewed by Greptile

…age with the nori analyzer

Korean is not a supported search index mapping language, so Korean text
is indexed with om_analyzer (standard tokenizer + word_delimiter +
kstem). Korean compounds are written without spaces, so a phrase like
주문상세내역 becomes a single opaque term and free-text search over
description effectively does not work.

This follows the zh pattern: reference the analysis plugin's built-in
analyzer directly, with nori instead of ik_max_word. The ko/ mappings are
derived from zh/ and route the same field set, so there is no ko-specific
policy to maintain — nori has no max/smart split, so the ik_smart
search_analyzer is dropped.

analysis-nori is an official Elasticsearch/OpenSearch bundled plugin and
installs with a single --batch flag, unlike analysis-ik which the
integration-test image already pulls from a third-party release URL. As
with jp and zh, the plugin is required only for deployments that select
this language; EN remains plugin-free.

SearchConsumerFieldBehaviorIT discovers languages from
IndexMappingLanguage.values(), so adding the enum constant makes it
exercise ko automatically. The test image now installs analysis-nori and
the sample-text map covers ko, keeping the suite green.
@kyun6318
kyun6318 requested review from a team as code owners August 2, 2026 14:24
@github-actions

github-actions Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@harshach harshach added the safe to test Add this label to run secure Github workflows on PRs label Aug 12, 2026
@github-actions github-actions Bot removed the safe to test Add this label to run secure Github workflows on PRs label Aug 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@kyun6318

Copy link
Copy Markdown
Contributor Author

Heads-up on the Aug 12 run — the failures here are all the safe to test label check, not the code.

safe to test was applied at 15:22:11Z and the workflows did start on bb4ca0b8. The "Update branch" merge pushed at 15:22:17Z fired synchronize, which invalidated the approval via Invalidate safe-to-test on fork sync as designed, and the concurrency group cancelled the jobs that were already running. The surviving runs are the ones on 8257e78c, which reached Verify PR labels at ~15:24 with the label already gone.

Re-applying safe to test without pushing to the branch afterwards should be enough — the branch is already up to date with main thanks to your merge. Separately, Validate PR Metadata still wants Shipping → Source / Priority / Domain / Release on #30830.

Happy to handle anything on my side if that's easier.

@harshach harshach added the safe to test Add this label to run secure Github workflows on PRs label Sep 15, 2026
@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 79%
78.96% (127792/161829) 65.29% (44760/68549) 68.32% (25592/37454)

@sonarqubecloud

Copy link
Copy Markdown

@kyun6318

Copy link
Copy Markdown
Contributor Author

Thanks for the label. Checked the results and everything exercising this change is green: generate-types, Java/Python/UI checkstyles, Sonar, validate-json-yaml, and ES index creation during bootstrap all pass with the KO mapping.

The failures look like infra issues. All Java/Python integration lanes fail on the Docker pull for minio/minio:RELEASE.2024-01-16T16-07-38Z with a 404 from Docker Hub, which main has been hitting since ~Aug 22. basedpyright errors are in files untouched by this PR (DB2/DBT/Vertica/Kafka), and the impact-map drift just means the branch is behind main.

I can update the branch, but that drops the safe to test label. Feel free to update and re-label it yourself to do it in one pass. Also, #30830 still needs Source/Priority/Domain/Release in the Shipping project for the metadata check.

@harshach

Copy link
Copy Markdown
Collaborator

@kyun6318 can you resolve the conflicts, please. Make sure all the tests are passing

@harshach

Copy link
Copy Markdown
Collaborator

@kyun6318 also make sure one can set the config at the server config as well

searchIndexMappingLanguage : ${ELASTICSEARCH_INDEX_MAPPING_LANG:-EN}

Resolve conflicts from the language-analysis refactors on main and
re-derive the Korean index mappings from the current zh mappings.

- ko mappings: regenerate all 62 files from upstream zh (ik_max_word /
  ik_smart -> nori), carrying the om_ngram settings the zh files omit for
  directory/drive_service/file/folder/spreadsheet/user/worksheet. Picks up
  asciifolding, om_plural_stemmer, flattened testCaseResolutionStatusDetails,
  description positions, dimension-by-name and the vector fields.
- SearchTestImages: install analysis-nori alongside kuromoji via the new
  time-bounded official-plugin install command.
- Add ko to the language lists in IndexMappingNestedFieldConsistencyTest
  and AvailableEntityTypesConsistencyTest.
- SearchIndexMappingLanguageConfigTest: parse the shipped
  conf/openmetadata.yaml with ELASTICSEARCH_INDEX_MAPPING_LANG=KO and
  assert it resolves to a Korean mapping file for every indexed entity.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Eq7ov4iB7zJgL7DXYnFBLb
@github-actions github-actions Bot removed the safe to test Add this label to run secure Github workflows on PRs label Sep 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@kyun6318

Copy link
Copy Markdown
Contributor Author

Merged main and re-derived the ko mappings from the current zh ones (same ik→nori swap, now with the asciifolding/plural-stemmer/flattened-resolution-status changes). Added SearchIndexMappingLanguageConfigTest, which parses the shipped conf/openmetadata.yaml with ELASTICSEARCH_INDEX_MAPPING_LANG=KO and checks it resolves to a Korean mapping file for every entity. The push will have dropped safe to test — could you re-apply it when you get a chance?

…o probes

- ko mappings: add asciifolding to om_ngram in the 7 files whose ngram
  settings ko defines but zh omits (directory, drive_service, file, folder,
  spreadsheet, user, worksheet), matching en and the accent-insensitivity
  invariant from open-metadata#22011. Regenerable: upstream zh with ik_max_word/ik_smart
  -> nori, plus en's ngram settings where zh lacks them.
- IndexAnalyzerMappingTest: include ko in the four language loops.
- IndexMappingVersionTracker: derive the language list from
  IndexMappingLanguage instead of a hardcoded array.
- SearchConsumerFieldBehaviorIT: use "월간 매출이 증가했다" -> "매출" for ko so
  the probe only passes when nori strips the subject particle; the standard
  analyzer keeps 매출이 as one token. Note nori in the class Javadoc.
- Regenerate src/jsons and public/jsons via parseSchemas.js so the committed
  dereferenced schemas carry KO (typescript-type-generation fails fork PRs
  on drift since open-metadata#32150).
- SearchIndexMappingLanguageConfigTest: explicit UTF-8 when reading mappings.
- SearchTestImages: rewrap Javadoc to 100 columns.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Eq7ov4iB7zJgL7DXYnFBLb
@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

Re-derive the ko mappings from main's zh mappings with the same rule as
before (ik_max_word/ik_smart become nori; en's ngram settings fill in where
zh references om_ngram without defining it). This adds data_contract and
metric_group and picks up main's field changes in 20 existing mappings.
Add ko to the language lists main added in ContextMemoryIndexMappingTest
and DataContractIndexMappingTest.

SearchTestImages keeps main's vendored analysis-ik and installs
analysis-nori by name next to analysis-kuromoji.
@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@mohityadav766 mohityadav766 added the safe to test Add this label to run secure Github workflows on PRs label Oct 19, 2026
@mohityadav766
mohityadav766 added this pull request to the merge queue Oct 19, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-10-19T21:18:57Z)

Blocked the queue: integration-tests-postgres-opensearch

@github-actions github-actions Bot removed the safe to test Add this label to run secure Github workflows on PRs label Oct 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@mohityadav766 mohityadav766 added the safe to test Add this label to run secure Github workflows on PRs label Oct 21, 2026
@gitar-bot

gitar-bot Bot commented Oct 21, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Adding Korean nori mappings and a selectable KO language changes indexing and search behavior; deployments without analysis-nori could fail index creation.

Adds KO as a search index mapping language using OpenSearch's built-in nori analyzer, with 62 new mappings under elasticsearch/ko/ that follow the existing zh field routing. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

Copy link
Copy Markdown

@mohityadav766
mohityadav766 added this pull request to the merge queue Oct 21, 2026
@sonarqubecloud

Copy link
Copy Markdown

Merged via the queue into open-metadata:main with commit 79ae963 Oct 21, 2026
86 of 136 checks passed
sonika-shah pushed a commit that referenced this pull request Dec 1, 2026
…37483)

#34052 checked each locale's `synonyms` analyzers against its `displayName`
and fixed en, ru and zh. ko was left on the default `standard` analyzer with
no subfields, so two things are broken there:

- `GlossaryTermIndex` boosts `synonyms.ngram` at 1.0 and `searchSettings.json`
  declares it as a search field, but the subfield does not exist in the ko
  mapping, so that leg of the query matches nothing.
- `synonyms` itself is indexed with `standard`, so Korean synonyms are not
  segmented. A synonym written as "회원의 가입" is not found by searching
  "회원 가입", which is the gap #30831 closed everywhere except this field.

This gives ko the same shape zh already has, substituting the Korean analyzer
for IK the same way #30831 did: `nori` where zh uses `ik_max_word`/`ik_smart`,
and `om_ngram` for the ngram subfield, which is already defined in this file.

Requires a reindex of `glossary_term_search_index` to take effect.
`IndexMappingVersionTracker` reports glossaryTerm as the only changed mapping.

Co-authored-by: kyun6318 <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

[Feature] Add Korean (KO) search index mapping language with the nori analyzer

4 participants