From e52a873d1aaeaa955a20e018d61954c8af610485 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Mon, 18 Jan 2016 12:59:42 +0100 Subject: [PATCH] Restrict index.codec to default and best_compression --- .../org/elasticsearch/index/engine/EngineConfig.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/index/engine/EngineConfig.java b/core/src/main/java/org/elasticsearch/index/engine/EngineConfig.java index 1b06e086a49..0a2807c794f 100644 --- a/core/src/main/java/org/elasticsearch/index/engine/EngineConfig.java +++ b/core/src/main/java/org/elasticsearch/index/engine/EngineConfig.java @@ -69,12 +69,19 @@ public final class EngineConfig { * Index setting to change the low level lucene codec used for writing new segments. * This setting is not realtime updateable. */ - public static final Setting INDEX_CODEC_SETTING = new Setting<>("index.codec", EngineConfig.DEFAULT_CODEC_NAME, (s) -> { if (s.isEmpty()) {throw new IllegalArgumentException("index.codec must not be empty");} return s;}, false, Setting.Scope.INDEX); + public static final Setting INDEX_CODEC_SETTING = new Setting<>("index.codec", "default", (s) -> { + switch(s) { + case "default": + case "best_compression": + return s; + default: + throw new IllegalArgumentException("unknown value for [index.codec] must be one of [default, best_compression]"); + } + }, false, Setting.Scope.INDEX); /** if set to true the engine will start even if the translog id in the commit point can not be found */ public static final String INDEX_FORCE_NEW_TRANSLOG = "index.engine.force_new_translog"; - private static final String DEFAULT_CODEC_NAME = "default"; private TranslogConfig translogConfig; private boolean create = false;