File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
modules/ingest-geoip/src/test/java/org/elasticsearch/ingest/geoip Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -549,6 +549,7 @@ public void testDatabaseNotReadyYet() throws Exception {
549549 Map <String , Object > config = new HashMap <>();
550550 config .put ("field" , "source_field" );
551551 config .put ("database_file" , "GeoLite2-City.mmdb" );
552+ config .put ("ignore_missing" , true );
552553
553554 GeoIpProcessor .DatabaseUnavailableProcessor processor = (GeoIpProcessor .DatabaseUnavailableProcessor ) factory .create (
554555 null ,
@@ -565,6 +566,13 @@ public void testDatabaseNotReadyYet() throws Exception {
565566 assertThat (document .getSourceAndMetadata ().get ("geoip" ), nullValue ());
566567 assertThat (document .getSourceAndMetadata ().get ("tags" ), equalTo (List .of ("_geoip_database_unavailable_GeoLite2-City.mmdb" )));
567568 }
569+ {
570+ // if there's no value for the source_field and ignore_missing is true, then we don't tag the document
571+ document = RandomDocumentPicks .randomIngestDocument (random (), new HashMap <>()); // note: no source_field
572+ processor .execute (document );
573+ assertThat (document .getSourceAndMetadata ().get ("geoip" ), nullValue ());
574+ assertThat (document .getSourceAndMetadata ().get ("tags" ), nullValue ());
575+ }
568576 }
569577
570578 copyDatabase ("GeoLite2-City-Test.mmdb" , geoipTmpDir );
You can’t perform that action at this time.
0 commit comments