diff --git a/src/test/java/org/elasticsearch/index/mapper/geo/GeoEncodingTests.java b/src/test/java/org/elasticsearch/index/mapper/geo/GeoEncodingTests.java index f02e15d8337..f52363e89ae 100644 --- a/src/test/java/org/elasticsearch/index/mapper/geo/GeoEncodingTests.java +++ b/src/test/java/org/elasticsearch/index/mapper/geo/GeoEncodingTests.java @@ -36,7 +36,7 @@ public class GeoEncodingTests extends ElasticsearchTestCase { for (int i = 0; i < 10000; ++i) { final double lat = randomDouble() * 180 - 90; final double lon = randomDouble() * 360 - 180; - final Distance precision = new Distance(randomDouble() * 10, randomFrom(Arrays.asList(DistanceUnit.MILLIMETERS, DistanceUnit.METERS, DistanceUnit.KILOMETERS))); + final Distance precision = new Distance(1+(randomDouble() * 9), randomFrom(Arrays.asList(DistanceUnit.MILLIMETERS, DistanceUnit.METERS, DistanceUnit.KILOMETERS))); final GeoPointFieldMapper.Encoding encoding = GeoPointFieldMapper.Encoding.of(precision); assertThat(encoding.precision().convert(DistanceUnit.METERS).value, lessThanOrEqualTo(precision.convert(DistanceUnit.METERS).value)); final GeoPoint geoPoint = encoding.decode(encoding.encodeCoordinate(lat), encoding.encodeCoordinate(lon), new GeoPoint());