Deprecate coerce/ignore_malformed for GeoBoundingBoxQuery

This commit is contained in:
Isabel Drost-Fromm 2016-04-28 14:10:59 +02:00
parent 3f743a30cf
commit a19c426e0f
3 changed files with 41 additions and 2 deletions

View File

@ -505,6 +505,42 @@ public class GeoBoundingBoxQueryBuilderTests extends AbstractQueryTestCase<GeoBo
}
}
public void testFromJsonCoerceFails() throws IOException {
String json =
"{\n" +
" \"geo_bounding_box\" : {\n" +
" \"pin.location\" : {\n" +
" \"top_left\" : [ -74.1, 40.73 ],\n" +
" \"bottom_right\" : [ -71.12, 40.01 ]\n" +
" },\n" +
" \"coerce\" : true,\n" +
" \"type\" : \"MEMORY\",\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_bounding_box\" : {\n" +
" \"pin.location\" : {\n" +
" \"top_left\" : [ -74.1, 40.73 ],\n" +
" \"bottom_right\" : [ -71.12, 40.01 ]\n" +
" },\n" +
" \"ignore_malformed\" : true,\n" +
" \"type\" : \"MEMORY\",\n" +
" \"ignore_unmapped\" : false,\n" +
" \"boost\" : 1.0\n" +
" }\n" +
"}";
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> parseQuery(json));
assertTrue(e.getMessage().startsWith("Deprecated field "));
}
@Override
public void testMustRewrite() throws IOException {
assumeTrue("test runs only when at least a type is registered", getCurrentTypes().length > 0);

View File

@ -131,6 +131,8 @@ in favour of `query` and `no_match_query`.
* Deprecated support for the coerce, normalize, ignore_malformed parameters in GeoDistanceRangeQuery. Use parameter validation_method instead.
* Deprecated support for the coerce, normalize, ignore_malformed parameters in GeoDistanceQuery. Use parameter validation_method instead.
* Deprecated support for the coerce, normalize, ignore_malformed parameters in GeoBoundingBoxQuery. Use parameter validation_method instead.
==== Top level `filter` parameter
Removed support for the deprecated top level `filter` in the search api,

View File

@ -52,8 +52,9 @@ Then the following simple query can be executed with a
|Option |Description
|`_name` |Optional name field to identify the filter
|`ignore_malformed` |Set to `true` to
accept geo points with invalid latitude or longitude (default is `false`).
|`validation_method` |Set to `IGNORE_MALFORMED` to
accept geo points with invalid latitude or longitude, set to
`COERCE` to also try to infer correct latitude or longitude. (default is `STRICT`).
|`type` |Set to one of `indexed` or `memory` to defines whether this filter will
be executed in memory or indexed. See <<geo-bbox-type,Type>> below for further details