org.elasticsearch.common.settings.Settings.filter()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(82)

本文整理了Java中org.elasticsearch.common.settings.Settings.filter()方法的一些代码示例,展示了Settings.filter()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.filter()方法的具体详情如下:
包路径:org.elasticsearch.common.settings.Settings
类名称:Settings
方法名:filter

Settings.filter介绍

[英]Returns a new settings object that contains all setting of the current one filtered by the given settings key predicate.
[中]返回一个新的设置对象,该对象包含由给定设置键谓词过滤的当前设置的所有设置。

代码示例

代码示例来源:origin: org.elasticsearch/elasticsearch

/**
 * Compare the specified settings for equality.
 *
 * @param left  the left settings
 * @param right the right settings
 * @return true if the settings are the same, otherwise false
 */
public static boolean same(final Settings left, final Settings right) {
  return left.filter(IndexScopedSettings.INDEX_SETTINGS_KEY_PREDICATE)
      .equals(right.filter(IndexScopedSettings.INDEX_SETTINGS_KEY_PREDICATE));
}

代码示例来源:origin: org.elasticsearch/elasticsearch

@Override
public boolean hasChanged(Settings current, Settings previous) {
  return current.filter(loggerPredicate).equals(previous.filter(loggerPredicate)) == false;
}

代码示例来源:origin: org.elasticsearch/elasticsearch

/**
 * Partitions the settings into those that are known and valid versus those that are unknown or invalid. The resulting tuple contains
 * the known and valid settings in the first component and the unknown or invalid settings in the second component. Note that archived
 * settings contained in the settings to partition are included in the first component.
 *
 * @param settings     the settings to partition
 * @param settingsType a string to identify the settings (for logging)
 * @param logger       a logger to sending warnings to
 * @return the partitioned settings
 */
private Tuple<Settings, Settings> partitionKnownAndValidSettings(
    final Settings settings, final String settingsType, final Logger logger) {
  final Settings existingArchivedSettings = settings.filter(k -> k.startsWith(ARCHIVED_SETTINGS_PREFIX));
  final Settings settingsExcludingExistingArchivedSettings =
      settings.filter(k -> k.startsWith(ARCHIVED_SETTINGS_PREFIX) == false);
  final Settings settingsWithUnknownOrInvalidArchived = clusterSettings.archiveUnknownOrInvalidSettings(
      settingsExcludingExistingArchivedSettings,
      e -> logUnknownSetting(settingsType, e, logger),
      (e, ex) -> logInvalidSetting(settingsType, e, ex, logger));
  return Tuple.tuple(
      Settings.builder()
          .put(settingsWithUnknownOrInvalidArchived.filter(k -> k.startsWith(ARCHIVED_SETTINGS_PREFIX) == false))
          .put(existingArchivedSettings)
          .build(),
      settingsWithUnknownOrInvalidArchived.filter(k -> k.startsWith(ARCHIVED_SETTINGS_PREFIX)));
}

代码示例来源: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 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

Settings indexSettings = settings.filter((s) -> (s.startsWith("index.") &&

代码示例来源:origin: org.elasticsearch/elasticsearch

};
Settings.Builder settingsBuilder = Settings.builder()
  .put(settings.filter(settingsFilter))
  .put(normalizedChangeSettings.filter(k -> {
    if (UNMODIFIABLE_SETTINGS.contains(k)) {
      throw new SnapshotRestoreException(snapshot, "cannot modify setting [" + k + "] on restore");

代码示例来源:origin: org.elasticsearch/elasticsearch

s.equals("index.mapping.single_type") || s.equals("index.soft_deletes.enabled"))
        && indexSettingsBuilder.keys().contains(s) == false;
builder.put(sourceMetaData.getSettings().filter(sourceSettingsPredicate));

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/**
 * Compare the specified settings for equality.
 *
 * @param left  the left settings
 * @param right the right settings
 * @return true if the settings are the same, otherwise false
 */
public static boolean same(final Settings left, final Settings right) {
  return left.filter(IndexScopedSettings.INDEX_SETTINGS_KEY_PREDICATE)
      .equals(right.filter(IndexScopedSettings.INDEX_SETTINGS_KEY_PREDICATE));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

@Override
public boolean hasChanged(Settings current, Settings previous) {
  return current.filter(loggerPredicate).equals(previous.filter(loggerPredicate)) == false;
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public boolean hasChanged(Settings current, Settings previous) {
  return current.filter(loggerPredicate).equals(previous.filter(loggerPredicate)) == false;
}

代码示例来源:origin: org.elasticsearch/elasticsearch

finalSettings.filter(k -> indexScopedSettings.isPrivateSetting(k) == false), true);
metaDataBuilder.put(IndexMetaData.builder(indexMetaData).settings(finalSettings));
  finalSettings.filter(k -> indexScopedSettings.isPrivateSetting(k) == false), true);
metaDataBuilder.put(IndexMetaData.builder(indexMetaData).settings(finalSettings));

代码示例来源:origin: org.elasticsearch/elasticsearch

normalizedSettings.filter(s -> Regex.isSimpleMatchPattern(s) == false), // don't validate wildcards
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

代码示例来源:origin: org.elasticsearch/elasticsearch

indexSettings = indexSettings.filter(k -> Regex.simpleMatch(request.names(), k));
Settings defaultSettings = settingsFilter.filter(indexScopedSettings.diff(indexSettings, Settings.EMPTY));
if (isFilteredRequest(request)) {
  defaultSettings = defaultSettings.filter(k -> Regex.simpleMatch(request.names(), k));

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

@Override
public boolean hasChanged(Settings current, Settings previous) {
  return current.filter(loggerPredicate).getAsMap().equals(previous.filter(loggerPredicate).getAsMap()) == false;
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

private void validateTribeSettings(Settings settings, ClusterSettings clusterSettings) {
  Map<String, Settings> groups = settings.filter(TRIBE_CLIENT_NODE_SETTINGS_PREDICATE).getGroups("tribe.", true);
  for (Map.Entry<String, Settings>  tribeSettings : groups.entrySet()) {
    Settings thisTribesSettings = tribeSettings.getValue();
    for (Map.Entry<String, String> entry : thisTribesSettings.getAsMap().entrySet()) {
      try {
        clusterSettings.validate(entry.getKey(), thisTribesSettings);
      } catch (IllegalArgumentException ex) {
        throw new IllegalArgumentException("tribe." + tribeSettings.getKey() +" validation failed: "+ ex.getMessage(), ex);
      }
    }
  }
}

代码示例来源:origin: apache/servicemix-bundles

@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.apache.servicemix.bundles/org.apache.servicemix.bundles.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: com.strapdata.elasticsearch/elasticsearch

@Override
public Settings getValue(Settings current, Settings previous) {
  Settings.Builder builder = Settings.builder();
  builder.put(current.filter(loggerPredicate).getAsMap());
  for (String key : previous.getAsMap().keySet()) {
    if (loggerPredicate.test(key) && builder.internalMap().containsKey(key) == false) {
      if (ESLoggerFactory.LOG_LEVEL_SETTING.getConcreteSetting(key).exists(settings) == false) {
        builder.putNull(key);
      } else {
        builder.put(key, ESLoggerFactory.LOG_LEVEL_SETTING.getConcreteSetting(key).get(settings));
      }
    }
  }
  return builder.build();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.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();
}

相关文章