本文整理了Java中org.elasticsearch.common.settings.Settings.keySet()
方法的一些代码示例,展示了Settings.keySet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.keySet()
方法的具体详情如下:
包路径:org.elasticsearch.common.settings.Settings
类名称:Settings
方法名:keySet
[英]Returns the fully qualified setting names contained in this settings object.
[中]返回此设置对象中包含的完全限定设置名称。
代码示例来源:origin: spring-projects/spring-data-elasticsearch
private Map<String, String> convertSettingResponse(String settingResponse, String indexName) {
ObjectMapper mapper = new ObjectMapper();
try {
Settings settings = Settings.fromXContent(XContentType.JSON.xContent().createParser(NamedXContentRegistry.EMPTY,
DeprecationHandler.THROW_UNSUPPORTED_OPERATION, settingResponse));
String prefix = indexName + ".settings.";
// Backwards compatibility. TODO Change to return Settings object.
Map<String, String> result = new HashMap<String, String>();
Set<String> keySet = settings.keySet();
for (String key : keySet) {
result.put(key.substring(prefix.length()), settings.get(key));
}
return result;
} catch (IOException e) {
throw new ElasticsearchException("Could not map alias response : " + settingResponse, e);
}
}
代码示例来源:origin: floragunncom/search-guard
for (String dnString:impersonationDns.keySet()) {
try {
allowedImpersonations.putAll(new LdapName(dnString), settings.getAsList(ConfigConstants.SEARCHGUARD_AUTHCZ_IMPERSONATION_DN+"."+dnString));
for (String user:impersonationUsersRest.keySet()) {
allowedRestImpersonations.putAll(user, settings.getAsList(ConfigConstants.SEARCHGUARD_AUTHCZ_REST_IMPERSONATION_USERS+"."+user));
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public boolean exists(Settings settings) {
for (String settingsKey : settings.keySet()) {
if (settingsKey.startsWith(key)) {
return true;
}
}
return false;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/** Returns the number of settings in this settings object. */
public int size() {
return keySet().size();
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Returns distinct namespaces for the given settings
*/
public Set<String> getNamespaces(Settings settings) {
return settings.keySet().stream().filter(this::match).map(key::getNamespace).collect(Collectors.toSet());
}
代码示例来源:origin: org.elasticsearch/elasticsearch
private Stream<String> matchStream(Settings settings) {
return settings.keySet().stream().filter(this::match).map(key::getConcreteString);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Returns true if and only if this setting is present in the given settings instance. Note that fallback settings are excluded.
*
* @param settings the settings
* @return true if the setting is present in the given settings instance, otherwise false
*/
public boolean exists(final Settings settings) {
return settings.keySet().contains(getKey());
}
代码示例来源:origin: org.elasticsearch/elasticsearch
static void assertSettingsIsSubsetOf(String type, Version version, Settings settings, String... supportedSettings) {
Set<String> unknownSettings = new HashSet<>(settings.keySet());
unknownSettings.removeAll(Arrays.asList(supportedSettings));
unknownSettings.remove("type"); // used to figure out which sim this is
if (unknownSettings.isEmpty() == false) {
DEPRECATION_LOGGER.deprecated("Unknown settings for similarity of type [" + type + "]: " + unknownSettings);
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Returns true if and only if this setting including fallback settings is present in the given settings instance.
*
* @param settings the settings
* @return true if the setting including fallback settings is present in the given settings instance, otherwise false
*/
public boolean existsOrFallbackExists(final Settings settings) {
return settings.keySet().contains(getKey()) || (fallbackSetting != null && fallbackSetting.existsOrFallbackExists(settings));
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public void diff(Settings.Builder builder, Settings source, Settings defaultSettings) {
Set<String> leftGroup = get(source).keySet();
Settings defaultGroup = get(defaultSettings);
builder.put(Settings.builder().put(defaultGroup.filter(k -> leftGroup.contains(k) == false), false)
.normalizePrefix(getKey()).build(), false);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public void apply(Settings value, Settings current, Settings previous) {
for (String key : value.keySet()) {
assert loggerPredicate.test(key);
String component = key.substring("logger.".length());
if ("level".equals(component)) {
continue;
}
if ("_root".equals(component)) {
final String rootLevel = value.get(key);
if (rootLevel == null) {
Loggers.setLevel(LogManager.getRootLogger(), Loggers.LOG_DEFAULT_LEVEL_SETTING.get(settings));
} else {
Loggers.setLevel(LogManager.getRootLogger(), rootLevel);
}
} else {
Loggers.setLevel(LogManager.getLogger(component), value.get(key));
}
}
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
for (Tuple<PluginInfo, Plugin> plugin : plugins) {
Settings settings = plugin.v2().additionalSettings();
for (String setting : settings.keySet()) {
String oldPlugin = foundSettings.put(setting, plugin.v1().getName());
if (oldPlugin != null) {
代码示例来源:origin: org.elasticsearch/elasticsearch
final boolean validateInternalOrPrivateIndex) {
final List<RuntimeException> exceptions = new ArrayList<>();
for (final String key : settings.keySet()) { // settings iterate in deterministic fashion
final Setting<?> setting = getRaw(key);
if (((isPrivateSetting(key) || (setting != null && setting.isPrivateIndex())) && ignorePrivateSettings)) {
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public Settings getValue(Settings current, Settings previous) {
Settings.Builder builder = Settings.builder();
builder.put(current.filter(loggerPredicate));
for (String key : previous.keySet()) {
if (loggerPredicate.test(key) && builder.keys().contains(key) == false) {
if (Loggers.LOG_LEVEL_SETTING.getConcreteSetting(key).exists(settings) == false) {
builder.putNull(key);
} else {
builder.put(key, Loggers.LOG_LEVEL_SETTING.getConcreteSetting(key).get(settings).toString());
}
}
}
return builder.build();
}
代码示例来源:origin: org.elasticsearch/elasticsearch
List<String> getIndexSettingsValidationErrors(final Settings settings, final boolean forbidPrivateIndexSettings) {
String customPath = IndexMetaData.INDEX_DATA_PATH_SETTING.get(settings);
List<String> validationErrors = new ArrayList<>();
if (Strings.isEmpty(customPath) == false && env.sharedDataFile() == null) {
validationErrors.add("path.shared_data must be set in order to use custom data paths");
} else if (Strings.isEmpty(customPath) == false) {
Path resolvedPath = PathUtils.get(new Path[]{env.sharedDataFile()}, customPath);
if (resolvedPath == null) {
validationErrors.add("custom path [" + customPath +
"] is not a sub-path of path.shared_data [" + env.sharedDataFile() + "]");
}
}
if (forbidPrivateIndexSettings) {
for (final String key : settings.keySet()) {
final Setting<?> setting = indexScopedSettings.get(key);
if (setting == null) {
assert indexScopedSettings.isPrivateSetting(key);
} else if (setting.isPrivateIndex()) {
validationErrors.add("private index setting [" + key + "] can not be set explicitly");
}
}
}
return validationErrors;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
isFinalSetting(key) == false && // it's not a final setting
((onlyDynamic == false && get(key) != null) || isDynamicSetting(key)));
for (String key : toApply.keySet()) {
boolean isDelete = toApply.hasValue(key) == false;
if (isDelete && (isValidDelete(key, onlyDynamic) || key.endsWith("*"))) {
代码示例来源:origin: org.elasticsearch/elasticsearch
if (copySettings) {
for (final String key : sourceMetaData.getSettings().keySet()) {
final Setting<?> setting = indexScopedSettings.get(key);
if (setting == null) {
代码示例来源:origin: org.elasticsearch/elasticsearch
Settings.Builder builder = Settings.builder();
boolean changed = false;
for (String key : settings.keySet()) {
try {
Setting<?> setting = get(key);
代码示例来源:origin: org.elasticsearch/elasticsearch
final Settings.Builder builder = Settings.builder();
boolean changed = false; // track if any settings were upgraded
for (final String key : settings.keySet()) {
final Setting<?> setting = getRaw(key);
final SettingUpgrader<?> upgrader = settingUpgraders.get(setting);
代码示例来源:origin: org.elasticsearch/elasticsearch
false, // don't validate dependencies here we check it below never allow to change the number of shards
true); // validate internal or private index settings
for (String key : normalizedSettings.keySet()) {
Setting setting = indexScopedSettings.get(key);
boolean isWildcard = setting == null && Regex.isSimpleMatchPattern(key);
内容来源于网络,如有侵权,请联系作者删除!