Class Settings.Builder

java.lang.Object
org.elasticsearch.common.settings.Settings.Builder
Enclosing class:
Settings

public static class Settings.Builder extends Object
A builder allowing to put different settings and then build() an immutable settings implementation. Use Settings.builder() in order to construct it.
  • Method Details

    • keys

      public Set<String> keys()
    • remove

      public String remove(String key)
      Removes the provided setting from the internal map holding the current list of settings.
    • get

      public String get(String key)
      Returns a setting value based on the setting key.
    • getSecureSettings

      public SecureSettings getSecureSettings()
      Return the current secure settings, or null if none have been set.
    • setSecureSettings

      public Settings.Builder setSecureSettings(SecureSettings secureSettings)
    • put

      public Settings.Builder put(String key, Path path)
      Sets a path setting with the provided setting key and path.
      Parameters:
      key - The setting key
      path - The setting path
      Returns:
      The builder
    • put

      public Settings.Builder put(String key, org.elasticsearch.core.TimeValue timeValue)
      Sets a time value setting with the provided setting key and value.
      Parameters:
      key - The setting key
      timeValue - The setting timeValue
      Returns:
      The builder
    • put

      public Settings.Builder put(String key, ByteSizeValue byteSizeValue)
      Sets a byteSizeValue setting with the provided setting key and byteSizeValue.
      Parameters:
      key - The setting key
      byteSizeValue - The setting value
      Returns:
      The builder
    • put

      public Settings.Builder put(String key, Enum<?> enumValue)
      Sets an enum setting with the provided setting key and enum instance.
      Parameters:
      key - The setting key
      enumValue - The setting value
      Returns:
      The builder
    • put

      public Settings.Builder put(String key, org.apache.logging.log4j.Level level)
      Sets an level setting with the provided setting key and level instance.
      Parameters:
      key - The setting key
      level - The setting value
      Returns:
      The builder
    • put

      public Settings.Builder put(String key, org.apache.lucene.util.Version luceneVersion)
      Sets an lucene version setting with the provided setting key and lucene version instance.
      Parameters:
      key - The setting key
      luceneVersion - The setting value
      Returns:
      The builder
    • put

      public Settings.Builder put(String key, String value)
      Sets a setting with the provided setting key and value.
      Parameters:
      key - The setting key
      value - The setting value
      Returns:
      The builder
    • copy

      public Settings.Builder copy(String key, Settings source)
    • copy

      public Settings.Builder copy(String key, String sourceKey, Settings source)
    • putNull

      public Settings.Builder putNull(String key)
      Sets a null value for the given setting key
    • put

      public Settings.Builder put(String setting, boolean value)
      Sets the setting with the provided setting key and the boolean value.
      Parameters:
      setting - The setting key
      value - The boolean value
      Returns:
      The builder
    • put

      public Settings.Builder put(String setting, int value)
      Sets the setting with the provided setting key and the int value.
      Parameters:
      setting - The setting key
      value - The int value
      Returns:
      The builder
    • put

      public Settings.Builder put(String setting, Version version)
    • put

      public Settings.Builder put(String setting, long value)
      Sets the setting with the provided setting key and the long value.
      Parameters:
      setting - The setting key
      value - The long value
      Returns:
      The builder
    • put

      public Settings.Builder put(String setting, float value)
      Sets the setting with the provided setting key and the float value.
      Parameters:
      setting - The setting key
      value - The float value
      Returns:
      The builder
    • put

      public Settings.Builder put(String setting, double value)
      Sets the setting with the provided setting key and the double value.
      Parameters:
      setting - The setting key
      value - The double value
      Returns:
      The builder
    • put

      public Settings.Builder put(String setting, long value, TimeUnit timeUnit)
      Sets the setting with the provided setting key and the time value.
      Parameters:
      setting - The setting key
      value - The time value
      Returns:
      The builder
    • put

      public Settings.Builder put(String setting, long value, ByteSizeUnit sizeUnit)
      Sets the setting with the provided setting key and the size value.
      Parameters:
      setting - The setting key
      value - The size value
      Returns:
      The builder
    • putList

      public Settings.Builder putList(String setting, String... values)
      Sets the setting with the provided setting key and an array of values.
      Parameters:
      setting - The setting key
      values - The values
      Returns:
      The builder
    • putList

      public Settings.Builder putList(String setting, List<String> values)
      Sets the setting with the provided setting key and a list of values.
      Parameters:
      setting - The setting key
      values - The values
      Returns:
      The builder
    • put

      public Settings.Builder put(Settings settings)
      Sets all the provided settings including secure settings
    • put

      public Settings.Builder put(Settings settings, boolean copySecureSettings)
      Sets all the provided settings.
      Parameters:
      settings - the settings to set
      copySecureSettings - if true all settings including secure settings are copied.
    • loadFromMap

      public Settings.Builder loadFromMap(Map<String,?> map)
      Loads settings from a map.
    • loadFromSource

      public Settings.Builder loadFromSource(String source, org.elasticsearch.xcontent.XContentType xContentType)
      Loads settings from the actual string content that represents them using Settings.fromXContent(XContentParser)
    • loadFromPath

      public Settings.Builder loadFromPath(Path path) throws IOException
      Loads settings from a url that represents them using Settings.fromXContent(XContentParser) Note: Loading from a path doesn't allow null values in the incoming xcontent
      Throws:
      IOException
    • loadFromStream

      public Settings.Builder loadFromStream(String resourceName, InputStream is, boolean acceptNullValues) throws IOException
      Loads settings from a stream that represents them using Settings.fromXContent(XContentParser)
      Throws:
      IOException
    • putProperties

      public Settings.Builder putProperties(Map<String,String> esSettings, Function<String,String> keyFunction)
    • replacePropertyPlaceholders

      public Settings.Builder replacePropertyPlaceholders()
      Runs across all the settings set on this builder and replaces ${...} elements in each setting with another setting already set on this builder.
    • normalizePrefix

      public Settings.Builder normalizePrefix(String prefix)
      Checks that all settings in the builder start with the specified prefix. If a setting doesn't start with the prefix, the builder appends the prefix to such setting.
    • build

      public Settings build()
      Builds a Settings (underlying uses Settings) based on everything set on this builder.