diff --git a/plugins/ingest/src/main/java/org/elasticsearch/ingest/IngestDocument.java b/plugins/ingest/src/main/java/org/elasticsearch/ingest/IngestDocument.java index 1077b16453b..8eed959f1f4 100644 --- a/plugins/ingest/src/main/java/org/elasticsearch/ingest/IngestDocument.java +++ b/plugins/ingest/src/main/java/org/elasticsearch/ingest/IngestDocument.java @@ -36,8 +36,6 @@ public final class IngestDocument { private final Map source; private final Map ingestMetadata; - private boolean sourceModified = false; - public IngestDocument(String index, String type, String id, String routing, String parent, String timestamp, String ttl, Map source) { this.esMetadata = new HashMap<>(); this.esMetadata.put(MetaData.INDEX.getFieldName(), index); @@ -190,7 +188,6 @@ public final class IngestDocument { Map map = (Map) context; if (map.containsKey(leafKey)) { map.remove(leafKey); - this.sourceModified = true; return; } throw new IllegalArgumentException("field [" + leafKey + "] not present as part of path [" + path + "]"); @@ -208,7 +205,6 @@ public final class IngestDocument { throw new IllegalArgumentException("[" + index + "] is out of bounds for array with length [" + list.size() + "] as part of path [" + path + "]"); } list.remove(index); - this.sourceModified = true; return; } @@ -292,7 +288,6 @@ public final class IngestDocument { } else { HashMap newMap = new HashMap<>(); map.put(pathElement, newMap); - sourceModified = true; context = newMap; } } else if (context instanceof List) { @@ -327,13 +322,11 @@ public final class IngestDocument { @SuppressWarnings("unchecked") List list = (List) object; list.add(value); - sourceModified = true; return; } } } map.put(leafKey, value); - sourceModified = true; } else if (context instanceof List) { @SuppressWarnings("unchecked") List list = (List) context; @@ -347,7 +340,6 @@ public final class IngestDocument { throw new IllegalArgumentException("[" + index + "] is out of bounds for array with length [" + list.size() + "] as part of path [" + path + "]"); } list.set(index, value); - this.sourceModified = true; } else { throw new IllegalArgumentException("cannot set [" + leafKey + "] with parent object of type [" + context.getClass().getName() + "] as part of path [" + path + "]"); } @@ -386,10 +378,6 @@ public final class IngestDocument { return source; } - public boolean isSourceModified() { - return sourceModified; - } - static Object deepCopy(Object value) { if (value instanceof Map) { @SuppressWarnings("unchecked") diff --git a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/PipelineExecutionService.java b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/PipelineExecutionService.java index b94dbd391cd..d155ed543c3 100644 --- a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/PipelineExecutionService.java +++ b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/PipelineExecutionService.java @@ -62,9 +62,7 @@ public class PipelineExecutionService { IngestDocument ingestDocument = new IngestDocument(index, type, id, routing, parent, timestamp, ttl, sourceAsMap); try { pipeline.execute(ingestDocument); - if (ingestDocument.isSourceModified()) { - indexRequest.source(ingestDocument.getSource()); - } + indexRequest.source(ingestDocument.getSource()); indexRequest.index(ingestDocument.getEsMetadata(IngestDocument.MetaData.INDEX)); indexRequest.type(ingestDocument.getEsMetadata(IngestDocument.MetaData.TYPE)); indexRequest.id(ingestDocument.getEsMetadata(IngestDocument.MetaData.ID)); diff --git a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/simulate/WriteableIngestDocument.java b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/simulate/WriteableIngestDocument.java index 4f0b2eeee60..0f66206848d 100644 --- a/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/simulate/WriteableIngestDocument.java +++ b/plugins/ingest/src/main/java/org/elasticsearch/plugin/ingest/transport/simulate/WriteableIngestDocument.java @@ -74,7 +74,6 @@ final class WriteableIngestDocument implements Writeable esMetadata : ingestDocument.getEsMetadata().entrySet()) { builder.field(esMetadata.getKey(), esMetadata.getValue()); } @@ -112,7 +111,6 @@ final class WriteableIngestDocument implements Writeable