|
@@ -219,18 +219,18 @@ public class GeoDistanceQueryBuilder extends AbstractQueryBuilder<GeoDistanceQue
|
|
|
throw new QueryShardException(shardContext, "field [" + fieldName + "] is not a geo_point field");
|
|
|
}
|
|
|
|
|
|
+ final Version indexVersionCreated = shardContext.indexVersionCreated();
|
|
|
QueryValidationException exception = checkLatLon(shardContext.indexVersionCreated().before(Version.V_2_0_0));
|
|
|
if (exception != null) {
|
|
|
throw new QueryShardException(shardContext, "couldn't validate latitude/ longitude values", exception);
|
|
|
}
|
|
|
|
|
|
- if (GeoValidationMethod.isCoerce(validationMethod)) {
|
|
|
+ if (indexVersionCreated.onOrAfter(Version.V_2_2_0) || GeoValidationMethod.isCoerce(validationMethod)) {
|
|
|
GeoUtils.normalizePoint(center, true, true);
|
|
|
}
|
|
|
|
|
|
double normDistance = geoDistance.normalize(this.distance, DistanceUnit.DEFAULT);
|
|
|
|
|
|
- final Version indexVersionCreated = shardContext.indexVersionCreated();
|
|
|
if (indexVersionCreated.before(Version.V_2_2_0)) {
|
|
|
GeoPointFieldMapperLegacy.GeoPointFieldType geoFieldType = ((GeoPointFieldMapperLegacy.GeoPointFieldType) fieldType);
|
|
|
IndexGeoPointFieldData indexFieldData = shardContext.getForField(fieldType);
|