@@ -66,6 +66,59 @@ public void testIgnoreMissing() throws Exception {
6666 processor .execute (document );
6767 }
6868
69+ public void testIgnoreMissingAndNullInPath () throws Exception {
70+ Map <String , Object > source = new HashMap <>();
71+ Map <String , Object > some = new HashMap <>();
72+ Map <String , Object > map = new HashMap <>();
73+ Map <String , Object > path = new HashMap <>();
74+
75+ switch (randomIntBetween (0 , 6 )) {
76+ case 0 -> {
77+ // empty source
78+ }
79+ case 1 -> {
80+ source .put ("some" , null );
81+ }
82+ case 2 -> {
83+ some .put ("map" , null );
84+ source .put ("some" , some );
85+ }
86+ case 3 -> {
87+ some .put ("map" , map );
88+ source .put ("some" , some );
89+ }
90+ case 4 -> {
91+ map .put ("path" , null );
92+ some .put ("map" , map );
93+ source .put ("some" , some );
94+ }
95+ case 5 -> {
96+ map .put ("path" , path );
97+ some .put ("map" , map );
98+ source .put ("some" , some );
99+ }
100+ case 6 -> {
101+ map .put ("path" , "foobar" );
102+ some .put ("map" , map );
103+ source .put ("some" , some );
104+ }
105+ }
106+
107+ if (randomBoolean ()) {
108+ source .put ("some" , null );
109+ } else {
110+ some .put ("map" , null );
111+ source .put ("some" , some );
112+ }
113+ IngestDocument document = RandomDocumentPicks .randomIngestDocument (random (), source );
114+ Map <String , Object > config = new HashMap <>();
115+ config .put ("field" , "some.map.path" );
116+ config .put ("ignore_missing" , true );
117+ Processor processor = new RemoveProcessor .Factory (TestTemplateService .instance ()).create (null , null , null , config , null );
118+ processor .execute (document );
119+ assertThat (document .hasField ("some.map.path" ), is (false ));
120+ }
121+
69122 public void testKeepFields () throws Exception {
70123 Map <String , Object > address = new HashMap <>();
71124 address .put ("street" , "Ipiranga Street" );
0 commit comments