
wshanshi:总结记录…便于回顾…
关于《跑的ES容器自己停了》这件事:查看docker容器log发现es很占用内存,是空间给的太小了。看了下log至少需要2G。日志中还提到了至少设置一个discovery.type,如下图所示。

跑容器时可以参照如下设置。
docker run -d -p 9200:9200 -p 9300:9300 -e ES_JAVA_POTS="-Xms256m -Xmx256m" -e "discovery.type=single-node" --name es f29a1ee41030
org.elasticsearch.xcontent.XContentParseException: [11:3] [org.elasticsearch.client.core.MainResponse] failed to parse field [version]
nested exception is org.springframework.data.elasticsearch.UncategorizedElasticsearchException: Failed to parse info response. Check logs for detailed information - [11:3] [org.elasticsearch.client.core.MainResponse] failed to parse field [version]; nested exception is ElasticsearchException[Failed to parse info response. Check logs for detailed information - [11:3] [org.elasticsearch.client.core.MainResponse] failed to parse field [version]]
springboot版本和es版本有冲突,选择合适的版本。
未安装分词器会出现如下异常:
{“error”:{“root_cause”:[{“type”:“mapper_parsing_exception”,“reason”:“analyzer [ik_max_word] not found for field [subTitle]”}],“type”:“mapper_parsing_exception”,“reason”:“Failed to parse mapping [_doc]: analyzer [ik_max_word] not found for field [subTitle]”,“caused_by”:{“type”:“mapper_parsing_exception”,“reason”:“analyzer [ik_max_word] not found for field [subTitle]”}},“status”:400}
安装IK分词器。
注意:安装的分词器版本需要和ES版本相同。
curl http://localhost:9200

es安装的哪个版本,就下载哪个版本的分词器。
wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.6.2/elasticsearch-analysis-ik-7.6.2.zip
docker cp 文件路径 容器id:/usr/share/elasticsearch
docker exec -it elasticsearch /bin/bash
cd /usr/share/elasticsearch
unzip elasticsearch-analysis-ik-7.6.2.zip -d ik
mv ik plugins/
docker restart xxxxx
再次尝试,就不会报异常啦。