在内存中创建一个node,在导数据的过程中出现Unknown tokenfilter type [pinyin] for [pinyinFilter] 的异常
Elasticsearch | 作者 LianChuang | 发布于2018年07月27日 | 阅读数:4489
创建客户端的代码如下
private void createClient(String pathHome,String transportType,Boolean httpStatus)throws NodeValidationException{
Settings settings = Settings.builder()
.put("path.home",pathHome)
.put("transport.type",transportType)
.put("http.enabled",httpStatus)
.build();
client = new Node(settings).start().client();
client.admin().cluster().prepareHealth().setWaitForGreenStatus().get();
}
利用配置文件穿件客户端的代码如下: public ESManager(Properties conf) {
String pathHome = conf.getProperty("path.home");
String transportType = conf.getProperty("transport.type");
Boolean httpStatus = Boolean.valueOf(conf.getProperty("http.enable"));
// String sys_path = conf.getProperty("synonyms_path");
try {
logger.info("start opening elasticsearch manager ...");
createClient(pathHome,transportType,httpStatus);
logger.info("finish opening elasticsearch manager ...");
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
在导入数据的过程中出现的错误是
java.lang.IllegalArgumentException: Unknown tokenfilter type [pinyin] for [pinyinFilter]
at org.elasticsearch.index.analysis.AnalysisRegistry.getAnalysisProvider(AnalysisRegistry.java:315)
at org.elasticsearch.index.analysis.AnalysisRegistry.buildMapping(AnalysisRegistry.java:268)
at org.elasticsearch.index.analysis.AnalysisRegistry.build(AnalysisRegistry.java:157)
at org.elasticsearch.index.IndexService.<init>(IndexService.java:141)
at org.elasticsearch.index.IndexModule.newIndexService(IndexModule.java:353)
at org.elasticsearch.indices.IndicesService.createIndexService(IndicesService.java:414)
at org.elasticsearch.indices.IndicesService.createIndex(IndicesService.java:378)
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$1.execute(MetaDataCreateIndexService.java:347)
at org.elasticsearch.cluster.ClusterStateUpdateTask.execute(ClusterStateUpdateTask.java:45)
at org.elasticsearch.cluster.service.ClusterService.runTasksForExecutor(ClusterService.java:574)
at org.elasticsearch.cluster.service.ClusterService$UpdateTask.run(ClusterService.java:915)
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:458)
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:238)
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:201)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
哪位大神可以指导一下,谢谢
0 个回复