File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
modules/ingest-ecs/src/main/java/org/elasticsearch/ingest/ecs Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 1111
1212import org .elasticsearch .cluster .metadata .ProjectId ;
1313import org .elasticsearch .common .util .Maps ;
14- import org .elasticsearch .common .util .set .Sets ;
1514import org .elasticsearch .ingest .AbstractProcessor ;
1615import org .elasticsearch .ingest .IngestDocument ;
1716import org .elasticsearch .ingest .Processor ;
@@ -131,17 +130,20 @@ public IngestDocument execute(IngestDocument document) {
131130 renameSpecialKeys (document );
132131
133132 // Iterate through all top level keys and move them to the appropriate namespace
134- for (String key : Sets .newHashSet (source .keySet ())) {
133+ final var sourceItr = source .entrySet ().iterator ();
134+ while (sourceItr .hasNext ()) {
135+ final var entry = sourceItr .next ();
136+ final var key = entry .getKey ();
137+ final var value = entry .getValue ();
135138 if (KEEP_KEYS .contains (key )) {
136139 continue ;
137140 }
138141 if (shouldMoveToResourceAttributes (key )) {
139- Object value = source .remove (key );
140142 newResourceAttributes .put (key , value );
141143 } else {
142- Object value = source .remove (key );
143144 newAttributes .put (key , value );
144145 }
146+ sourceItr .remove ();
145147 }
146148
147149 // Flatten attributes
You can’t perform that action at this time.
0 commit comments