當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。