From a08afb8d9a0d201709ec8594e892dd77162c324e Mon Sep 17 00:00:00 2001 From: Stuart Tettemer Date: Wed, 13 Jul 2022 13:03:49 -0500 Subject: [PATCH] Don't copy source --- .../main/java/org/elasticsearch/ingest/IngestCtxMap.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/ingest/IngestCtxMap.java b/server/src/main/java/org/elasticsearch/ingest/IngestCtxMap.java index b648051669567..e3cdc13e1c11e 100644 --- a/server/src/main/java/org/elasticsearch/ingest/IngestCtxMap.java +++ b/server/src/main/java/org/elasticsearch/ingest/IngestCtxMap.java @@ -13,7 +13,6 @@ import org.elasticsearch.script.Metadata; import java.time.ZonedDateTime; -import java.util.HashMap; import java.util.Map; /** @@ -32,7 +31,9 @@ class IngestCtxMap extends CtxMap { /** - * Create an IngestCtxMap with the given metadata, source and default validators + * Create an IngestCtxMap with the given metadata, source and default validators. + * + * Source is not copied, callers can observe changes to source. */ IngestCtxMap( String index, @@ -43,7 +44,7 @@ class IngestCtxMap extends CtxMap { ZonedDateTime timestamp, Map source ) { - super(new HashMap<>(source), new IngestDocMetadata(index, id, version, routing, versionType, timestamp)); + super(source, new IngestDocMetadata(index, id, version, routing, versionType, timestamp)); } /**