本文整理了Java中org.elasticsearch.common.settings.Settings.isEmpty()
方法的一些代码示例,展示了Settings.isEmpty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.isEmpty()
方法的具体详情如下:
包路径:org.elasticsearch.common.settings.Settings
类名称:Settings
方法名:isEmpty
[英]Returns true if this settings object contains no settings
[中]如果此设置对象不包含任何设置,则返回true
代码示例来源: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: org.elasticsearch/elasticsearch
@Override
public ActionRequestValidationException validate() {
ActionRequestValidationException validationException = null;
if (transientSettings.isEmpty() && persistentSettings.isEmpty()) {
validationException = addValidationError("no settings to update", validationException);
}
return validationException;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public ActionRequestValidationException validate() {
ActionRequestValidationException validationException = null;
if (settings.isEmpty()) {
validationException = addValidationError("no settings to update", validationException);
}
return validationException;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.startObject(PERSISTENT_FIELD);
persistentSettings.toXContent(builder, params);
builder.endObject();
builder.startObject(TRANSIENT_FIELD);
transientSettings.toXContent(builder, params);
builder.endObject();
if (defaultSettings.isEmpty() == false) {
builder.startObject(DEFAULTS_FIELD);
defaultSettings.toXContent(builder, params);
builder.endObject();
}
builder.endObject();
return builder;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
private XContentBuilder toXContent(XContentBuilder builder, Params params, boolean omitEmptySettings) throws IOException {
builder.startObject();
for (ObjectObjectCursor<String, Settings> cursor : getIndexToSettings()) {
// no settings, jump over it to shorten the response data
if (omitEmptySettings && cursor.value.isEmpty()) {
continue;
}
builder.startObject(cursor.key);
builder.startObject("settings");
cursor.value.toXContent(builder, params);
builder.endObject();
if (indexToDefaultSettings.isEmpty() == false) {
builder.startObject("defaults");
indexToDefaultSettings.get(cursor.key).toXContent(builder, params);
builder.endObject();
}
builder.endObject();
}
builder.endObject();
return builder;
}
代码示例来源: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
/**
* Returns a {@link Settings} by groupName from {@link IndexSettings} or a default {@link Settings}
* @param indexSettings an index settings
* @param groupName tokenizer/token filter/char filter name
* @return {@link Settings}
*/
public static Settings getSettingsFromIndexSettings(IndexSettings indexSettings, String groupName) {
Settings settings = indexSettings.getSettings().getAsSettings(groupName);
if (settings.isEmpty()) {
settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, indexSettings.getIndexVersionCreated()).build();
}
return settings;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
if (defaultIndexSettings != null && defaultIndexSettings.isEmpty() == false) {
builder.startObject("defaults");
defaultIndexSettings.toXContent(builder, params);
代码示例来源:origin: org.elasticsearch/elasticsearch
if (indexSettings.isEmpty() == false) {
try {
String separator = IntStream.range(0, 85).mapToObj(s -> "*").collect(Collectors.joining("")).trim();
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.field("repository", repository);
builder.field("snapshot", snapshot);
builder.startArray("indices");
for (String index : indices) {
builder.value(index);
}
builder.endArray();
builder.field("partial", partial);
if (settings != null) {
builder.startObject("settings");
if (settings.isEmpty() == false) {
settings.toXContent(builder, params);
}
builder.endObject();
}
builder.field("include_global_state", includeGlobalState);
if (indicesOptions != null) {
indicesOptions.toXContent(builder, params);
}
builder.endObject();
return builder;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
builder.field("cluster_uuid", metaData.clusterUUID);
if (!metaData.persistentSettings().isEmpty()) {
builder.startObject("settings");
metaData.persistentSettings().toXContent(builder, new MapParams(Collections.singletonMap("flat_settings", "true")));
if (context == XContentContext.API && !metaData.transientSettings().isEmpty()) {
builder.startObject("transient_settings");
metaData.transientSettings().toXContent(builder, new MapParams(Collections.singletonMap("flat_settings", "true")));
代码示例来源:origin: org.elasticsearch/elasticsearch
if (settings != null) {
builder.startObject("settings");
if (settings.isEmpty() == false) {
settings.toXContent(builder, params);
if (indexSettings.isEmpty() == false) {
indexSettings.toXContent(builder, params);
代码示例来源: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.elasticsearch/elasticsearch
@Override
public Similarity apply(Settings settings, Version indexCreatedVersion, ScriptService scriptService) {
boolean discountOverlaps = settings.getAsBoolean(SimilarityProviders.DISCOUNT_OVERLAPS, true);
Settings scriptSettings = settings.getAsSettings("script");
Script script = Script.parse(scriptSettings);
SimilarityScript.Factory scriptFactory = scriptService.compile(script, SimilarityScript.CONTEXT);
Settings weightScriptSettings = settings.getAsSettings("weight_script");
Script weightScript = null;
SimilarityWeightScript.Factory weightScriptFactory = null;
if (weightScriptSettings.isEmpty() == false) {
weightScript = Script.parse(weightScriptSettings);
weightScriptFactory = scriptService.compile(weightScript, SimilarityWeightScript.CONTEXT);
}
return new ScriptedSimilarity(
weightScript == null ? null : weightScript.toString(),
weightScriptFactory == null ? null : weightScriptFactory::newInstance,
script.toString(), scriptFactory::newInstance, discountOverlaps);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
mappings.put(indexName, indexEntry.indexMappings);
settings.put(indexName, indexEntry.indexSettings);
if (indexEntry.indexDefaultSettings.isEmpty() == false) {
defaultSettings.put(indexName, indexEntry.indexDefaultSettings);
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
@Override
public ActionRequestValidationException validate() {
ActionRequestValidationException validationException = null;
if (transientSettings.isEmpty() && persistentSettings.isEmpty()) {
validationException = addValidationError("no settings to update", validationException);
}
return validationException;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
@Override
public ActionRequestValidationException validate() {
ActionRequestValidationException validationException = null;
if (transientSettings.isEmpty() && persistentSettings.isEmpty()) {
validationException = addValidationError("no settings to update", validationException);
}
return validationException;
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
@Override
public ActionRequestValidationException validate() {
ActionRequestValidationException validationException = null;
if (settings.isEmpty()) {
validationException = addValidationError("no settings to update", validationException);
}
return validationException;
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public ActionRequestValidationException validate() {
ActionRequestValidationException validationException = null;
if (settings.isEmpty()) {
validationException = addValidationError("no settings to update", validationException);
}
return validationException;
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
/**
* Returns a {@link Settings} by groupName from {@link IndexSettings} or a default {@link Settings}
* @param indexSettings an index settings
* @param groupName tokenizer/token filter/char filter name
* @return {@link Settings}
*/
public static Settings getSettingsFromIndexSettings(IndexSettings indexSettings, String groupName) {
Settings settings = indexSettings.getSettings().getAsSettings(groupName);
if (settings.isEmpty()) {
settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, indexSettings.getIndexVersionCreated()).build();
}
return settings;
}
内容来源于网络,如有侵权,请联系作者删除!