本文整理了Java中org.elasticsearch.common.settings.Settings.getByPrefix()
方法的一些代码示例,展示了Settings.getByPrefix()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.getByPrefix()
方法的具体详情如下:
包路径:org.elasticsearch.common.settings.Settings
类名称:Settings
方法名:getByPrefix
[英]A settings that are filtered (and key is removed) with the specified prefix.
[中]使用指定前缀筛选(并删除密钥)的设置。
代码示例来源:origin: floragunncom/search-guard
public Set<String> getAllConfiguredTenantNames() {
final Settings roles = getRolesSettings();
if(roles == null || roles.isEmpty()) {
return Collections.emptySet();
}
final Set<String> configuredTenants = new HashSet<>();
for(String sgRole: roles.names()) {
Settings tenants = roles.getByPrefix(sgRole+".tenants.");
if(tenants != null) {
configuredTenants.addAll(tenants.names());
}
}
return Collections.unmodifiableSet(configuredTenants);
}
代码示例来源:origin: floragunncom/search-guard
public Map<String, Boolean> mapTenants(final User user, final TransportAddress caller) {
if(user == null) {
return Collections.emptyMap();
}
final Map<String, Boolean> result = new HashMap<>();
result.put(user.getName(), true);
for(String sgRole: mapSgRoles(user, caller)) {
Settings tenants = getRolesSettings().getByPrefix(sgRole+".tenants.");
if(tenants != null) {
for(String tenant: tenants.names()) {
if(tenant.equals(user.getName())) {
continue;
}
if("RW".equalsIgnoreCase(tenants.get(tenant, "RO"))) {
result.put(tenant, true);
} else {
if(!result.containsKey(tenant)) { //RW outperforms RO
result.put(tenant, false);
}
}
}
}
}
return Collections.unmodifiableMap(result);
}
代码示例来源:origin: floragunncom/search-guard
final Settings impersonationDns = settings.getByPrefix(ConfigConstants.SEARCHGUARD_AUTHCZ_IMPERSONATION_DN+".");
final Settings impersonationUsersRest = settings.getByPrefix(ConfigConstants.SEARCHGUARD_AUTHCZ_REST_IMPERSONATION_USERS+".");
代码示例来源:origin: floragunncom/search-guard
&& settings.getByPrefix("tribe").size() > 0) {
getThreadContext().putHeader("_sg_header_tn", "true");
代码示例来源:origin: floragunncom/search-guard
if(log.isDebugEnabled() && this.settings.getByPrefix("tribe").size() > 0) {
log.debug("Tribe configuration detected: {}", this.settings);
boolean tribeNode = this.settings.get("tribe.name", null) == null && this.settings.getByPrefix("tribe").size() > 0;
tribeNodeClient = this.settings.get("tribe.name", null) != null;
代码示例来源:origin: floragunncom/search-guard
|| rolesMappingResolution == ConfigConstants.RolesMappingResolution.MAPPING_ONLY))) {
for (final String roleMap : rolesMapping.names()) {
final Settings roleMapSettings = rolesMapping.getByPrefix(roleMap);
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Returns the settings mapped to the given setting name.
*/
public Settings getAsSettings(String setting) {
return getByPrefix(setting + ".");
}
代码示例来源:origin: floragunncom/search-guard
final Settings sgRoleSettings = settings.getByPrefix(sgRole);
if (sgRoleSettings.names().isEmpty()) {
continue;
_sgRole.addClusterPerms(permittedClusterActions);
Settings tenants = settings.getByPrefix(sgRole+".tenants.");
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public Settings get(Settings settings) {
Settings byPrefix = settings.getByPrefix(getKey());
validator.accept(byPrefix);
return byPrefix;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
private Map<String, Settings> getGroupsInternal(String settingPrefix, boolean ignoreNonGrouped) throws SettingsException {
Settings prefixSettings = getByPrefix(settingPrefix);
Map<String, Settings> groups = new HashMap<>();
for (String groupName : prefixSettings.names()) {
Settings groupSettings = prefixSettings.getByPrefix(groupName + ".");
if (groupSettings.isEmpty()) {
if (ignoreNonGrouped) {
continue;
}
throw new SettingsException("Failed to get setting group for [" + settingPrefix + "] setting prefix and setting ["
+ settingPrefix + groupName + "] because of a missing '.'");
}
groups.put(groupName, groupSettings);
}
return Collections.unmodifiableMap(groups);
}
/**
代码示例来源:origin: org.elasticsearch/elasticsearch
nodeSettings = loadDictionarySettings(dicDir, dictSettings.getByPrefix(locale + "."));
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
/**
* Returns the settings mapped to the given setting name.
*/
public Settings getAsSettings(String setting) {
return getByPrefix(setting + ".");
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
/**
* Returns the settings mapped to the given setting name.
*/
public Settings getAsSettings(String setting) {
return getByPrefix(setting + ".");
}
代码示例来源:origin: apache/servicemix-bundles
/**
* Returns the settings mapped to the given setting name.
*/
public Settings getAsSettings(String setting) {
return getByPrefix(setting + ".");
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public ActionRequestValidationException validate() {
ActionRequestValidationException validationException = targetIndexRequest == null ? null : targetIndexRequest.validate();
if (sourceIndex == null) {
validationException = addValidationError("source index is missing", validationException);
}
if (targetIndexRequest == null) {
validationException = addValidationError("target index request is missing", validationException);
}
if (targetIndexRequest.settings().getByPrefix("index.sort.").isEmpty() == false) {
validationException = addValidationError("can't override index sort when resizing an index", validationException);
}
if (type == ResizeType.SPLIT && IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.exists(targetIndexRequest.settings()) == false) {
validationException = addValidationError("index.number_of_shards is required for split operations", validationException);
}
assert copySettings == null || copySettings;
return validationException;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
@Override
public Settings get(Settings settings) {
Settings byPrefix = settings.getByPrefix(getKey());
validator.accept(byPrefix);
return byPrefix;
}
代码示例来源:origin: elasticfence/elasticsearch-http-user-auth
private String getSettingString(String key) throws Exception {
Settings s = settings.getByPrefix(ElasticfenceSettings.SETTINGS_PREFIX);
String value = s.get(key);
//EFLogger.info(SETTINGS_PREFIX + key + " value: " + value);
if (value == null) {
throw new Exception(key + " is not defined in settings!");
}
return value;
}
代码示例来源:origin: elasticfence/elasticsearch-http-user-auth
private String[] getSettingArray(String key, String[] defaultValue) throws Exception {
Settings s = settings.getByPrefix(ElasticfenceSettings.SETTINGS_PREFIX);
String[] value = s.getAsArray(key, defaultValue);
if (value == null || value.length == 0) {
EFLogger.warn(key + " is not defined in settings, setting default value of " + Arrays.toString(defaultValue));
return defaultValue;
}
//EFLogger.info(key + ": " + Arrays.toString(value));
return value;
}
代码示例来源:origin: elasticfence/elasticsearch-http-user-auth
private int getSettingInt(String key, int defaultValue) throws Exception {
Settings s = settings.getByPrefix(ElasticfenceSettings.SETTINGS_PREFIX);
int value = s.getAsInt(key, defaultValue);
if (value == defaultValue) {
EFLogger.warn(key + " is set to the default value of " + defaultValue);
}
return value;
}
代码示例来源:origin: jboss-fuse/fabric8
@Inject
protected InsightIndicesHousekeeperService(Settings settings, ThreadPool threadPool, AdminClient adminClient) {
super(settings);
this.threadPool = threadPool;
this.adminClient = adminClient;
this.settings = settings.getByPrefix("insight.indices.management.");
indicesPrefix = this.settings.get("prefix", "insight");
daysOpened = this.settings.getAsInt("opened", 7);
daysClosed = this.settings.getAsInt("closed", 14);
daysStored = this.settings.getAsInt("stored", 0);
interval = TimeValue.parseTimeValue(settings.get("interval"), TimeValue.timeValueHours(1));
logger.info("Initialized {}", getClass().getSimpleName());
}
内容来源于网络,如有侵权,请联系作者删除!