Java Code Examples for org.elasticsearch.index.settings.IndexSettingsService#getSettings()

The following examples show how to use org.elasticsearch.index.settings.IndexSettingsService#getSettings() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Inject
public HanLpAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);

    boolean indexMode = settings.getAsBoolean(INDEX_MODE, false);
    boolean nameRecognize = settings.getAsBoolean(NAME_RECOGNIZE, true);
    boolean translatedNameRecognize = settings.getAsBoolean(TRANSLATED_NAME_RECOGNIZE, true);
    boolean japaneseNameRecognize = settings.getAsBoolean(JAPANESE_NAME_RECOGNIZE, false);
    boolean placeRecognize = settings.getAsBoolean(PLACE_RECOGNIZE, false);
    boolean organizationRecognize = settings.getAsBoolean(ORGANIZATION_RECOGNIZE, false);
    boolean useCustomDictionary = settings.getAsBoolean(USE_CUSTOM_DICTIONARY, true); // enableCustomDictionary
    boolean speechTagging = settings.getAsBoolean(SPEECH_TAGGING, false); // PorterStemming
    boolean offset = settings.getAsBoolean(OFFSET, false);
    boolean numberQuantifierRecognize = settings.getAsBoolean(NUMBER_QUANTIFIER_RECOGNIZE, false);
    int threads = settings.getAsInt(THREADS, 1); // if more than 1, it means use multi-threading

    analyzer = new HanLPAnalyzer(indexMode, nameRecognize, translatedNameRecognize, japaneseNameRecognize,
                                 placeRecognize, organizationRecognize, useCustomDictionary, speechTagging, offset,
                                 numberQuantifierRecognize, threads, null);
}
 
Example 2
Source Project: Elasticsearch   File: AnalysisService.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public AnalysisService(Index index, IndexSettingsService indexSettingsService, @Nullable IndicesAnalysisService indicesAnalysisService,
                       @Nullable Map<String, AnalyzerProviderFactory> analyzerFactoryFactories,
                       @Nullable Map<String, TokenizerFactoryFactory> tokenizerFactoryFactories,
                       @Nullable Map<String, CharFilterFactoryFactory> charFilterFactoryFactories,
                       @Nullable Map<String, TokenFilterFactoryFactory> tokenFilterFactoryFactories) {
    this(index, indexSettingsService.getSettings(), indicesAnalysisService, analyzerFactoryFactories, tokenizerFactoryFactories,
            charFilterFactoryFactories, tokenFilterFactoryFactories);

}
 
Example 3
Source Project: Elasticsearch   File: SimilarityService.java    License: Apache License 2.0 5 votes vote down vote up
@Inject
public SimilarityService(Index index, IndexSettingsService indexSettingsService,
                         final SimilarityLookupService similarityLookupService, final MapperService mapperService) {
    super(index, indexSettingsService.getSettings());
    this.similarityLookupService = similarityLookupService;
    this.mapperService = mapperService;

    Similarity defaultSimilarity = similarityLookupService.similarity(SimilarityLookupService.DEFAULT_SIMILARITY).get();
    // Expert users can configure the base type as being different to default, but out-of-box we use default.
    Similarity baseSimilarity = (similarityLookupService.similarity("base") != null) ? similarityLookupService.similarity("base").get() :
            defaultSimilarity;

    this.perFieldSimilarity = (mapperService != null) ? new PerFieldSimilarity(defaultSimilarity, baseSimilarity, mapperService) :
            defaultSimilarity;
}
 
Example 4
@Inject
public BrazilianAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    analyzer = new BrazilianAnalyzer(Analysis.parseStopWords(env, settings, BrazilianAnalyzer.getDefaultStopSet()),
                                     Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
    analyzer.setVersion(version);
}
 
Example 5
@Inject
public RussianAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    analyzer = new RussianAnalyzer(Analysis.parseStopWords(env, settings, RussianAnalyzer.getDefaultStopSet()),
                                   Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
    analyzer.setVersion(version);
}
 
Example 6
@Inject
public LithuanianAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    analyzer = new LithuanianAnalyzer(Analysis.parseStopWords(env, settings, LithuanianAnalyzer.getDefaultStopSet()),
                                  Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET));
    analyzer.setVersion(version);
}
 
Example 7
@Inject
public TrimTokenFilterFactory(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    if (version.onOrAfter(Version.LUCENE_4_4_0) && settings.get(UPDATE_OFFSETS_KEY) != null) {
        throw new IllegalArgumentException(UPDATE_OFFSETS_KEY +  " is not supported anymore. Please fix your analysis chain or use"
                + " an older compatibility version (<=4.3) but beware that it might cause highlighting bugs.");
    }
    this.updateOffsets = settings.getAsBoolean("update_offsets", false);
}
 
