springboot
集成 elasticsearch
启动服务端后,访问出现如下报错:
org.elasticsearch.index.mapper.MapperParsingException: analyzer [ik_smart] not found for field [name]
at org.elasticsearch.index.mapper.TypeParsers.parseAnalyzersAndTermVectors(TypeParsers.java:111) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.index.mapper.TypeParsers.parseTextField(TypeParsers.java:200) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.index.mapper.TextFieldMapper$TypeParser.parse(TextFieldMapper.java:215) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.index.mapper.ObjectMapper$TypeParser.parseProperties(ObjectMapper.java:280) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.index.mapper.ObjectMapper$TypeParser.parseObjectOrDocumentTypeProperties(ObjectMapper.java:200) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.index.mapper.RootObjectMapper$TypeParser.parse(RootObjectMapper.java:132) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:112) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:92) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.index.mapper.MapperService.internalMerge(MapperService.java:395) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.index.mapper.MapperService.internalMerge(MapperService.java:354) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:333) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.cluster.metadata.MetaDataMappingService$PutMappingExecutor.execute(MetaDataMappingService.java:227) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.cluster.service.MasterService.executeTasks(MasterService.java:643) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.cluster.service.MasterService.calculateTaskOutputs(MasterService.java:272) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.cluster.service.MasterService.runTasks(MasterService.java:202) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.cluster.service.MasterService$Batcher.run(MasterService.java:137) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.cluster.service.TaskBatcher.runIfNotProcessed(TaskBatcher.java:150) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.cluster.service.TaskBatcher$BatchedTask.run(TaskBatcher.java:188) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:660) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:244) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:207) ~[elasticsearch-6.4.3.jar:6.4.3]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:1.8.0_333]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:1.8.0_333]
at java.lang.Thread.run(Thread.java:834) ~[na:1.8.0_333]
错误原因是,没有安装分词器 IK
如何安装分词器 IK
访问 https://github.com/medcl/elasticsearch-analysis-ik
点击如下图标注出的地方,选择发行的版本
点进来后,可以按下图所示的地方搜索自己想要的版本号
注:此处的版本号最好与
elasticsearch
的版本号保持一致
文章来源:https://www.toymoban.com/news/detail-615853.html
本文就选用 v6.6.2
版本,选择点击进入后,选择 zip
包点击下载,如下图:
下载好后解压,然后上传至 elasticsearch
的 plugins
文件夹下,下图中的路径是本文的安装路径,请小伙伴对照自己 elasticsearch
的路径
最后使用 docker-compose up -d
命令,重新启动文章来源地址https://www.toymoban.com/news/detail-615853.html
到了这里,关于analyzer [ik_smart] not found for field [name]的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!