asticsearch no MeCab в ошибке java.library.pat
Я не могу использовать токенайзер mecab в asticsearch после установки asticsearch 5.2 и mecab-ko, mecab-ko-dict, analysis-mecab-ko(плагин meseb эластичного поиска), я могу создать индексный токенайзер mecab следующим образом:
#!/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)
0 ответов
Вы можете попытаться установить -Djava.library.path=/usr/local/lib:/path/to/mecab.so/dir в сценарии эластичного запуска.