@Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeString(processorTag);
   if (failure == null) {
     out.writeBoolean(false);
     ingestDocument.writeTo(out);
   } else {
     out.writeBoolean(true);
     out.writeThrowable(failure);
   }
 }
 @Override
 public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
   builder.startObject();
   if (processorTag != null) {
     builder.field(ConfigurationUtils.TAG_KEY, processorTag);
   }
   if (failure == null) {
     ingestDocument.toXContent(builder, params);
   } else {
     ElasticsearchException.renderException(builder, params, failure);
   }
   builder.endObject();
   return builder;
 }
 public IngestDocument getIngestDocument() {
   if (ingestDocument == null) {
     return null;
   }
   return ingestDocument.getIngestDocument();
 }