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
Source File: HanLpAnalyzerProvider.java    From elasticsearch-analysis-hanlp with Apache License 2.0 6 votes vote down vote up
@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 File: AnalysisService.java    From Elasticsearch with 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 File: SimilarityService.java    From Elasticsearch with 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
Source File: BrazilianAnalyzerProvider.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@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
Source File: RussianAnalyzerProvider.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@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
Source File: TrimTokenFilterFactory.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@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 7
Source File: LithuanianAnalyzerProvider.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@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 8
Source File: ElisionTokenFilterFactory.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@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);
}
 
Example 9
Source File: CodecService.java    From Elasticsearch with 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 10
Source File: ClassicFilterFactory.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Inject
public ClassicFilterFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
}
 
Example 11
Source File: CzechStemTokenFilterFactory.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Inject
public CzechStemTokenFilterFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
}
 
Example 12
Source File: ScandinavianFoldingFilterFactory.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Inject
public ScandinavianFoldingFilterFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
}
 
Example 13
Source File: IndexQueryCache.java    From Elasticsearch with 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 14
Source File: SnowballTokenFilterFactory.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@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 File: PersianAnalyzerProvider.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@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 16
Source File: KeepLastNDeletionPolicy.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@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 17
Source File: Store.java    From Elasticsearch with 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 18
Source File: LowerCaseTokenizerFactory.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Inject
public LowerCaseTokenizerFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
}
 
Example 19
Source File: WhitespaceTokenizerFactory.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Inject
public WhitespaceTokenizerFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
}
 
Example 20
Source File: MapperService.java    From Elasticsearch with 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);
    }
}