Search in sources :

Example 1 with EnvironmentModule

use of org.elasticsearch.env.EnvironmentModule in project elasticsearch-skywalker by jprante.

the class SkywalkerTests method test.

@Test
public void test() {
    Settings settings = ImmutableSettings.settingsBuilder().build();
    Injector parentInjector = new ModulesBuilder().add(new SettingsModule(settings), new EnvironmentModule(new Environment(settings)), new IndicesAnalysisModule()).createInjector();
    ActionModule actionModule = new ActionModule(true);
    RestModule restModule = new RestModule(settings);
    SkywalkerPlugin plugin = new SkywalkerPlugin();
    plugin.onModule(actionModule);
    plugin.onModule(restModule);
}
Also used : IndicesAnalysisModule(org.elasticsearch.indices.analysis.IndicesAnalysisModule) RestModule(org.elasticsearch.rest.RestModule) EnvironmentModule(org.elasticsearch.env.EnvironmentModule) Injector(org.elasticsearch.common.inject.Injector) ActionModule(org.elasticsearch.action.ActionModule) SettingsModule(org.elasticsearch.common.settings.SettingsModule) Environment(org.elasticsearch.env.Environment) ModulesBuilder(org.elasticsearch.common.inject.ModulesBuilder) Settings(org.elasticsearch.common.settings.Settings) ImmutableSettings(org.elasticsearch.common.settings.ImmutableSettings) Test(org.testng.annotations.Test)

Example 2 with EnvironmentModule

use of org.elasticsearch.env.EnvironmentModule in project crate by crate.

the class LuceneQueryBuilderTest method createAnalysisService.

private AnalysisService createAnalysisService(Settings indexSettings, Index index) {
    Injector parentInjector = new ModulesBuilder().add(new SettingsModule(indexSettings), new EnvironmentModule(new Environment(indexSettings))).createInjector();
    Injector injector = new ModulesBuilder().add(new IndexSettingsModule(index, indexSettings), new IndexNameModule(index), new AnalysisModule(indexSettings, parentInjector.getInstance(IndicesAnalysisService.class))).createChildInjector(parentInjector);
    return injector.getInstance(AnalysisService.class);
}
Also used : EnvironmentModule(org.elasticsearch.env.EnvironmentModule) IndexNameModule(org.elasticsearch.index.IndexNameModule) IndicesAnalysisService(org.elasticsearch.indices.analysis.IndicesAnalysisService) Injector(org.elasticsearch.common.inject.Injector) IndexSettingsModule(org.elasticsearch.index.settings.IndexSettingsModule) SettingsModule(org.elasticsearch.common.settings.SettingsModule) Environment(org.elasticsearch.env.Environment) ModulesBuilder(org.elasticsearch.common.inject.ModulesBuilder) IndexSettingsModule(org.elasticsearch.index.settings.IndexSettingsModule) AnalysisModule(org.elasticsearch.index.analysis.AnalysisModule)

Aggregations

Injector (org.elasticsearch.common.inject.Injector)2 ModulesBuilder (org.elasticsearch.common.inject.ModulesBuilder)2 SettingsModule (org.elasticsearch.common.settings.SettingsModule)2 Environment (org.elasticsearch.env.Environment)2 EnvironmentModule (org.elasticsearch.env.EnvironmentModule)2 ActionModule (org.elasticsearch.action.ActionModule)1 ImmutableSettings (org.elasticsearch.common.settings.ImmutableSettings)1 Settings (org.elasticsearch.common.settings.Settings)1 IndexNameModule (org.elasticsearch.index.IndexNameModule)1 AnalysisModule (org.elasticsearch.index.analysis.AnalysisModule)1 IndexSettingsModule (org.elasticsearch.index.settings.IndexSettingsModule)1 IndicesAnalysisModule (org.elasticsearch.indices.analysis.IndicesAnalysisModule)1 IndicesAnalysisService (org.elasticsearch.indices.analysis.IndicesAnalysisService)1 RestModule (org.elasticsearch.rest.RestModule)1 Test (org.testng.annotations.Test)1