Search in sources :

Example 1 with IndexNameModule

use of org.elasticsearch.index.IndexNameModule 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)1 ModulesBuilder (org.elasticsearch.common.inject.ModulesBuilder)1 SettingsModule (org.elasticsearch.common.settings.SettingsModule)1 Environment (org.elasticsearch.env.Environment)1 EnvironmentModule (org.elasticsearch.env.EnvironmentModule)1 IndexNameModule (org.elasticsearch.index.IndexNameModule)1 AnalysisModule (org.elasticsearch.index.analysis.AnalysisModule)1 IndexSettingsModule (org.elasticsearch.index.settings.IndexSettingsModule)1 IndicesAnalysisService (org.elasticsearch.indices.analysis.IndicesAnalysisService)1