Browse Source

Update geolite2 database in ingest geoip plugin (#33840)

* Update geolite2 database in ingest geoip plugin

* Fix integration tests
Nick Peihl 7 years ago
parent
commit
b9e2b5cfec

+ 1 - 1
plugins/ingest-geoip/build.gradle

@@ -30,7 +30,7 @@ dependencies {
   compile("com.fasterxml.jackson.core:jackson-databind:${versions.jackson}")
   compile('com.maxmind.db:maxmind-db:1.2.2')
 
-  testCompile 'org.elasticsearch:geolite2-databases:20180303'
+  testCompile 'org.elasticsearch:geolite2-databases:20180911'
 }
 
 task copyDefaultGeoIp2DatabaseFiles(type: Copy) {

+ 4 - 4
plugins/ingest-geoip/src/test/java/org/elasticsearch/ingest/geoip/GeoIpProcessorTests.java

@@ -134,8 +134,8 @@ public class GeoIpProcessorTests extends ESTestCase {
         assertThat(geoData.get("city_name"), equalTo("Hollywood"));
         assertThat(geoData.get("timezone"), equalTo("America/New_York"));
         Map<String, Object> location = new HashMap<>();
-        location.put("lat", 26.0252d);
-        location.put("lon", -80.296d);
+        location.put("lat", 25.9825d);
+        location.put("lon", -80.3434d);
         assertThat(geoData.get("location"), equalTo(location));
     }
 
@@ -197,7 +197,7 @@ public class GeoIpProcessorTests extends ESTestCase {
     }
 
     public void testAsn() throws Exception {
-        String ip = "82.170.213.79";
+        String ip = "82.171.64.0";
         InputStream database = getDatabaseFileInputStream("/GeoLite2-ASN.mmdb");
         GeoIpProcessor processor = new GeoIpProcessor(randomAlphaOfLength(10), "source_field",
             new DatabaseReader.Builder(database).build(), "target_field", EnumSet.allOf(GeoIpProcessor.Property.class), false,
@@ -213,7 +213,7 @@ public class GeoIpProcessorTests extends ESTestCase {
         Map<String, Object> geoData = (Map<String, Object>) ingestDocument.getSourceAndMetadata().get("target_field");
         assertThat(geoData.size(), equalTo(3));
         assertThat(geoData.get("ip"), equalTo(ip));
-        assertThat(geoData.get("asn"), equalTo(5615));
+        assertThat(geoData.get("asn"), equalTo(1136));
         assertThat(geoData.get("organization_name"), equalTo("KPN B.V."));
     }
 

+ 10 - 10
plugins/ingest-geoip/src/test/resources/rest-api-spec/test/ingest_geoip/20_geoip_processor.yml

@@ -33,8 +33,8 @@
   - length: { _source.geoip: 6 }
   - match: { _source.geoip.city_name: "Minneapolis" }
   - match: { _source.geoip.country_iso_code: "US" }
-  - match: { _source.geoip.location.lon: -93.2166 }
-  - match: { _source.geoip.location.lat: 44.9759 }
+  - match: { _source.geoip.location.lon: -93.2323 }
+  - match: { _source.geoip.location.lat: 44.9733 }
   - match: { _source.geoip.region_iso_code: "US-MN" }
   - match: { _source.geoip.region_name: "Minnesota" }
   - match: { _source.geoip.continent_name: "North America" }
@@ -80,8 +80,8 @@
   - match: { _source.geoip.city_name: "Minneapolis" }
   - match: { _source.geoip.country_iso_code: "US" }
   - match: { _source.geoip.ip: "128.101.101.101" }
-  - match: { _source.geoip.location.lon: -93.2166 }
-  - match: { _source.geoip.location.lat: 44.9759 }
+  - match: { _source.geoip.location.lon: -93.2323 }
+  - match: { _source.geoip.location.lat: 44.9733 }
   - match: { _source.geoip.timezone: "America/Chicago" }
   - match: { _source.geoip.country_name: "United States" }
   - match: { _source.geoip.region_iso_code: "US-MN" }
@@ -193,8 +193,8 @@
   - length: { _source.geoip: 6 }
   - match: { _source.geoip.city_name: "Minneapolis" }
   - match: { _source.geoip.country_iso_code: "US" }
-  - match: { _source.geoip.location.lon: -93.2166 }
-  - match: { _source.geoip.location.lat: 44.9759 }
+  - match: { _source.geoip.location.lon: -93.2323 }
+  - match: { _source.geoip.location.lat: 44.9733 }
   - match: { _source.geoip.region_iso_code: "US-MN" }
   - match: { _source.geoip.region_name: "Minnesota" }
   - match: { _source.geoip.continent_name: "North America" }
@@ -224,15 +224,15 @@
         type: test
         id: 1
         pipeline: "my_pipeline"
-        body: {field1: "82.170.213.79"}
+        body: {field1: "82.171.64.0"}
 
   - do:
       get:
         index: test
         type: test
         id: 1
-  - match: { _source.field1: "82.170.213.79" }
+  - match: { _source.field1: "82.171.64.0" }
   - length: { _source.geoip: 3 }
-  - match: { _source.geoip.ip: "82.170.213.79" }
-  - match: { _source.geoip.asn: 5615 }
+  - match: { _source.geoip.ip: "82.171.64.0" }
+  - match: { _source.geoip.asn: 1136 }
   - match: { _source.geoip.organization_name: "KPN B.V." }