Hello,
I'm encountered an issue when Elasticsearch 1.3.2 and the test.
The test suite is configure like this:
@ClusterScope(scope = ElasticsearchIntegrationTest.Scope.SUITE,
numDataNodes = 2)
public abstract class AbstractRestActionTest extends
ElasticsearchIntegrationTest {
@Override
protected Settings nodeSettings(int nodeOrdinal) {
Settings settings = ImmutableSettings.settingsBuilder()
.put(super.nodeSettings(nodeOrdinal))
.put("plugins." + PluginsService.LOAD_PLUGIN_FROM_CLASSPATH,
true)
.put("plugin.types", InOutPlugin.class.getName())
.put("index.number_of_shards", defaultShardCount())
.put("index.number_of_replicas", 0)
.put("http.enabled", false)
.build();
return settings;
}
@Override
public Settings indexSettings() {
return settingsBuilder().put("index.number_of_shards",
defaultShardCount()).put("index.number_of_replicas", 0).build();
}
public void setupTestIndexLikeUsers(String indexName, int shards, boolean
loadTestData) throws IOException {
System.out.println("CreateIndex "+ indexName);
assertAcked(prepareCreate(indexName).setSettings(settingsBuilder().
put("index.number_of_shards", shards).put("index.number_of_replicas", 0))
.addMapping("d", jsonBuilder().startObject()
.startObject("d")
.startObject("properties")
.startObject("name")
.field("type", "string")
.field("index", "not_analyzed")
.field("store", "yes")
.endObject()
.endObject()
.endObject()));
ensureGreen(indexName);
if (loadTestData) {
index(indexName, "d", "1", "name", "car");
index(indexName, "d", "2", "name", "bike");
index(indexName, "d", "3", "name", "train");
index(indexName, "d", "4", "name", "bus");
}
refresh();
waitForRelocation();
}
The plugins register RestModule and ActionModule like this:
public void onModule(RestModule restModule) {
restModule.addRestAction(RestExportAction.class);
restModule.addRestAction(RestImportAction.class);
restModule.addRestAction(RestSearchIntoAction.class);
restModule.addRestAction(RestDumpAction.class);
restModule.addRestAction(RestRestoreAction.class);
restModule.addRestAction(RestReindexAction.class);
}
public void onModule(ActionModule module) {
if (!settings.getAsBoolean("node.client", false)) {
module.registerAction(ExportAction.INSTANCE,
TransportExportAction.class);
module.registerAction(ImportAction.INSTANCE,
TransportImportAction.class);
module.registerAction(SearchIntoAction.INSTANCE,
TransportSearchIntoAction.class);
module.registerAction(DumpAction.INSTANCE,
TransportDumpAction.class);
module.registerAction(RestoreAction.INSTANCE,
TransportRestoreAction.class);
module.registerAction(ReindexAction.INSTANCE,
TransportReindexAction.class);
}
}
Another module is registered for map binding like this in the code of
plugin:
@Override
public Collection<Class<? extends Module>> modules() {
Collection<Class<? extends Module>> modules = Lists.newArrayList();
if (!settings.getAsBoolean("node.client", false)) {
modules.add(SearchIntoModule.class);
}
return modules;
}
The configure in the SearchIntoModule class is like this:
@Override
protected void configure() {
MapBinder<String, WriterCollectorFactory> collectorBinder
= MapBinder.newMapBinder(binder(),
String.class, WriterCollectorFactory.class);
collectorBinder.addBinding(BulkWriterCollector.NAME).toProvider(
FactoryProvider
.newFactory(WriterCollectorFactory.class,
BulkWriterCollector.class)).in(
Scopes.SINGLETON);
}
The BulkWriterCollector.NAME is index in the code.
Everything is working correctly when I register the plugins to my
elasticsearch instance.
But When I try to launch the test suite I have this error:
Map injection failed due to duplicated key "index"
at
org.elasticsearch.common.inject.multibindings.MapBinder$RealMapBinder$1.initialize(Unknown
Source)
at
crate.elasticsearch.module.searchinto.SearchIntoModule.configure(SearchIntoModule.java:24
I put a trace in the configure method, and it's called 4 times during the
test, but only one time when the plugins is used by an elasticsearch.
Is it another way to create a new MapBinder in Elasticsearch ?
Regards,
JB damiano
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e3a002a1-6e25-4391-8bd9-edc18c0e9323%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.