From 3160798084f61e4c613e1bf87f12708a270a8a6a Mon Sep 17 00:00:00 2001 From: Isabel Drost-Fromm Date: Thu, 28 Apr 2016 14:01:54 +0200 Subject: [PATCH] Deprecate coerce/ignore_malformed for GeoDistanceRangeQuery --- .../query/GeoDistanceRangeQueryBuilder.java | 6 ++- .../query/GeoDistanceRangeQueryTests.java | 42 +++++++++++++++++++ .../migration/migrate_5_0/search.asciidoc | 1 + 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/index/query/GeoDistanceRangeQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/GeoDistanceRangeQueryBuilder.java index c23ee423a55..7afbecad4d3 100644 --- a/core/src/main/java/org/elasticsearch/index/query/GeoDistanceRangeQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/GeoDistanceRangeQueryBuilder.java @@ -78,8 +78,10 @@ public class GeoDistanceRangeQueryBuilder extends AbstractQueryBuilder 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 public void testMustRewrite() throws IOException { assumeTrue("test runs only when at least a type is registered", getCurrentTypes().length > 0); diff --git a/docs/reference/migration/migrate_5_0/search.asciidoc b/docs/reference/migration/migrate_5_0/search.asciidoc index a2c56996c2b..58435256abb 100644 --- a/docs/reference/migration/migrate_5_0/search.asciidoc +++ b/docs/reference/migration/migrate_5_0/search.asciidoc @@ -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 GeoDistanceRangeQuery. Use parameter validation_method instead. ==== Top level `filter` parameter Removed support for the deprecated top level `filter` in the search api,