diff --git a/src/main/java/org/elasticsearch/rest/RestRequest.java b/src/main/java/org/elasticsearch/rest/RestRequest.java index efd411e3742..8af99546940 100644 --- a/src/main/java/org/elasticsearch/rest/RestRequest.java +++ b/src/main/java/org/elasticsearch/rest/RestRequest.java @@ -136,11 +136,7 @@ public abstract class RestRequest implements ToXContent.Params { @Override public Boolean paramAsBooleanOptional(String key, Boolean defaultValue) { - String sValue = param(key); - if (sValue == null) { - return defaultValue; - } - return !(sValue.equals("false") || sValue.equals("0") || sValue.equals("off")); + return Booleans.parseBoolean(param(key), defaultValue); } public TimeValue paramAsTime(String key, TimeValue defaultValue) {