From b1a6b227e18cd71de78b77810a284b3a8cc39175 Mon Sep 17 00:00:00 2001 From: Nicholas Knize Date: Mon, 30 Jan 2017 17:20:43 -0600 Subject: [PATCH] Remove deprecated geo query parameters, and GeoPointDistanceRangeQuery This commit removes the following queries and parameters (which were deprecated in 5.0): * GeoPointDistanceRangeQuery * coerce, and ignore_malformed for GeoBoundingBoxQuery, GeoDistanceQuery, GeoPolygonQuery, and GeoDistanceSort --- .../search/XGeoPointDistanceRangeQuery.java | 124 ------------------ .../query/GeoBoundingBoxQueryBuilder.java | 15 --- .../index/query/GeoDistanceQueryBuilder.java | 63 +-------- .../index/query/GeoPolygonQueryBuilder.java | 14 -- .../search/sort/GeoDistanceSortBuilder.java | 29 ++-- .../GeoBoundingBoxQueryBuilderTests.java | 37 ------ .../query/GeoDistanceQueryBuilderTests.java | 50 ------- .../query/GeoPolygonQueryBuilderTests.java | 50 ------- .../query/QueryDSLDocumentationTests.java | 1 - .../sort/GeoDistanceSortBuilderTests.java | 100 -------------- .../migration/migrate_6_0/search.asciidoc | 11 +- 11 files changed, 20 insertions(+), 474 deletions(-) delete mode 100644 core/src/main/java/org/apache/lucene/spatial/geopoint/search/XGeoPointDistanceRangeQuery.java diff --git a/core/src/main/java/org/apache/lucene/spatial/geopoint/search/XGeoPointDistanceRangeQuery.java b/core/src/main/java/org/apache/lucene/spatial/geopoint/search/XGeoPointDistanceRangeQuery.java deleted file mode 100644 index 3cf290e035ea8..0000000000000 --- a/core/src/main/java/org/apache/lucene/spatial/geopoint/search/XGeoPointDistanceRangeQuery.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.lucene.spatial.geopoint.search; - -import org.apache.lucene.index.IndexReader; -import org.apache.lucene.search.BooleanClause; -import org.apache.lucene.search.BooleanQuery; -import org.apache.lucene.search.Query; -import org.apache.lucene.spatial.geopoint.document.GeoPointField.TermEncoding; - -/** Implements a point distance range query on a GeoPoint field. This is based on - * {@code org.apache.lucene.spatial.geopoint.search.GeoPointDistanceQuery} and is implemented using a - * {@code org.apache.lucene.search.BooleanClause.MUST_NOT} clause to exclude any points that fall within - * minRadiusMeters from the provided point. - *

- * NOTE: this query does not correctly support multi-value docs (see: https://issues.apache.org/jira/browse/LUCENE-7126) - *
- * TODO: remove this per ISSUE #17658 - **/ -public final class XGeoPointDistanceRangeQuery extends GeoPointDistanceQuery { - /** minimum distance range (in meters) from lat, lon center location, maximum is inherited */ - protected final double minRadiusMeters; - - /** - * Constructs a query for all {@link org.apache.lucene.spatial.geopoint.document.GeoPointField} types within a minimum / maximum - * distance (in meters) range from a given point - */ - public XGeoPointDistanceRangeQuery(final String field, final double centerLat, final double centerLon, - final double minRadiusMeters, final double maxRadiusMeters) { - this(field, TermEncoding.PREFIX, centerLat, centerLon, minRadiusMeters, maxRadiusMeters); - } - - /** - * Constructs a query for all {@link org.apache.lucene.spatial.geopoint.document.GeoPointField} types within a minimum / maximum - * distance (in meters) range from a given point. Accepts an optional - * {@link org.apache.lucene.spatial.geopoint.document.GeoPointField.TermEncoding} - */ - public XGeoPointDistanceRangeQuery(final String field, final TermEncoding termEncoding, final double centerLat, final double centerLon, - final double minRadiusMeters, final double maxRadius) { - super(field, termEncoding, centerLat, centerLon, maxRadius); - this.minRadiusMeters = minRadiusMeters; - } - - @Override - public Query rewrite(IndexReader reader) { - Query q = super.rewrite(reader); - if (minRadiusMeters == 0.0) { - return q; - } - - // add an exclusion query - BooleanQuery.Builder bqb = new BooleanQuery.Builder(); - - // create a new exclusion query - GeoPointDistanceQuery exclude = new GeoPointDistanceQuery(field, termEncoding, centerLat, centerLon, minRadiusMeters); - // full map search -// if (radiusMeters >= GeoProjectionUtils.SEMIMINOR_AXIS) { -// bqb.add(new BooleanClause(new GeoPointInBBoxQuery(this.field, -180.0, -90.0, 180.0, 90.0), BooleanClause.Occur.MUST)); -// } else { - bqb.add(new BooleanClause(q, BooleanClause.Occur.MUST)); -// } - bqb.add(new BooleanClause(exclude, BooleanClause.Occur.MUST_NOT)); - - return bqb.build(); - } - - @Override - public String toString(String field) { - final StringBuilder sb = new StringBuilder(); - sb.append(getClass().getSimpleName()); - sb.append(':'); - if (!this.field.equals(field)) { - sb.append(" field="); - sb.append(this.field); - sb.append(':'); - } - return sb.append( " Center: [") - .append(centerLat) - .append(',') - .append(centerLon) - .append(']') - .append(" From Distance: ") - .append(minRadiusMeters) - .append(" m") - .append(" To Distance: ") - .append(radiusMeters) - .append(" m") - .append(" Lower Left: [") - .append(minLat) - .append(',') - .append(minLon) - .append(']') - .append(" Upper Right: [") - .append(maxLat) - .append(',') - .append(maxLon) - .append("]") - .toString(); - } - - /** getter method for minimum distance */ - public double getMinRadiusMeters() { - return this.minRadiusMeters; - } - - /** getter method for maximum distance */ - public double getMaxRadiusMeters() { - return this.radiusMeters; - } -} diff --git a/core/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilder.java index 00371ce7a63cd..1ca978b1b5ca2 100644 --- a/core/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilder.java @@ -61,10 +61,6 @@ public class GeoBoundingBoxQueryBuilder extends AbstractQueryBuilder { public static final String NAME = "geo_distance"; - /** Default for latitude normalization (as of this writing true).*/ - public static final boolean DEFAULT_NORMALIZE_LAT = true; - /** Default for longitude normalization (as of this writing true). */ - public static final boolean DEFAULT_NORMALIZE_LON = true; /** Default for distance unit computation. */ public static final DistanceUnit DEFAULT_DISTANCE_UNIT = DistanceUnit.DEFAULT; /** Default for geo distance computation. */ public static final GeoDistance DEFAULT_GEO_DISTANCE = GeoDistance.ARC; - /** Default for optimising query through pre computed bounding box query. */ - @Deprecated - public static final String DEFAULT_OPTIMIZE_BBOX = "memory"; /** * The default value for ignore_unmapped. @@ -66,11 +59,6 @@ public class GeoDistanceQueryBuilder extends AbstractQueryBuilder shell = null; Float boost = null; - boolean coerce = GeoValidationMethod.DEFAULT_LENIENT_PARSING; - boolean ignoreMalformed = GeoValidationMethod.DEFAULT_LENIENT_PARSING; GeoValidationMethod validationMethod = null; String queryName = null; String currentFieldName = null; @@ -271,15 +266,8 @@ public static GeoPolygonQueryBuilder fromXContent(QueryParseContext parseContext queryName = parser.text(); } else if ("boost".equals(currentFieldName)) { boost = parser.floatValue(); - } else if (COERCE_FIELD.match(currentFieldName)) { - coerce = parser.booleanValue(); - if (coerce) { - ignoreMalformed = true; - } } else if (IGNORE_UNMAPPED_FIELD.match(currentFieldName)) { ignoreUnmapped = parser.booleanValue(); - } else if (IGNORE_MALFORMED_FIELD.match(currentFieldName)) { - ignoreMalformed = parser.booleanValue(); } else if (VALIDATION_METHOD.match(currentFieldName)) { validationMethod = GeoValidationMethod.fromString(parser.text()); } else { @@ -294,8 +282,6 @@ public static GeoPolygonQueryBuilder fromXContent(QueryParseContext parseContext if (validationMethod != null) { // if GeoValidationMethod was explicitly set ignore deprecated coerce and ignoreMalformed settings builder.setValidationMethod(validationMethod); - } else { - builder.setValidationMethod(GeoValidationMethod.infer(coerce, ignoreMalformed)); } if (queryName != null) { diff --git a/core/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java b/core/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java index 3362a34ab0b5a..92a197e06206f 100644 --- a/core/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java @@ -72,8 +72,6 @@ public class GeoDistanceSortBuilder extends SortBuilder private static final ParseField UNIT_FIELD = new ParseField("unit"); private static final ParseField DISTANCE_TYPE_FIELD = new ParseField("distance_type"); private static final ParseField VALIDATION_METHOD_FIELD = new ParseField("validation_method"); - private static final ParseField IGNORE_MALFORMED_FIELD = new ParseField("ignore_malformed").withAllDeprecated("validation_method"); - private static final ParseField COERCE_FIELD = new ParseField("coerce", "normalize").withAllDeprecated("validation_method"); private static final ParseField SORTMODE_FIELD = new ParseField("mode", "sort_mode"); private final String fieldName; @@ -405,9 +403,6 @@ public static GeoDistanceSortBuilder fromXContent(QueryParseContext context, Str SortMode sortMode = null; QueryBuilder nestedFilter = null; String nestedPath = null; - - boolean coerce = GeoValidationMethod.DEFAULT_LENIENT_PARSING; - boolean ignoreMalformed = GeoValidationMethod.DEFAULT_LENIENT_PARSING; GeoValidationMethod validation = null; XContentParser.Token token; @@ -443,16 +438,6 @@ public static GeoDistanceSortBuilder fromXContent(QueryParseContext context, Str unit = DistanceUnit.fromString(parser.text()); } else if (DISTANCE_TYPE_FIELD.match(currentName)) { geoDistance = GeoDistance.fromString(parser.text()); - } else if (COERCE_FIELD.match(currentName)) { - coerce = parser.booleanValue(); - if (coerce) { - ignoreMalformed = true; - } - } else if (IGNORE_MALFORMED_FIELD.match(currentName)) { - boolean ignore_malformed_value = parser.booleanValue(); - if (coerce == false) { - ignoreMalformed = ignore_malformed_value; - } } else if (VALIDATION_METHOD_FIELD.match(currentName)) { validation = GeoValidationMethod.fromString(parser.text()); } else if (SORTMODE_FIELD.match(currentName)) { @@ -472,11 +457,17 @@ public static GeoDistanceSortBuilder fromXContent(QueryParseContext context, Str point.resetFromString(parser.text()); geoPoints.add(point); fieldName = currentName; - } else { + } else if (fieldName.equals(currentName)){ throw new ParsingException( parser.getTokenLocation(), "Only geohashes of type string supported for field [{}]", currentName); + } else { + throw new ParsingException( + parser.getTokenLocation(), + "[{}] does not support [{}]", + NAME, currentName + ); } } } @@ -492,11 +483,7 @@ public static GeoDistanceSortBuilder fromXContent(QueryParseContext context, Str result.setNestedFilter(nestedFilter); } result.setNestedPath(nestedPath); - if (validation == null) { - // looks like either validation was left unset or we are parsing old validation json - result.validation(GeoValidationMethod.infer(coerce, ignoreMalformed)); - } else { - // ignore deprecated coerce/ignore_malformed + if (validation != null) { result.validation(validation); } return result; diff --git a/core/src/test/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilderTests.java b/core/src/test/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilderTests.java index b2d1b957befcb..5c1b0130b43bb 100644 --- a/core/src/test/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilderTests.java +++ b/core/src/test/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilderTests.java @@ -406,43 +406,6 @@ public void testFromJson() throws IOException { assertEquals(json, GeoExecType.MEMORY, parsed.type()); } - public void testFromJsonCoerceIsDeprecated() 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" + - "}"; - - parseQuery(json); - assertWarnings("Deprecated field [coerce] used, replaced by [validation_method]"); - } - - public void testFromJsonIgnoreMalformedIsDeprecated() 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" + - "}"; - parseQuery(json); - assertWarnings("Deprecated field [ignore_malformed] used, replaced by [validation_method]"); - } - @Override public void testMustRewrite() throws IOException { assumeTrue("test runs only when at least a type is registered", getCurrentTypes().length > 0); diff --git a/core/src/test/java/org/elasticsearch/index/query/GeoDistanceQueryBuilderTests.java b/core/src/test/java/org/elasticsearch/index/query/GeoDistanceQueryBuilderTests.java index 529a6de50a6ff..a92aa2daf73d8 100644 --- a/core/src/test/java/org/elasticsearch/index/query/GeoDistanceQueryBuilderTests.java +++ b/core/src/test/java/org/elasticsearch/index/query/GeoDistanceQueryBuilderTests.java @@ -316,56 +316,6 @@ public void testFromJson() throws IOException { assertEquals(json, 12000.0, parsed.distance(), 0.0001); } - public void testOptimizeBboxIsDeprecated() throws IOException { - String json = - "{\n" + - " \"geo_distance\" : {\n" + - " \"pin.location\" : [ -70.0, 40.0 ],\n" + - " \"distance\" : 12000.0,\n" + - " \"distance_type\" : \"arc\",\n" + - " \"optimize_bbox\" : \"memory\",\n" + - " \"validation_method\" : \"STRICT\",\n" + - " \"ignore_unmapped\" : false,\n" + - " \"boost\" : 1.0\n" + - " }\n" + - "}"; - parseQuery(json); - assertWarnings("Deprecated field [optimize_bbox] used, replaced by [no replacement: " + - "`optimize_bbox` is no longer supported due to recent improvements]"); - } - - public void testFromCoerceIsDeprecated() throws IOException { - String json = - "{\n" + - " \"geo_distance\" : {\n" + - " \"pin.location\" : [ -70.0, 40.0 ],\n" + - " \"distance\" : 12000.0,\n" + - " \"distance_type\" : \"arc\",\n" + - " \"coerce\" : true,\n" + - " \"ignore_unmapped\" : false,\n" + - " \"boost\" : 1.0\n" + - " }\n" + - "}"; - parseQuery(json); - assertWarnings("Deprecated field [coerce] used, replaced by [validation_method]"); - } - - public void testFromJsonIgnoreMalformedIsDeprecated() throws IOException { - String json = - "{\n" + - " \"geo_distance\" : {\n" + - " \"pin.location\" : [ -70.0, 40.0 ],\n" + - " \"distance\" : 12000.0,\n" + - " \"distance_type\" : \"arc\",\n" + - " \"ignore_malformed\" : true,\n" + - " \"ignore_unmapped\" : false,\n" + - " \"boost\" : 1.0\n" + - " }\n" + - "}"; - parseQuery(json); - assertWarnings("Deprecated field [ignore_malformed] used, replaced by [validation_method]"); - } - @Override public void testMustRewrite() throws IOException { assumeTrue("test runs only when at least a type is registered", getCurrentTypes().length > 0); diff --git a/core/src/test/java/org/elasticsearch/index/query/GeoPolygonQueryBuilderTests.java b/core/src/test/java/org/elasticsearch/index/query/GeoPolygonQueryBuilderTests.java index 6df61d8cb451d..7b8c1177ec8ac 100644 --- a/core/src/test/java/org/elasticsearch/index/query/GeoPolygonQueryBuilderTests.java +++ b/core/src/test/java/org/elasticsearch/index/query/GeoPolygonQueryBuilderTests.java @@ -124,25 +124,6 @@ public void testInvalidOpenPolygon() { assertEquals("too few points defined for geo_polygon query", e.getMessage()); } - public void testDeprecatedXContent() throws IOException { - XContentBuilder builder = XContentFactory.jsonBuilder().prettyPrint(); - builder.startObject(); - builder.startObject("geo_polygon"); - builder.startObject(GEO_POINT_FIELD_NAME); - builder.startArray("points"); - builder.value("0,0"); - builder.value("0,90"); - builder.value("90,90"); - builder.value("90,0"); - builder.endArray(); - builder.endObject(); - builder.field("normalize", true); // deprecated - builder.endObject(); - builder.endObject(); - parseQuery(builder.string()); - assertWarnings("Deprecated field [normalize] used, replaced by [validation_method]"); - } - public void testParsingAndToQueryParsingExceptions() throws IOException { String[] brokenFiles = new String[]{ "/org/elasticsearch/index/query/geo_polygon_exception_1.json", @@ -254,37 +235,6 @@ public void testFromJson() throws IOException { assertEquals(json, 4, parsed.points().size()); } - public void testFromJsonIgnoreMalformedDeprecated() throws IOException { - String json = - "{\n" + - " \"geo_polygon\" : {\n" + - " \"person.location\" : {\n" + - " \"points\" : [ [ -70.0, 40.0 ], [ -80.0, 30.0 ], [ -90.0, 20.0 ], [ -70.0, 40.0 ] ]\n" + - " },\n" + - " \"ignore_malformed\" : false,\n" + - " \"boost\" : 1.0\n" + - " }\n" + - "}"; - parseQuery(json); - assertWarnings("Deprecated field [ignore_malformed] used, replaced by [validation_method]"); - } - - public void testFromJsonCoerceDeprecated() throws IOException { - String json = - "{\n" + - " \"geo_polygon\" : {\n" + - " \"person.location\" : {\n" + - " \"points\" : [ [ -70.0, 40.0 ], [ -80.0, 30.0 ], [ -90.0, 20.0 ], [ -70.0, 40.0 ] ]\n" + - " },\n" + - " \"coerce\" : false,\n" + - " \"ignore_unmapped\" : false,\n" + - " \"boost\" : 1.0\n" + - " }\n" + - "}"; - parseQuery(json); - assertWarnings("Deprecated field [coerce] used, replaced by [validation_method]"); - } - @Override public void testMustRewrite() throws IOException { assumeTrue("test runs only when at least a type is registered", getCurrentTypes().length > 0); diff --git a/core/src/test/java/org/elasticsearch/index/query/QueryDSLDocumentationTests.java b/core/src/test/java/org/elasticsearch/index/query/QueryDSLDocumentationTests.java index 431a973bcb23b..9ee12d0f0ed56 100644 --- a/core/src/test/java/org/elasticsearch/index/query/QueryDSLDocumentationTests.java +++ b/core/src/test/java/org/elasticsearch/index/query/QueryDSLDocumentationTests.java @@ -146,7 +146,6 @@ public void testGeoDistance() { geoDistanceQuery("pin.location") .point(40, -70) .distance(200, DistanceUnit.KILOMETERS) - .optimizeBbox("memory") // TODO switch to geoexectype see also bounding box .geoDistance(GeoDistance.ARC); } diff --git a/core/src/test/java/org/elasticsearch/search/sort/GeoDistanceSortBuilderTests.java b/core/src/test/java/org/elasticsearch/search/sort/GeoDistanceSortBuilderTests.java index 934420914588d..55e812d8f878f 100644 --- a/core/src/test/java/org/elasticsearch/search/sort/GeoDistanceSortBuilderTests.java +++ b/core/src/test/java/org/elasticsearch/search/sort/GeoDistanceSortBuilderTests.java @@ -195,106 +195,6 @@ public void testSortModeSumIsRejectedInSetter() { } } - public void testReverseOptionFailsWhenNonStringField() throws IOException { - String json = "{\n" + - " \"testname\" : [ {\n" + - " \"lat\" : -6.046997540714173,\n" + - " \"lon\" : -51.94128329747579\n" + - " } ],\n" + - " \"reverse\" : true\n" + - "}"; - XContentParser itemParser = createParser(JsonXContent.jsonXContent, json); - itemParser.nextToken(); - - QueryParseContext context = new QueryParseContext(itemParser); - - try { - GeoDistanceSortBuilder.fromXContent(context, ""); - fail("adding reverse sorting option should fail with an exception"); - } catch (ParsingException e) { - assertEquals("Only geohashes of type string supported for field [reverse]", e.getMessage()); - } - } - - public void testReverseOptionFailsWhenStringFieldButResetting() throws IOException { - String json = "{\n" + - " \"testname\" : [ {\n" + - " \"lat\" : -6.046997540714173,\n" + - " \"lon\" : -51.94128329747579\n" + - " } ],\n" + - " \"reverse\" : \"true\"\n" + - "}"; - XContentParser itemParser = createParser(JsonXContent.jsonXContent, json); - itemParser.nextToken(); - - QueryParseContext context = new QueryParseContext(itemParser); - - try { - GeoDistanceSortBuilder.fromXContent(context, ""); - fail("adding reverse sorting option should fail with an exception"); - } catch (ParsingException e) { - assertEquals("Trying to reset fieldName to [reverse], already set to [testname].", e.getMessage()); - } - } - - public void testReverseOptionFailsBuildWhenInvalidGeoHashString() throws IOException { - String json = "{\n" + - " \"reverse\" : \"false\"\n" + - "}"; - XContentParser itemParser = createParser(JsonXContent.jsonXContent, json); - itemParser.nextToken(); - - QueryParseContext context = new QueryParseContext(itemParser); - - try { - GeoDistanceSortBuilder item = GeoDistanceSortBuilder.fromXContent(context, ""); - item.validation(GeoValidationMethod.STRICT); - item.build(createMockShardContext()); - - fail("adding reverse sorting option should fail with an exception"); - } catch (ElasticsearchParseException e) { - assertEquals("illegal latitude value [269.384765625] for [GeoDistanceSort] for field [reverse].", e.getMessage()); - } - } - - public void testCoerceIsDeprecated() throws IOException { - String json = "{\n" + - " \"testname\" : [ {\n" + - " \"lat\" : -6.046997540714173,\n" + - " \"lon\" : -51.94128329747579\n" + - " } ],\n" + - " \"unit\" : \"m\",\n" + - " \"distance_type\" : \"arc\",\n" + - " \"mode\" : \"MAX\",\n" + - " \"coerce\" : true\n" + - "}"; - XContentParser itemParser = createParser(JsonXContent.jsonXContent, json); - itemParser.nextToken(); - - QueryParseContext context = new QueryParseContext(itemParser); - GeoDistanceSortBuilder.fromXContent(context, ""); - assertWarnings("Deprecated field [coerce] used, replaced by [validation_method]"); - } - - public void testIgnoreMalformedIsDeprecated() throws IOException { - String json = "{\n" + - " \"testname\" : [ {\n" + - " \"lat\" : -6.046997540714173,\n" + - " \"lon\" : -51.94128329747579\n" + - " } ],\n" + - " \"unit\" : \"m\",\n" + - " \"distance_type\" : \"arc\",\n" + - " \"mode\" : \"MAX\",\n" + - " \"ignore_malformed\" : true\n" + - "}"; - XContentParser itemParser = createParser(JsonXContent.jsonXContent, json); - itemParser.nextToken(); - - QueryParseContext context = new QueryParseContext(itemParser); - GeoDistanceSortBuilder.fromXContent(context, ""); - assertWarnings("Deprecated field [ignore_malformed] used, replaced by [validation_method]"); - } - public void testSortModeSumIsRejectedInJSON() throws IOException { String json = "{\n" + " \"testname\" : [ {\n" + diff --git a/docs/reference/migration/migrate_6_0/search.asciidoc b/docs/reference/migration/migrate_6_0/search.asciidoc index 3a8072f7cc064..461d1dbab4afa 100644 --- a/docs/reference/migration/migrate_6_0/search.asciidoc +++ b/docs/reference/migration/migrate_6_0/search.asciidoc @@ -35,8 +35,15 @@ a regex as `max_determinized_states` instead of the typo `max_determined_states`. -* For `geo_distance` queries, sorting, and aggregations the `sloppy_arc` and `factor` options - have been removed from the `distance_type` parameter. +* For `geo_distance` queries, sorting, and aggregations the `sloppy_arc` option + has been removed from the `distance_type` parameter. + +* The `geo_distance_range` query, which was deprecated in 5.0, has been removed. + +* The `optimize_bbox` parameter has been removed from `geo_distance` queries. + +* The `ignore_malformed` and `coerce` parameters have been removed from + `geo_bounding_box`, `geo_polygon`, and `geo_distance` queries. ==== Search shards API