Update geolite2 database in ingest geoip plugin. (#49308)

Some tests were tweaked to deal with the updated database files.
This commit is contained in:
Martijn van Groningen 2019-11-22 08:38:29 +01:00
parent c239a6a493
commit 2243743450
No known key found for this signature in database
GPG Key ID: AB236F4FCF2AF12A
3 changed files with 12 additions and 11 deletions

View File

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

View File

@ -55,11 +55,12 @@ public class GeoIpProcessorTests extends ESTestCase {
assertThat(ingestDocument.getSourceAndMetadata().get("source_field"), equalTo("8.8.8.8"));
@SuppressWarnings("unchecked")
Map<String, Object> geoData = (Map<String, Object>) ingestDocument.getSourceAndMetadata().get("target_field");
assertThat(geoData.size(), equalTo(5));
assertThat(geoData.size(), equalTo(6));
assertThat(geoData.get("ip"), equalTo("8.8.8.8"));
assertThat(geoData.get("country_iso_code"), equalTo("US"));
assertThat(geoData.get("country_name"), equalTo("United States"));
assertThat(geoData.get("continent_name"), equalTo("North America"));
assertThat(geoData.get("timezone"), equalTo("America/Chicago"));
Map<String, Object> location = new HashMap<>();
location.put("lat", 37.751d);
location.put("lon", -97.822d);
@ -129,11 +130,11 @@ public class GeoIpProcessorTests extends ESTestCase {
assertThat(geoData.get("continent_name"), equalTo("North America"));
assertThat(geoData.get("region_iso_code"), equalTo("US-FL"));
assertThat(geoData.get("region_name"), equalTo("Florida"));
assertThat(geoData.get("city_name"), equalTo("Hollywood"));
assertThat(geoData.get("city_name"), equalTo("Homestead"));
assertThat(geoData.get("timezone"), equalTo("America/New_York"));
Map<String, Object> location = new HashMap<>();
location.put("lat", 25.9825d);
location.put("lon", -80.3434d);
location.put("lat", 25.4573d);
location.put("lon", -80.4572d);
assertThat(geoData.get("location"), equalTo(location));
}

View File

@ -31,8 +31,8 @@
- length: { _source.geoip: 6 }
- match: { _source.geoip.city_name: "Minneapolis" }
- match: { _source.geoip.country_iso_code: "US" }
- match: { _source.geoip.location.lon: -93.2323 }
- match: { _source.geoip.location.lat: 44.9733 }
- match: { _source.geoip.location.lon: -93.2548 }
- match: { _source.geoip.location.lat: 44.9399 }
- match: { _source.geoip.region_iso_code: "US-MN" }
- match: { _source.geoip.region_name: "Minnesota" }
- match: { _source.geoip.continent_name: "North America" }
@ -76,8 +76,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.2323 }
- match: { _source.geoip.location.lat: 44.9733 }
- match: { _source.geoip.location.lon: -93.2548 }
- match: { _source.geoip.location.lat: 44.9399 }
- match: { _source.geoip.timezone: "America/Chicago" }
- match: { _source.geoip.country_name: "United States" }
- match: { _source.geoip.region_iso_code: "US-MN" }
@ -181,8 +181,8 @@
- length: { _source.geoip: 6 }
- match: { _source.geoip.city_name: "Minneapolis" }
- match: { _source.geoip.country_iso_code: "US" }
- match: { _source.geoip.location.lon: -93.2323 }
- match: { _source.geoip.location.lat: 44.9733 }
- match: { _source.geoip.location.lon: -93.2548 }
- match: { _source.geoip.location.lat: 44.9399 }
- match: { _source.geoip.region_iso_code: "US-MN" }
- match: { _source.geoip.region_name: "Minnesota" }
- match: { _source.geoip.continent_name: "North America" }