diff --git a/src/main/java/org/elasticsearch/action/update/UpdateRequest.java b/src/main/java/org/elasticsearch/action/update/UpdateRequest.java index c8d23c69800..a01beb7fc60 100644 --- a/src/main/java/org/elasticsearch/action/update/UpdateRequest.java +++ b/src/main/java/org/elasticsearch/action/update/UpdateRequest.java @@ -20,6 +20,7 @@ package org.elasticsearch.action.update; import com.google.common.collect.Maps; +import org.elasticsearch.Version; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.WriteConsistencyLevel; import org.elasticsearch.action.index.IndexRequest; @@ -610,8 +611,12 @@ public class UpdateRequest extends InstanceShardOperationRequest id = in.readString(); routing = in.readOptionalString(); script = in.readOptionalString(); - if( Strings.hasLength(script)) { - scriptType = ScriptService.ScriptType.readFrom(in); + if(Strings.hasLength(script)) { + if (in.getVersion().onOrAfter(Version.V_1_3_0)) { + scriptType = ScriptService.ScriptType.readFrom(in); + } else { + scriptType = null; + } } scriptLang = in.readOptionalString(); scriptParams = in.readMap();