当前位置: 首页>>代码示例>>Java>>正文


Java Settings.get方法代码示例

本文整理汇总了Java中org.elasticsearch.common.settings.Settings.get方法的典型用法代码示例。如果您正苦于以下问题:Java Settings.get方法的具体用法?Java Settings.get怎么用?Java Settings.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.common.settings.Settings的用法示例。


在下文中一共展示了Settings.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: IndexQueryParserService

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public IndexQueryParserService(Index index, IndexSettingsService indexSettingsService,
                               IndicesQueriesRegistry indicesQueriesRegistry,
                               ScriptService scriptService, AnalysisService analysisService,
                               MapperService mapperService, IndexCache indexCache, IndexFieldDataService fieldDataService,
                               BitsetFilterCache bitsetFilterCache,
                               @Nullable SimilarityService similarityService) {
    super(index, indexSettingsService.getSettings());
    this.indexSettingsService = indexSettingsService;
    this.scriptService = scriptService;
    this.analysisService = analysisService;
    this.mapperService = mapperService;
    this.similarityService = similarityService;
    this.indexCache = indexCache;
    this.fieldDataService = fieldDataService;
    this.bitsetFilterCache = bitsetFilterCache;

    Settings indexSettings = indexSettingsService.getSettings();
    this.defaultField = indexSettings.get(DEFAULT_FIELD, AllFieldMapper.NAME);
    this.queryStringLenient = indexSettings.getAsBoolean(QUERY_STRING_LENIENT, false);
    this.parseFieldMatcher = new ParseFieldMatcher(indexSettings);
    this.defaultAllowUnmappedFields = indexSettings.getAsBoolean(ALLOW_UNMAPPED, true);
    this.indicesQueriesRegistry = indicesQueriesRegistry;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:25,代码来源:IndexQueryParserService.java

示例2: KeepWordFilterFactory

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public KeepWordFilterFactory(Index index, IndexSettingsService indexSettingsService,
                             Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);

    final String[] arrayKeepWords = settings.getAsArray(KEEP_WORDS_KEY, null);
    final String keepWordsPath = settings.get(KEEP_WORDS_PATH_KEY, null);
    if ((arrayKeepWords == null && keepWordsPath == null) || (arrayKeepWords != null && keepWordsPath != null)) {
        // we don't allow both or none
        throw new IllegalArgumentException("keep requires either `" + KEEP_WORDS_KEY + "` or `"
                + KEEP_WORDS_PATH_KEY + "` to be configured");
    }
    if (version.onOrAfter(Version.LUCENE_4_4) && settings.get(ENABLE_POS_INC_KEY) != null) {
        throw new IllegalArgumentException(ENABLE_POS_INC_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.");
    }
    enablePositionIncrements = version.onOrAfter(Version.LUCENE_4_4) ? true : settings.getAsBoolean(ENABLE_POS_INC_KEY, true);

    this.keepWords = Analysis.getWordSet(env, settings, KEEP_WORDS_KEY);

}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:22,代码来源:KeepWordFilterFactory.java

示例3: newMapperService

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
public static MapperService newMapperService(NamedXContentRegistry xContentRegistry, Path tempDir, Settings settings,
        IndicesModule indicesModule) throws IOException {
    Settings.Builder settingsBuilder = Settings.builder()
        .put(Environment.PATH_HOME_SETTING.getKey(), tempDir)
        .put(settings);
    if (settings.get(IndexMetaData.SETTING_VERSION_CREATED) == null) {
        settingsBuilder.put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT);
    }
    Settings finalSettings = settingsBuilder.build();
    MapperRegistry mapperRegistry = indicesModule.getMapperRegistry();
    IndexSettings indexSettings = IndexSettingsModule.newIndexSettings("test", finalSettings);
    IndexAnalyzers indexAnalyzers = createTestAnalysis(indexSettings, finalSettings).indexAnalyzers;
    SimilarityService similarityService = new SimilarityService(indexSettings, Collections.emptyMap());
    return new MapperService(indexSettings,
        indexAnalyzers,
        xContentRegistry,
        similarityService,
        mapperRegistry,
        () -> null);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:MapperTestUtils.java

示例4: onRefreshSettings

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Override
public void onRefreshSettings(Settings settings) {
    TimeValue newPublishTimeout = settings.getAsTime(PUBLISH_TIMEOUT,
            DiscoverySettings.this.settings.getAsTime(PUBLISH_TIMEOUT, DEFAULT_PUBLISH_TIMEOUT));
    if (newPublishTimeout.millis() != publishTimeout.millis()) {
        logger.info("updating [{}] from [{}] to [{}]", PUBLISH_TIMEOUT, publishTimeout, newPublishTimeout);
        publishTimeout = newPublishTimeout;
    }
    String newNoMasterBlockValue = settings.get(NO_MASTER_BLOCK);
    if (newNoMasterBlockValue != null) {
        ClusterBlock newNoMasterBlock = parseNoMasterBlock(newNoMasterBlockValue);
        if (newNoMasterBlock != noMasterBlock) {
            noMasterBlock = newNoMasterBlock;
        }
    }
    Boolean newPublishDiff = settings.getAsBoolean(PUBLISH_DIFF_ENABLE,
            DiscoverySettings.this.settings.getAsBoolean(PUBLISH_DIFF_ENABLE, DEFAULT_PUBLISH_DIFF_ENABLE));
    if (newPublishDiff != publishDiff) {
        logger.info("updating [{}] from [{}] to [{}]", PUBLISH_DIFF_ENABLE, publishDiff, newPublishDiff);
        publishDiff = newPublishDiff;
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:23,代码来源:DiscoverySettings.java

示例5: IndexStore

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public IndexStore(Index index, IndexSettingsService settingsService, IndicesStore indicesStore) {
    super(index, settingsService.getSettings());
    Settings indexSettings = settingsService.getSettings();
    this.indicesStore = indicesStore;

    this.rateLimitingType = indexSettings.get(INDEX_STORE_THROTTLE_TYPE, "none");
    if (rateLimitingType.equalsIgnoreCase("node")) {
        nodeRateLimiting = true;
    } else {
        nodeRateLimiting = false;
        rateLimiting.setType(rateLimitingType);
    }
    this.rateLimitingThrottle = indexSettings.getAsBytesSize(INDEX_STORE_THROTTLE_MAX_BYTES_PER_SEC, new ByteSizeValue(0));
    rateLimiting.setMaxRate(rateLimitingThrottle);

    logger.debug("using index.store.throttle.type [{}], with index.store.throttle.max_bytes_per_sec [{}]", rateLimitingType, rateLimitingThrottle);
    this.settingsService = settingsService;
    this.settingsService.addListener(applySettings);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:21,代码来源:IndexStore.java

示例6: onRefreshSettings

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Override
public void onRefreshSettings(Settings settings) {
    String rateLimitingType = settings.get(INDICES_STORE_THROTTLE_TYPE,
            IndicesStore.this.settings.get(INDICES_STORE_THROTTLE_TYPE, DEFAULT_RATE_LIMITING_TYPE));
    // try and parse the type
    StoreRateLimiting.Type.fromString(rateLimitingType);
    if (!rateLimitingType.equals(IndicesStore.this.rateLimitingType)) {
        logger.info("updating indices.store.throttle.type from [{}] to [{}]", IndicesStore.this.rateLimitingType, rateLimitingType);
        IndicesStore.this.rateLimitingType = rateLimitingType;
        IndicesStore.this.rateLimiting.setType(rateLimitingType);
    }

    ByteSizeValue rateLimitingThrottle = settings.getAsBytesSize(
            INDICES_STORE_THROTTLE_MAX_BYTES_PER_SEC,
            IndicesStore.this.settings.getAsBytesSize(
                    INDICES_STORE_THROTTLE_MAX_BYTES_PER_SEC,
                    DEFAULT_INDICES_STORE_THROTTLE_MAX_BYTES_PER_SEC));
    if (!rateLimitingThrottle.equals(IndicesStore.this.rateLimitingThrottle)) {
        logger.info("updating indices.store.throttle.max_bytes_per_sec from [{}] to [{}], note, type is [{}]", IndicesStore.this.rateLimitingThrottle, rateLimitingThrottle, IndicesStore.this.rateLimitingType);
        IndicesStore.this.rateLimitingThrottle = rateLimitingThrottle;
        IndicesStore.this.rateLimiting.setMaxRate(rateLimitingThrottle);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:24,代码来源:IndicesStore.java

示例7: HyphenationCompoundWordTokenFilterFactory

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public HyphenationCompoundWordTokenFilterFactory(Index index, IndexSettingsService indexSettingsService, Environment env, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), env, name, settings);

    String hyphenationPatternsPath = settings.get("hyphenation_patterns_path", null);
    if (hyphenationPatternsPath == null) {
        throw new IllegalArgumentException("hyphenation_patterns_path is a required setting.");
    }

    Path hyphenationPatternsFile = env.configFile().resolve(hyphenationPatternsPath);

    try {
        hyphenationTree = HyphenationCompoundWordTokenFilter.getHyphenationTree(new InputSource(Files.newInputStream(hyphenationPatternsFile)));
    } catch (Exception e) {
        throw new IllegalArgumentException("Exception while reading hyphenation_patterns_path: " + e.getMessage());
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:18,代码来源:HyphenationCompoundWordTokenFilterFactory.java

示例8: PathHierarchyTokenizerFactory

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public PathHierarchyTokenizerFactory(Index index, IndexSettingsService indexSettingsService, @Assisted String name, @Assisted Settings settings) {
    super(index, indexSettingsService.getSettings(), name, settings);
    bufferSize = settings.getAsInt("buffer_size", 1024);
    String delimiter = settings.get("delimiter");
    if (delimiter == null) {
        this.delimiter = PathHierarchyTokenizer.DEFAULT_DELIMITER;
    } else if (delimiter.length() > 1) {
        throw new IllegalArgumentException("delimiter can only be a one char value");
    } else {
        this.delimiter = delimiter.charAt(0);
    }

    String replacement = settings.get("replacement");
    if (replacement == null) {
        this.replacement = this.delimiter;
    } else if (replacement.length() > 1) {
        throw new IllegalArgumentException("replacement can only be a one char value");
    } else {
        this.replacement = replacement.charAt(0);
    }
    this.skip = settings.getAsInt("skip", PathHierarchyTokenizer.DEFAULT_SKIP);
    this.reverse = settings.getAsBoolean("reverse", false);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:25,代码来源:PathHierarchyTokenizerFactory.java

示例9: parseStemExclusion

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
public static CharArraySet parseStemExclusion(Settings settings, CharArraySet defaultStemExclusion) {
    String value = settings.get("stem_exclusion");
    if (value != null) {
        if ("_none_".equals(value)) {
            return CharArraySet.EMPTY_SET;
        } else {
            // LUCENE 4 UPGRADE: Should be settings.getAsBoolean("stem_exclusion_case", false)?
            return new CharArraySet(Strings.commaDelimitedListToSet(value), false);
        }
    }
    String[] stemExclusion = settings.getAsArray("stem_exclusion", null);
    if (stemExclusion != null) {
        // LUCENE 4 UPGRADE: Should be settings.getAsBoolean("stem_exclusion_case", false)?
        return new CharArraySet(Arrays.asList(stemExclusion), false);
    } else {
        return defaultStemExclusion;
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:Analysis.java

示例10: canRebalance

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Override
public Decision canRebalance(ShardRouting shardRouting, RoutingAllocation allocation) {
    if (allocation.ignoreDisable()) {
        return allocation.decision(Decision.YES, NAME, "rebalance disabling is ignored");
    }

    Settings indexSettings = allocation.routingNodes().metaData().index(shardRouting.index()).getSettings();
    String enableIndexValue = indexSettings.get(INDEX_ROUTING_REBALANCE_ENABLE);
    final Rebalance enable;
    if (enableIndexValue != null) {
        enable = Rebalance.parse(enableIndexValue);
    } else {
        enable = this.enableRebalance;
    }
    switch (enable) {
        case ALL:
            return allocation.decision(Decision.YES, NAME, "all rebalancing is allowed");
        case NONE:
            return allocation.decision(Decision.NO, NAME, "no rebalancing is allowed");
        case PRIMARIES:
            if (shardRouting.primary()) {
                return allocation.decision(Decision.YES, NAME, "primary rebalancing is allowed");
            } else {
                return allocation.decision(Decision.NO, NAME, "replica rebalancing is forbidden");
            }
        case REPLICAS:
            if (shardRouting.primary() == false) {
                return allocation.decision(Decision.YES, NAME, "replica rebalancing is allowed");
            } else {
                return allocation.decision(Decision.NO, NAME, "primary rebalancing is forbidden");
            }
        default:
            throw new IllegalStateException("Unknown rebalance option");
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:36,代码来源:EnableAllocationDecider.java

示例11: parseIndependence

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
private Independence parseIndependence(Settings settings) {
    String name = settings.get("independence_measure");
    Independence measure = INDEPENDENCE_MEASURES.get(name);
    if (measure == null) {
        throw new IllegalArgumentException("Unsupported IndependenceMeasure [" + name + "]");
    }
    return measure;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:DFISimilarityProvider.java

示例12: IndicesRequestCache

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public IndicesRequestCache(Settings settings, ClusterService clusterService, ThreadPool threadPool) {
    super(settings);
    this.clusterService = clusterService;
    this.threadPool = threadPool;
    this.cleanInterval = settings.getAsTime(INDICES_CACHE_REQUEST_CLEAN_INTERVAL, TimeValue.timeValueSeconds(60));

    String size = settings.get(INDICES_CACHE_QUERY_SIZE);
    if (size == null) {
        size = settings.get(DEPRECATED_INDICES_CACHE_QUERY_SIZE);
        if (size != null) {
            deprecationLogger.deprecated("The [" + DEPRECATED_INDICES_CACHE_QUERY_SIZE
                    + "] settings is now deprecated, use [" + INDICES_CACHE_QUERY_SIZE + "] instead");
        }
    }
    if (size == null) {
        // this cache can be very small yet still be very effective
        size = "1%";
    }
    this.size = size;

    this.expire = settings.getAsTime(INDICES_CACHE_QUERY_EXPIRE, null);
    // defaults to 4, but this is a busy map for all indices, increase it a bit by default
    this.concurrencyLevel =  settings.getAsInt(INDICES_CACHE_QUERY_CONCURRENCY_LEVEL, 16);
    if (concurrencyLevel <= 0) {
        throw new IllegalArgumentException("concurrency_level must be > 0 but was: " + concurrencyLevel);
    }
    buildCache();

    this.reaper = new Reaper();
    threadPool.schedule(cleanInterval, ThreadPool.Names.SAME, reaper);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:33,代码来源:IndicesRequestCache.java

示例13: visitCreateTenant

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Override
public CreateTenantAnalyzedStatement visitCreateTenant(CreateTenant node, Analysis context) {
    // Add SQL Authentication
    UserProperty currentOperateUser = context.parameterContext().userProperty();
    if (!currentOperateUser.getUsernameWithoutTenant().equalsIgnoreCase(UserProperty.ROOT_NAME)) {
        throw new NoPermissionException(RestStatus.FORBIDDEN.getStatus(), "only root have permission to create tenant");
    }
    Settings settings = GenericPropertiesConverter.settingsFromProperties(
            node.properties(), context.parameterContext(), SETTINGS).build();
    CreateTenantAnalyzedStatement statement = new CreateTenantAnalyzedStatement(node.name(), 
            settings.get(TenantSettings.SUPERUSER_PASSWORD.name()), 
            settings.getAsInt(TenantSettings.NUMBER_OF_INSTANCES.name(), TenantSettings.NUMBER_OF_INSTANCES.defaultValue()), 
            settings.get(TenantSettings.INSTANCE_LIST.name()));
    return statement;   
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:16,代码来源:CreateTenantStatementAnalyzer.java

示例14: parseBasicModel

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
/**
 * Parses the given Settings and creates the appropriate {@link BasicModel}
 *
 * @param settings Settings to parse
 * @return {@link BasicModel} referred to in the Settings
 */
protected BasicModel parseBasicModel(Settings settings) {
    String basicModel = settings.get("basic_model");
    BasicModel model = BASIC_MODELS.get(basicModel);
    if (model == null) {
        throw new IllegalArgumentException("Unsupported BasicModel [" + basicModel + "]");
    }
    return model;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:DFRSimilarityProvider.java

示例15: parseDistribution

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
/**
 * Parses the given Settings and creates the appropriate {@link Distribution}
 *
 * @param settings Settings to parse
 * @return {@link Normalization} referred to in the Settings
 */
protected Distribution parseDistribution(Settings settings) {
    String rawDistribution = settings.get("distribution");
    Distribution distribution = DISTRIBUTION_CACHE.get(rawDistribution);
    if (distribution == null) {
        throw new IllegalArgumentException("Unsupported Distribution [" + rawDistribution + "]");
    }
    return distribution;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:15,代码来源:IBSimilarityProvider.java


注:本文中的org.elasticsearch.common.settings.Settings.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。