Docker容器里Elasticsearch 没安装 IK
* Caused by: org.elasticsearch.client.ResponseException: method[PUT], host[http: //192.168.200.128:9200], URI [/goods/_mapping/info?master_timeout=30s&include_type_name=true&timeout=30s], status line [HTTP/1.1 400 Bad Request]
Warnings: [
[types removal] Specifying types in put mapping requests is deprecated.To be compatible with 7.0, the mapping definition should not be nested under the type name, and the parameter include_type_name must be provided and set to false.
] {
"error": {
"root_cause": [{
"type": "mapper_parsing_exception",
"reason": "analyzer [ik_max_word] not found for field [title]"
}],
"type": "mapper_parsing_exception",
"reason": "analyzer [ik_max_word] not found for field [title]"
},
"status": 400
解决方案
查看docker容器内的es插件运行情况
docker logs -f elasticsearch
[2020-11-13T08:52:33,231][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [aggs-matrix-stats]
[2020-11-13T08:52:33,231][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [analysis-common]
[2020-11-13T08:52:33,232][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [ingest-common]
[2020-11-13T08:52:33,232][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [ingest-geoip]
[2020-11-13T08:52:33,232][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [ingest-user-agent]
[2020-11-13T08:52:33,232][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [lang-expression]
[2020-11-13T08:52:33,232][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [lang-mustache]
[2020-11-13T08:52:33,232][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [lang-painless]
[2020-11-13T08:52:33,232][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [mapper-extras]
[2020-11-13T08:52:33,232][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [parent-join]
[2020-11-13T08:52:33,232][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [percolator]
[2020-11-13T08:52:33,232][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [rank-eval]
[2020-11-13T08:52:33,233][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [reindex]
[2020-11-13T08:52:33,233][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [repository-url]
[2020-11-13T08:52:33,233][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [transport-netty4]
[2020-11-13T08:52:33,233][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [tribe]
[2020-11-13T08:52:33,233][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [x-pack-ccr]
[2020-11-13T08:52:33,233][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [x-pack-core]
[2020-11-13T08:52:33,233][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [x-pack-deprecation]
[2020-11-13T08:52:33,233][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [x-pack-graph]
[2020-11-13T08:52:33,233][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [x-pack-ilm]
[2020-11-13T08:52:33,234][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [x-pack-logstash]
[2020-11-13T08:52:33,234][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [x-pack-ml]
[2020-11-13T08:52:33,234][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [x-pack-monitoring]
[2020-11-13T08:52:33,234][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [x-pack-rollup]
[2020-11-13T08:52:33,234][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [x-pack-security]
[2020-11-13T08:52:33,234][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [x-pack-sql]
[2020-11-13T08:52:33,234][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [x-pack-upgrade]
[2020-11-13T08:52:33,234][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded module [x-pack-watcher]
[2020-11-13T08:52:33,235][INFO ][o.e.p.PluginsService ] [A9y8B2a] loaded plugin [analysis-ik]
进入容器内部
docker exec -it elasticsearch bash
获取容器路径
pdw
复制插件进容器内部
docker cp ik ebe500ad730d:/usr/share/elasticsearch/plugins
重启容器
docker restart elasticsearch