Hi Guys,
I'm trying to integrate spring with elasticsearch using https://github.com/dadoonet/spring-elasticsearch.
And I'm wondering whether I can setup plugins like 'ik analyzer' or 'river plugin' in my app while integrating ES
and spring. Following the guide, I have my es.properties under src folder, and I identified the path.data,
path.plugins and path.conf directories, and I have the customer analyzer defined as below:
index.analysis.analyzer.ansj.type="ansj".
However, while doing river, I got the exception message:
org.elasticsearch.indices.IndexCreationException: [_river] failed to create index
at org.elasticsearch.indices.InternalIndicesService.createIndex(InternalIndicesService.java:289)
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$1.execute(MetaDataCreateIndexService.java:241)
at org.elasticsearch.cluster.service.InternalClusterService$2.run(InternalClusterService.java:208)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.elasticsearch.ElasticSearchIllegalArgumentException: failed to find analyzer type ["ansj"] or tokenizer for [ansj]
at org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:372)
at org.elasticsearch.common.inject.AbstractModule.configure(AbstractModule.java:60)
at org.elasticsearch.common.inject.spi.Elements$RecordingBinder.install(Elements.java:201)
at org.elasticsearch.common.inject.spi.Elements.getElements(Elements.java:82)
at org.elasticsearch.common.inject.InjectorShell$Builder.build(InjectorShell.java:130)
at org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:99)
at org.elasticsearch.common.inject.InjectorImpl.createChildInjector(InjectorImpl.java:129)
at org.elasticsearch.common.inject.ModulesBuilder.createChildInjector(ModulesBuilder.java:66)
at org.elasticsearch.indices.InternalIndicesService.createIndex(InternalIndicesService.java:287)
... 5 more
Caused by: org.elasticsearch.common.settings.NoClassSettingsException: Failed to load class setting [type] with value ["ansj"]
at org.elasticsearch.common.settings.ImmutableSettings.getAsClass(ImmutableSettings.java:243)
at org.elasticsearch.index.analysis.AnalysisModule.configure(AnalysisModule.java:356)
... 13 more
Caused by: java.lang.ClassNotFoundException: "ansj"
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.elasticsearch.common.settings.ImmutableSettings.getAsClass(ImmutableSettings.java:227)
... 14 more
It seems the integrated ES service can't recognize ansj settings:index.analysis.analyzer.ansj.type="ansj". ... I'm quite puzzled, this configuration works when
without integrating.. At first, I think ES didn't load my plugins directory.. But river & head plugin did work
well.. And while river with default analyzer, it works fine... I don't know how to integrate customer analyzer
with my app while using https://github.com/dadoonet/spring-elasticsearch.
Can anyone help?
Thanks a ton,
Spancer