diff --git a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/ForEachProcessor.java b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/ForEachProcessor.java index 92804dc0513..e5a720011a5 100644 --- a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/ForEachProcessor.java +++ b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/ForEachProcessor.java @@ -23,18 +23,13 @@ import org.elasticsearch.ingest.AbstractProcessor; import org.elasticsearch.ingest.ConfigurationUtils; import org.elasticsearch.ingest.IngestDocument; import org.elasticsearch.ingest.Processor; -import org.elasticsearch.ingest.Processor; import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import static org.elasticsearch.ingest.ConfigurationUtils.newConfigurationException; -import static org.elasticsearch.ingest.ConfigurationUtils.readList; import static org.elasticsearch.ingest.ConfigurationUtils.readMap; import static org.elasticsearch.ingest.ConfigurationUtils.readStringProperty; @@ -59,7 +54,7 @@ public final class ForEachProcessor extends AbstractProcessor { @Override public void execute(IngestDocument ingestDocument) throws Exception { - List values = ingestDocument.getFieldValue(field, List.class); + List values = ingestDocument.getFieldValue(field, List.class); List newValues = new ArrayList<>(values.size()); for (Object value : values) { Object previousValue = ingestDocument.getIngestMetadata().put("_value", value); diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ForEachProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ForEachProcessorTests.java index 524b131c787..7a7b59bad26 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ForEachProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ForEachProcessorTests.java @@ -53,7 +53,7 @@ public class ForEachProcessorTests extends ESTestCase { ); processor.execute(ingestDocument); - List result = ingestDocument.getFieldValue("values", List.class); + List result = ingestDocument.getFieldValue("values", List.class); assertThat(result.get(0), equalTo("FOO")); assertThat(result.get(1), equalTo("BAR")); assertThat(result.get(2), equalTo("BAZ")); @@ -176,9 +176,9 @@ public class ForEachProcessorTests extends ESTestCase { ForEachProcessor processor = new ForEachProcessor("_tag", "values", innerProcessor); processor.execute(ingestDocument); + @SuppressWarnings("unchecked") List result = ingestDocument.getFieldValue("values", List.class); assertThat(result.size(), equalTo(numValues)); - for (String r : result) { assertThat(r, equalTo(".")); } @@ -203,12 +203,12 @@ public class ForEachProcessorTests extends ESTestCase { )); processor.execute(ingestDocument); - List result = ingestDocument.getFieldValue("values", List.class); + List result = ingestDocument.getFieldValue("values", List.class); assertThat(result.get(0), equalTo("STRING")); assertThat(result.get(1), equalTo(1)); assertThat(result.get(2), equalTo(null)); - List errors = ingestDocument.getFieldValue("errors", List.class); + List errors = ingestDocument.getFieldValue("errors", List.class); assertThat(errors.size(), equalTo(2)); } @@ -229,7 +229,7 @@ public class ForEachProcessorTests extends ESTestCase { ForEachProcessor forEachProcessor = new ForEachProcessor("_tag", "values", processor); forEachProcessor.execute(ingestDocument); - List result = ingestDocument.getFieldValue("values", List.class); + List result = ingestDocument.getFieldValue("values", List.class); assertThat(result.get(0), equalTo("new_value")); assertThat(result.get(1), equalTo("new_value")); assertThat(result.get(2), equalTo("new_value")); @@ -262,7 +262,7 @@ public class ForEachProcessorTests extends ESTestCase { "_tag", "values1", new ForEachProcessor("_tag", "_ingest._value.values2", testProcessor)); processor.execute(ingestDocument); - List result = ingestDocument.getFieldValue("values1.0.values2", List.class); + List result = ingestDocument.getFieldValue("values1.0.values2", List.class); assertThat(result.get(0), equalTo("ABC")); assertThat(result.get(1), equalTo("DEF"));