Elasticsearchは単語が中国語の単語に非常に友好的ではありません来るので、我々はオープンソースIKワードは、この問題を解決することでダウンロード。最初のpluginsディレクトリに、ダウンロードが完了すると解凍し、あなたは、ESを再起動することができ、ワードブレーカをダウンロードしてください。注:一貫してする必要IK elasticsearchバージョンとWordのバージョン、または再起動時には失敗する具体的な手順は次の通りです。あなたは、このすべてのバージョンを表示し、右コピーリンクアドレスの正しいバージョンを選択することができます。リンクの独自のバージョンをラインで発見:https://github.com/medcl/elasticsearch-analysis-ik/releases
docker exec -it elasticsearch /bin/bash
cd /usr/share/elasticsearch/plugins/
elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.5.1/elasticsearch-analysis-ik-7.5.1.zip
exit
docker restart elasticsearch
上述した実施形態は、ネットワークの問題のために達成されない可能性が搭載されているので、オフラインで実装することができます
通过https://github.com/medcl/elasticsearch-analysis-ik/releases下载对应版本安装包
在es的plugins文件下(/usr/share/elasticsearch/plugins/)创建ik文件夹
cd /usr/share/elasticsearch/plugins/
mkdir ik
将下载好的安装包拷贝在这个文件夹下,同时减压即可
注:JDKをインストールするには、ES IKワードニーズのインストール
テスト:
POST http://localhost:9200/_analyze?pretty=true
{
"analyzer": "ik_max_word",
"text": "中国人民的儿子"
}
結果:
{
"tokens" : [
{
"token" : "中国人民",
"start_offset" : 0,
"end_offset" : 4,
"type" : "CN_WORD",
"position" : 0
},
{
"token" : "中国人",
"start_offset" : 0,
"end_offset" : 3,
"type" : "CN_WORD",
"position" : 1
},
{
"token" : "中国",
"start_offset" : 0,
"end_offset" : 2,
"type" : "CN_WORD",
"position" : 2
},
{
"token" : "国人",
"start_offset" : 1,
"end_offset" : 3,
"type" : "CN_WORD",
"position" : 3
},
{
"token" : "人民",
"start_offset" : 2,
"end_offset" : 4,
"type" : "CN_WORD",
"position" : 4
},
{
"token" : "的",
"start_offset" : 4,
"end_offset" : 5,
"type" : "CN_CHAR",
"position" : 5
},
{
"token" : "儿子",
"start_offset" : 5,
"end_offset" : 7,
"type" : "CN_WORD",
"position" : 6
}
]
}