gpt4 book ai didi

java - elasticsearch java.library.pat 错误中没有 MeCab

转载 作者:太空宇宙 更新时间:2023-11-04 10:43:52 24 4
gpt4 key购买 nike

我无法在elasticsearch中使用mecab tokenizer安装elasticsearch 5.2和mecab-ko、mecab-ko-dict、analysis-mecab-ko(elasticsearch mecab插件)后,我可以像这样创建索引mecab tokenizer:

#!/usr/bin/env bash
ES='http://localhost:9200'
ESIDX='seunjeon-idx'

echo "put setting"
curl -XPUT "${ES}/${ESIDX}/?pretty" -d '{
"settings" : {
"index":{
"analysis":{
"analyzer":{
"korean":{
"type":"custom",
"tokenizer":"seunjeon_default_tokenizer"
}
},
"tokenizer": {
"seunjeon_default_tokenizer": {
"type": "mecab_ko_standard_tokenizer",
"mecab_args": "/usr/local/lib/mecab/dic/mecab-ko-dic"
}
}
}
}
}
}'

但是下面的curl命令不起作用。

curl -XGET "http://192.168.0.10:9200/seunjeon-idx/_analyze?
analyzer=korean&pretty" -d '삼성전자'

执行上述命令后,/var/log/elasticsearch/elasticsearch.log 中显示以下日志:

java.lang.UnsatisfiedLinkError: no MeCab in java.library.path
at org.bitbucket.eunjeon.mecab_ko_mecab_loader.MeCabLoader.lambda$static$0(MeCabLoader.java:36) ~[?:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_161]
at org.bitbucket.eunjeon.mecab_ko_mecab_loader.MeCabLoader.<clinit>(MeCabLoader.java:28) ~[?:?]
at org.bitbucket.eunjeon.elasticsearch.index.analysis.MeCabKoTokenizerFactoryBase.create(MeCabKoTokenizerFactoryBase.java:74) ~[?:?]
at org.elasticsearch.index.analysis.CustomAnalyzer.createComponents(CustomAnalyzer.java:83) ~[elasticsearch-5.2.0.jar:5.2.0]
at org.apache.lucene.analysis.AnalyzerWrapper.createComponents(AnalyzerWrapper.java:134) ~[lucene-core-6.4.0.jar:6.4.0 bbe4b08cc1fb673d0c3eb4b8455f23ddc1364124 - jim - 2017-01-17 15:57:29]
at org.apache.lucene.analysis.Analyzer.tokenStream(Analyzer.java:198) ~[lucene-core-6.4.0.jar:6.4.0 bbe4b08cc1fb673d0c3eb4b8455f23ddc1364124 - jim - 2017-01-17 15:57:29]
at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.simpleAnalyze(TransportAnalyzeAction.java:215) ~[elasticsearch-5.2.0.jar:5.2.0]
at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.analyze(TransportAnalyzeAction.java:200) ~[elasticsearch-5.2.0.jar:5.2.0]
at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.shardOperation(TransportAnalyzeAction.java:148) ~[elasticsearch-5.2.0.jar:5.2.0]
at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.shardOperation(TransportAnalyzeAction.java:75) ~[elasticsearch-5.2.0.jar:5.2.0]
at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:294) ~[elasticsearch-5.2.0.jar:5.2.0]
at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:287) ~[elasticsearch-5.2.0.jar:5.2.0]
at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-5.2.0.jar:5.2.0]
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-5.2.0.jar:5.2.0]
at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:610) ~[elasticsearch-5.2.0.jar:5.2.0]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:596) ~[elasticsearch-5.2.0.jar:5.2.0]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-5.2.0.jar:5.2.0]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_161]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_161]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_161]

尝试并检查:

ldconfig -p | grep libmecab
libmecab.so.2 (libc6,x86-64) => /usr/local/lib/libmecab.so.2
libmecab.so (libc6,x86-64) => /usr/local/lib/libmecab.so
(https://groups.google.com/forum/#!topic/eunjeon/Yvr80vjvO74)

最佳答案

您可以尝试设置 -Djava.library.path=/usr/local/lib:/path/to/mecab.so/dir在弹性启动脚本中。

关于java - elasticsearch java.library.pat 错误中没有 MeCab,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48634514/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com