public SimulateProcessorResult(String processorTag, IngestDocument ingestDocument, Exception failure) { this.processorTag = processorTag; this.ingestDocument = (ingestDocument == null) ? null : new WriteableIngestDocument(ingestDocument); this.failure = failure; }
public IngestDocument getIngestDocument() { if (ingestDocument == null) { return null; } return ingestDocument.getIngestDocument(); }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(); if (failure == null) { ingestDocument.toXContent(builder, params); } else { ElasticsearchException.generateFailureXContent(builder, params, failure, true); } builder.endObject(); return builder; }
@Override public void writeTo(StreamOutput out) throws IOException { if (failure == null) { out.writeBoolean(false); ingestDocument.writeTo(out); } else { out.writeBoolean(true); out.writeException(failure); } }
@Override public void writeTo(StreamOutput out) throws IOException { out.writeString(processorTag); if (ingestDocument == null) { out.writeBoolean(false); } else { out.writeBoolean(true); ingestDocument.writeTo(out); } out.writeException(failure); }
public SimulateDocumentBaseResult(IngestDocument ingestDocument) { this.ingestDocument = new WriteableIngestDocument(ingestDocument); failure = null; }
@Override public void writeTo(StreamOutput out) throws IOException { if (failure == null) { out.writeBoolean(false); ingestDocument.writeTo(out); } else { out.writeBoolean(true); out.writeException(failure); } }
public IngestDocument getIngestDocument() { if (ingestDocument == null) { return null; } return ingestDocument.getIngestDocument(); }
@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 != null) { builder.startObject(IGNORED_ERROR_FIELD); ElasticsearchException.generateFailureXContent(builder, params, failure, true); builder.endObject(); } else if (failure != null) { ElasticsearchException.generateFailureXContent(builder, params, failure, true); } if (ingestDocument != null) { ingestDocument.toXContent(builder, params); } builder.endObject(); return builder; }
/** * Read from a stream. */ public SimulateDocumentBaseResult(StreamInput in) throws IOException { if (in.readBoolean()) { ingestDocument = null; failure = in.readException(); } else { ingestDocument = new WriteableIngestDocument(in); failure = null; } }
@Override public void writeTo(StreamOutput out) throws IOException { if (failure == null) { out.writeBoolean(false); ingestDocument.writeTo(out); } else { out.writeBoolean(true); out.writeException(failure); } }
public IngestDocument getIngestDocument() { if (ingestDocument == null) { return null; } return ingestDocument.getIngestDocument(); }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(); if (failure == null) { ingestDocument.toXContent(builder, params); } else { ElasticsearchException.generateFailureXContent(builder, params, failure, true); } builder.endObject(); return builder; } }
/** * Read from a stream. */ SimulateProcessorResult(StreamInput in) throws IOException { this.processorTag = in.readString(); if (in.readBoolean()) { this.ingestDocument = new WriteableIngestDocument(in); } else { this.ingestDocument = null; } this.failure = in.readException(); }
@Override public void writeTo(StreamOutput out) throws IOException { if (failure == null) { out.writeBoolean(false); ingestDocument.writeTo(out); } else { out.writeBoolean(true); out.writeException(failure); } }
public IngestDocument getIngestDocument() { if (ingestDocument == null) { return null; } return ingestDocument.getIngestDocument(); }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(); if (failure == null) { ingestDocument.toXContent(builder, params); } else { ElasticsearchException.generateFailureXContent(builder, params, failure, true); } builder.endObject(); return builder; }
public SimulateDocumentBaseResult(IngestDocument ingestDocument) { this.ingestDocument = new WriteableIngestDocument(ingestDocument); failure = null; }
@Override public void writeTo(StreamOutput out) throws IOException { out.writeString(processorTag); if (ingestDocument == null) { out.writeBoolean(false); } else { out.writeBoolean(true); ingestDocument.writeTo(out); } out.writeException(failure); }
public IngestDocument getIngestDocument() { if (ingestDocument == null) { return null; } return ingestDocument.getIngestDocument(); }