Search in sources :

Example 1 with NumberOfReplicas

use of io.crate.analyze.NumberOfReplicas in project crate by crate.

the class NumberOfReplicasSetting method parseValue.

private static Settings parseValue(String val) {
    Settings.Builder builder = Settings.builder();
    NumberOfReplicas numberOfReplicas;
    try {
        Integer numReplicas = parseInt(val, 0, NAME);
        numberOfReplicas = new NumberOfReplicas(numReplicas);
    } catch (NumberFormatException e) {
        numberOfReplicas = new NumberOfReplicas(val);
    }
    // in case the number_of_replicas is changing from auto_expand to a fixed number -> disable auto expand
    builder.put(AutoExpandReplicas.SETTING.getKey(), false);
    builder.put(numberOfReplicas.esSettingKey(), numberOfReplicas.esSettingValue());
    return builder.build();
}
Also used : Settings(org.elasticsearch.common.settings.Settings) NumberOfReplicas(io.crate.analyze.NumberOfReplicas)

Aggregations

NumberOfReplicas (io.crate.analyze.NumberOfReplicas)1 Settings (org.elasticsearch.common.settings.Settings)1