Example 8
Source Project: Elasticsearch   File: MapperService.java    License: Apache License 2.0 4 votes vote down vote up
@Inject
public MapperService(Index index, IndexSettingsService indexSettingsService, AnalysisService analysisService,
                     SimilarityLookupService similarityLookupService,
                     ScriptService scriptService, MapperRegistry mapperRegistry,
                     DynamicArrayFieldMapperBuilderFactoryProvider dynamicArrayFieldMapperBuilderFactoryProvider) {
    super(index, indexSettingsService.getSettings());
    this.indexSettings = indexSettingsService.getSettings();
    this.indexSettingsService = indexSettingsService;
    this.analysisService = analysisService;
    this.mapperRegistry = mapperRegistry;
    this.fieldTypes = new FieldTypeLookup();
    this.documentParser = new DocumentMapperParser(indexSettings, this, analysisService, similarityLookupService,
            scriptService, mapperRegistry, dynamicArrayFieldMapperBuilderFactoryProvider.get());
    this.indexAnalyzer = new MapperAnalyzerWrapper(analysisService.defaultIndexAnalyzer(), INDEX_ANALYZER_EXTRACTOR);
    this.searchAnalyzer = new MapperAnalyzerWrapper(analysisService.defaultSearchAnalyzer(), SEARCH_ANALYZER_EXTRACTOR);
    this.searchQuoteAnalyzer = new MapperAnalyzerWrapper(analysisService.defaultSearchQuoteAnalyzer(), SEARCH_QUOTE_ANALYZER_EXTRACTOR);

    this.dynamic = this.indexSettings.getAsBoolean(INDEX_MAPPER_DYNAMIC_SETTING, INDEX_MAPPER_DYNAMIC_DEFAULT);
    defaultPercolatorMappingSource = "{\n" +
        "\"_default_\":{\n" +
        "\"properties\" : {\n" +
        "\"query\" : {\n" +
        "\"type\" : \"object\",\n" +
        "\"enabled\" : false\n" +
        "}\n" +
        "}\n" +
        "}\n" +
        "}";
    if (index.getName().equals(ScriptService.SCRIPT_INDEX)){
        defaultMappingSource =  "{" +
            "\"_default_\": {" +
            "\"properties\": {" +
            "\"script\": { \"enabled\": false }," +
            "\"template\": { \"enabled\": false }" +
            "}" +
            "}" +
            "}";
    } else {
        defaultMappingSource = "{\"_default_\":{}}";
    }

    if (logger.isTraceEnabled()) {
        logger.trace("using dynamic[{}], default mapping source[{}], default percolator mapping source[{}]", dynamic, defaultMappingSource, defaultPercolatorMappingSource);
    } else if (logger.isDebugEnabled()) {
        logger.debug("using dynamic[{}]", dynamic);
    }
}
 
Example 9
@Inject
public WhitespaceTokenizerFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
}
 
Example 10
@Inject
public LowerCaseTokenizerFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
}
 
Example 11
Source Project: Elasticsearch   File: Store.java    License: Apache License 2.0 4 votes vote down vote up
@Inject
public Store(ShardId shardId, IndexSettingsService indexSettingsService, DirectoryService directoryService, ShardLock shardLock, OnClose onClose) throws IOException {
    this(shardId, indexSettingsService.getSettings(), directoryService, shardLock, onClose);
}
 
Example 12
@Inject
public KeepLastNDeletionPolicy(ShardId shardId, IndexSettingsService indexSettingsService) {
    super(shardId, indexSettingsService.getSettings());
    this.numToKeep = indexSettings.getAsInt("index.deletionpolicy.num_to_keep", 5);
    logger.debug("Using [keep_last_n] deletion policy with num_to_keep[{}]", numToKeep);
}
 
Example 13
@Inject
public PersianAnalyzerProvider(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    analyzer = new PersianAnalyzer(Analysis.parseStopWords(env, settings, PersianAnalyzer.getDefaultStopSet()));
    analyzer.setVersion(version);
}
 
Example 14
@Inject
public SnowballTokenFilterFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    this.language = Strings.capitalize(settings.get("language", settings.get("name", "English")));
}
 
Example 15
Source Project: Elasticsearch   File: IndexQueryCache.java    License: Apache License 2.0 4 votes vote down vote up
@Inject
public IndexQueryCache(Index index, IndexSettingsService indexSettingsService, IndicesQueryCache indicesQueryCache) {
    super(index, indexSettingsService.getSettings());
    this.indicesQueryCache = indicesQueryCache;
}
 
Example 16
@Inject
public ScandinavianFoldingFilterFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
}
 
Example 17
@Inject
public CzechStemTokenFilterFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
}
 
Example 18
@Inject
public ClassicFilterFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
}
 
Example 19
Source Project: Elasticsearch   File: CodecService.java    License: Apache License 2.0 4 votes vote down vote up
@Inject
public CodecService(Index index, IndexSettingsService indexSettingsService, MapperService mapperService) {
    this(index, indexSettingsService.getSettings(), mapperService);
}
 
Example 20
@Inject
public ElisionTokenFilterFactory(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    this.articles = Analysis.parseArticles(env, settings);
}