Deprecate coerce/ignore_malformed for GeoDistanceRangeQuery
This commit is contained in:
parent
5306de3ce3
commit
3160798084
|
@ -78,8 +78,10 @@ public class GeoDistanceRangeQueryBuilder extends AbstractQueryBuilder<GeoDistan
|
||||||
private static final ParseField NAME_FIELD = new ParseField("_name");
|
private static final ParseField NAME_FIELD = new ParseField("_name");
|
||||||
private static final ParseField BOOST_FIELD = new ParseField("boost");
|
private static final ParseField BOOST_FIELD = new ParseField("boost");
|
||||||
private static final ParseField OPTIMIZE_BBOX_FIELD = new ParseField("optimize_bbox");
|
private static final ParseField OPTIMIZE_BBOX_FIELD = new ParseField("optimize_bbox");
|
||||||
private static final ParseField COERCE_FIELD = new ParseField("coerce", "normalize");
|
private static final ParseField COERCE_FIELD = new ParseField("coerce", "normalize")
|
||||||
private static final ParseField IGNORE_MALFORMED_FIELD = new ParseField("ignore_malformed");
|
.withAllDeprecated("use validation_method instead");
|
||||||
|
private static final ParseField IGNORE_MALFORMED_FIELD = new ParseField("ignore_malformed")
|
||||||
|
.withAllDeprecated("use validation_method instead");
|
||||||
private static final ParseField VALIDATION_METHOD = new ParseField("validation_method");
|
private static final ParseField VALIDATION_METHOD = new ParseField("validation_method");
|
||||||
private static final ParseField IGNORE_UNMAPPED_FIELD = new ParseField("ignore_unmapped");
|
private static final ParseField IGNORE_UNMAPPED_FIELD = new ParseField("ignore_unmapped");
|
||||||
|
|
||||||
|
|
|
@ -357,6 +357,48 @@ public class GeoDistanceRangeQueryTests extends AbstractQueryTestCase<GeoDistanc
|
||||||
assertEquals(json, -70.0, parsed.point().lon(), 0.0001);
|
assertEquals(json, -70.0, parsed.point().lon(), 0.0001);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testFromJsonCoerceFails() throws IOException {
|
||||||
|
String json =
|
||||||
|
"{\n" +
|
||||||
|
" \"geo_distance_range\" : {\n" +
|
||||||
|
" \"pin.location\" : [ -70.0, 40.0 ],\n" +
|
||||||
|
" \"from\" : \"200km\",\n" +
|
||||||
|
" \"to\" : \"400km\",\n" +
|
||||||
|
" \"include_lower\" : true,\n" +
|
||||||
|
" \"include_upper\" : true,\n" +
|
||||||
|
" \"unit\" : \"m\",\n" +
|
||||||
|
" \"distance_type\" : \"sloppy_arc\",\n" +
|
||||||
|
" \"optimize_bbox\" : \"memory\",\n" +
|
||||||
|
" \"coerce\" : true,\n" +
|
||||||
|
" \"ignore_unmapped\" : false,\n" +
|
||||||
|
" \"boost\" : 1.0\n" +
|
||||||
|
" }\n" +
|
||||||
|
"}";
|
||||||
|
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> parseQuery(json));
|
||||||
|
assertTrue(e.getMessage().startsWith("Deprecated field "));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testFromJsonIgnoreMalformedFails() throws IOException {
|
||||||
|
String json =
|
||||||
|
"{\n" +
|
||||||
|
" \"geo_distance_range\" : {\n" +
|
||||||
|
" \"pin.location\" : [ -70.0, 40.0 ],\n" +
|
||||||
|
" \"from\" : \"200km\",\n" +
|
||||||
|
" \"to\" : \"400km\",\n" +
|
||||||
|
" \"include_lower\" : true,\n" +
|
||||||
|
" \"include_upper\" : true,\n" +
|
||||||
|
" \"unit\" : \"m\",\n" +
|
||||||
|
" \"distance_type\" : \"sloppy_arc\",\n" +
|
||||||
|
" \"optimize_bbox\" : \"memory\",\n" +
|
||||||
|
" \"ignore_malformed\" : true,\n" +
|
||||||
|
" \"ignore_unmapped\" : false,\n" +
|
||||||
|
" \"boost\" : 1.0\n" +
|
||||||
|
" }\n" +
|
||||||
|
"}";
|
||||||
|
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> parseQuery(json));
|
||||||
|
assertTrue(e.getMessage().startsWith("Deprecated field "));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void testMustRewrite() throws IOException {
|
public void testMustRewrite() throws IOException {
|
||||||
assumeTrue("test runs only when at least a type is registered", getCurrentTypes().length > 0);
|
assumeTrue("test runs only when at least a type is registered", getCurrentTypes().length > 0);
|
||||||
|
|
|
@ -128,6 +128,7 @@ in favour of `query` and `no_match_query`.
|
||||||
|
|
||||||
* Deprecated support for the coerce, normalize, ignore_malformed parameters in GeoPolygonQuery. Use parameter validation_method instead.
|
* Deprecated support for the coerce, normalize, ignore_malformed parameters in GeoPolygonQuery. Use parameter validation_method instead.
|
||||||
|
|
||||||
|
* Deprecated support for the coerce, normalize, ignore_malformed parameters in GeoDistanceRangeQuery. Use parameter validation_method instead.
|
||||||
==== Top level `filter` parameter
|
==== Top level `filter` parameter
|
||||||
|
|
||||||
Removed support for the deprecated top level `filter` in the search api,
|
Removed support for the deprecated top level `filter` in the search api,
|
||||||
|
|
Loading…
Reference in New Issue