My elasticsearch properties define my own type:
index.analysis.analyzer.my_analyzer.type=org.me.index.analysis.MyWonderfulAnalyzerProvider
When I run it I get a org.elasticsearch.common.settings.SettingsException:
Caused by: org.elasticsearch.common.settings.SettingsException: Component [org.me.index.analysis.MyWonderfulAnalyzerProvider] does not start with prefix [org.elasticsearch] at org.elasticsearch.common.settings.ImmutableSettings.getComponentSettings(ImmutableSettings.java:91) at org.elasticsearch.common.settings.ImmutableSettings.getComponentSettings(ImmutableSettings.java:85) at org.elasticsearch.index.AbstractIndexComponent.(AbstractIndexComponent.java:46) at org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider.(AbstractIndexAnalyzerProvider.java:36) ...ImmutableSettings.java:
<raw>@Override public Settings getComponentSettings(Class component) {
return getComponentSettings("org.elasticsearch", component);
}
@Override public Settings getComponentSettings(String prefix, Class component) {
String type = component.getName();
if (!type.startsWith(prefix)) {
throw new SettingsException("Component [" + type + "] does not start with prefix [" + prefix + "]");
}
String settingPrefix = type.substring(prefix.length() + 1); // 1 for the '.'
settingPrefix = settingPrefix.substring(0, settingPrefix.length() - component.getSimpleName().length()); // remove the simple class name (keep the dot)
return getByPrefix(settingPrefix);
}</raw>
If I change my provider's package to begin with org.elasticsearch then everything works fine. However this kind of restriction is suspicious in nature. Why should I be required to define this class in this package and not in my own packages?