@Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeString(STREAM.getName());
   out.writeOptionalString(scriptLang);
   out.writeString(scriptString);
   ScriptService.ScriptType.writeTo(scriptType, out);
   out.writeMap(params);
 }
 @Override
 public final void writeTo(StreamOutput out) throws IOException {
   out.writeString(
       name); // NORELEASE remote writing the name - it is automatically handled with
              // writeNamedWriteable
   out.writeStringArray(bucketsPaths);
   out.writeMap(metaData);
   doWriteTo(out);
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeOptionalString(name);
   out.writeOptionalString(type);
   out.writeLong(started.getTime());
   out.writeLong(timestamp.getTime());
   out.writeBoolean(enabled);
   out.writeBoolean(active);
   out.writeLong(counter);
   out.writeMap(custom);
 }
 @Override
 protected void doWriteTo(StreamOutput out) throws IOException {
   out.writeOptionalWriteable(initScript);
   out.writeOptionalWriteable(mapScript);
   out.writeOptionalWriteable(combineScript);
   out.writeOptionalWriteable(reduceScript);
   boolean hasParams = params != null;
   out.writeBoolean(hasParams);
   if (hasParams) {
     out.writeMap(params);
   }
 }