I'm using Elasticsearch v2.2.0
I have a plugin which uses the existing "_search" endpoint. That is, I register the following handlers for my plugin:
- /_search
- /{index}/_search
- /{index}/{type}/_search
The plugin works fine when installed on the standalone cluster. However, when I load it onto a test class extending ESIntegTestCase using:
@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return pluginList(MyPlugin.class);
}
and start a test, I get the following error:
[code]org.elasticsearch.common.inject.CreationException: Guice creation errors:
- Error injecting constructor, java.lang.AssertionError
at org.elasticsearch.rest.action.search.RestSearchAction.(Unknown Source)
while locating org.elasticsearch.rest.action.search.RestSearchAction
1 error
at org.elasticsearch.common.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:360)
at org.elasticsearch.common.inject.InjectorBuilder.injectDynamically(InjectorBuilder.java:178)
at org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:110)
at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:93)
at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)
at org.elasticsearch.common.inject.ModulesBuilder.createInjector(ModulesBuilder.java:46)
at org.elasticsearch.node.Node.(Node.java:200)
at org.elasticsearch.node.MockNode.(MockNode.java:43)
at org.elasticsearch.test.InternalTestCluster.buildNode(InternalTestCluster.java:606)
at org.elasticsearch.test.InternalTestCluster.reset(InternalTestCluster.java:957)
at org.elasticsearch.test.InternalTestCluster.beforeTest(InternalTestCluster.java:925)
at org.elasticsearch.test.ESIntegTestCase.beforeInternal(ESIntegTestCase.java:345)
at org.elasticsearch.test.ESIntegTestCase.before(ESIntegTestCase.java:1953)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1660)
at com.carrotsearch.randomizedtesting.RandomizedRunner$9.evaluate(RandomizedRunner.java:900)
at com.carrotsearch.randomizedtesting.RandomizedRunner$10.evaluate(RandomizedRunner.java:916)
at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
....
Caused by: java.lang.AssertionError
at org.elasticsearch.common.path.PathTrie$TrieNode.insert(PathTrie.java:121)
at org.elasticsearch.common.path.PathTrie.insert(PathTrie.java:203)
at org.elasticsearch.rest.RestController.registerHandler(RestController.java:118)
at org.elasticsearch.rest.action.search.RestSearchAction.(RestSearchAction.java:58)
.....
... 47 more
[/code]
The same behavior repeats when I load the plugin onto a MockNode
Set<Class<? extends Plugin>> plugins = new HashSet<Class<? extends Plugin>>();
plugins.add(SearchIntelPlugin.class);
MockNode mockNode = new MockNode(nodeSettings, Version.CURRENT, plugins);
And similarly, if I use "_cat", I get
Error injecting constructor, java.lang.AssertionError
at org.elasticsearch.rest.action.cat.RestCatAction.<init>(Unknown Source)
while locating org.elasticsearch.rest.action.cat.RestCatAction
with the same stacktrace as above.
Is using an existing endpoint not possible for a plugin?
And also, why does this error appear only for the embedded nodes, and not when used on the standalone cluster?