diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapper.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapper.java index 905b8190113..66456c5bdf2 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapper.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/geo/GeoPointFieldMapper.java @@ -382,18 +382,8 @@ public class GeoPointFieldMapper implements Mapper, ArrayValueMapperParser { geohashMapper.parse(context); } if (enableLatLon) { - if (validateLat) { - if (lat > 90.0 || lat < -90.0) { - throw new ElasticSearchIllegalArgumentException("illegal latitude value [" + lat + "] for " + name); - } - } context.externalValue(lat); latMapper.parse(context); - if (validateLon) { - if (lon > 180.0 || lon < -180) { - throw new ElasticSearchIllegalArgumentException("illegal longitude value [" + lon + "] for " + name); - } - } context.externalValue(lon); lonMapper.parse(context); } @@ -445,7 +435,7 @@ public class GeoPointFieldMapper implements Mapper, ArrayValueMapperParser { } double newLng = lon; - while (newLng <= -180 || newLng >= 180) { + while (newLng < -180 || newLng > 180) { newLng += delta; } return newLng; @@ -460,7 +450,7 @@ public class GeoPointFieldMapper implements Mapper, ArrayValueMapperParser { } double newLat = lat; - while (newLat <= -90 || newLat >= 90) { + while (newLat < -90 || newLat > 90) { newLat += delta; } return newLat; diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/geopoint/LatLonMappingGeoPointTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/geopoint/LatLonMappingGeoPointTests.java index 030d24ce797..653bf94102c 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/geopoint/LatLonMappingGeoPointTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/mapper/geopoint/LatLonMappingGeoPointTests.java @@ -131,7 +131,7 @@ public class LatLonMappingGeoPointTests { @Test public void testNoValidateLatLonValues() throws Exception { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type") - .startObject("properties").startObject("point").field("type", "geo_point").field("lat_lon", true).endObject().endObject() + .startObject("properties").startObject("point").field("type", "geo_point").field("lat_lon", true).field("normalize", false).field("validate", false).endObject().endObject() .endObject().endObject().string(); DocumentMapper defaultMapper = MapperTests.newParser().parse(mapping);