For AI agents: this page is also available as Markdown at /docs/cjk.md. Every docs page is: add .md to its URL. llms.txt lists them all.

Chinese, Japanese and Korean

Chinese and Japanese do not separate words with spaces, and Korean compounds freely. The cjk analyzer indexes runs of Han, Hiragana, Katakana and Hangul as overlapping two-character pairs, so 東京都 is indexed as 東京 and 京都, and a query matches when its pairs appear in that order. It needs no dictionary. Latin words and numbers in the same text are kept as words.

{"fields": {"title_ja": {"type": "text", "analyzer": "cjk"}}}

The chain is unicode_word, cjk_width, lowercase, cjk_bigram and the CJK stop words, the same as Elasticsearch's cjk analyzer.

Filters

Filter Does
cjk_width Fullwidth ASCII to normal letters and digits (ABC to ABC); halfwidth Katakana to fullwidth.
cjk_bigram Overlapping pairs. Params han, hiragana, katakana, hangul (all default true) choose the scripts to pair; others stay single characters. output_unigrams (default false) also indexes each character.

A one-character query matches nothing by default, because only pairs are indexed. Set output_unigrams to true to also match single characters, at the cost of a larger index:

{
  "type": "text",
  "analyzer": {
    "tokenizer": "unicode_word",
    "filters": ["cjk_width", "lowercase", {"name": "cjk_bigram", "params": {"output_unigrams": true}}]
  }
}

Tips

View this page as Markdown

Cookie settings

Optional tracking stays off until you choose it. Your choice applies to this browser for 180 days. Read the details.

Essential storage keeps you signed in, protects forms, and remembers this choice. It is always available.