diff --git a/docs/reference/migration/migrate_8_0/search.asciidoc b/docs/reference/migration/migrate_8_0/search.asciidoc index 98d07d9f23d0b..14e5063fd1118 100644 --- a/docs/reference/migration/migrate_8_0/search.asciidoc +++ b/docs/reference/migration/migrate_8_0/search.asciidoc @@ -173,5 +173,16 @@ If you query date fields without a specified `format`, check if the values in yo actually meant to be milliseconds-since-epoch and use a numeric value in this case. If not, use a string value which gets parsed by either the date format set on the field in the mappings or by `strict_date_optional_time` by default. +==== + +.The `geo_bounding_box` query's `type` parameter has been removed. +[%collapsible] +==== +*Details* + +The `geo_bounding_box` query's `type` parameter was deprecated in 7.14.0 and has +been removed in 8.0.0. This parameter is a no-op and has no effect on the query. +*Impact* + +Discontinue use of the `type` parameter. `geo_bounding_box` queries that include +this parameter will return an error. ==== diff --git a/docs/reference/query-dsl/geo-bounding-box-query.asciidoc b/docs/reference/query-dsl/geo-bounding-box-query.asciidoc index 5390d93e7333e..664edaaafe18c 100644 --- a/docs/reference/query-dsl/geo-bounding-box-query.asciidoc +++ b/docs/reference/query-dsl/geo-bounding-box-query.asciidoc @@ -169,9 +169,6 @@ GET my_locations,my_geoshapes/_search 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 <> below for further details -Default is `memory`. |======================================================================= [[query-dsl-geo-bounding-box-query-accepted-formats]] @@ -388,47 +385,6 @@ The filter can work with multiple locations / points per document. Once a single location / point matches the filter, the document will be included in the filter -[discrete] -[[geo-bbox-type]] -==== Type - -The type of the bounding box execution by default is set to `memory`, -which means in memory checks if the doc falls within the bounding box -range. In some cases, an `indexed` option will perform faster (but note -that the `geo_point` type must have lat and lon indexed in this case). -Note, when using the indexed option, multi locations per document field -are not supported. Here is an example: - -[source,console] --------------------------------------------------- -GET my_locations/_search -{ - "query": { - "bool": { - "must": { - "match_all": {} - }, - "filter": { - "geo_bounding_box": { - "pin.location": { - "top_left": { - "lat": 40.73, - "lon": -74.1 - }, - "bottom_right": { - "lat": 40.10, - "lon": -71.12 - } - }, - "type": "indexed" - } - } - } - } -} --------------------------------------------------- -// TEST[warning:Deprecated field [type] used, this field is unused and will be removed entirely] - [discrete] ==== Ignore Unmapped diff --git a/server/src/internalClusterTest/java/org/elasticsearch/search/geo/AbstractGeoBoundingBoxQueryIT.java b/server/src/internalClusterTest/java/org/elasticsearch/search/geo/AbstractGeoBoundingBoxQueryIT.java index 0336b1bd8cd08..d0a57b45999d2 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/search/geo/AbstractGeoBoundingBoxQueryIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/search/geo/AbstractGeoBoundingBoxQueryIT.java @@ -100,7 +100,7 @@ public void testSimpleBoundingBoxTest() throws Exception { } searchResponse = client().prepareSearch() // from NY - .setQuery(geoBoundingBoxQuery("location").setCorners(40.73, -74.1, 40.717, -73.99).type("indexed")) + .setQuery(geoBoundingBoxQuery("location").setCorners(40.73, -74.1, 40.717, -73.99)) .get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); assertThat(searchResponse.getHits().getHits().length, equalTo(2)); @@ -150,8 +150,7 @@ public void testLimit2BoundingBox() throws Exception { searchResponse = client().prepareSearch() .setQuery( boolQuery().must(termQuery("userid", 880)).filter( - geoBoundingBoxQuery("location").setCorners(74.579421999999994, 143.5, -66.668903999999998, 113.96875) - .type("indexed")) + geoBoundingBoxQuery("location").setCorners(74.579421999999994, 143.5, -66.668903999999998, 113.96875)) ).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); @@ -164,8 +163,7 @@ public void testLimit2BoundingBox() throws Exception { searchResponse = client().prepareSearch() .setQuery( boolQuery().must(termQuery("userid", 534)).filter( - geoBoundingBoxQuery("location").setCorners(74.579421999999994, 143.5, -66.668903999999998, 113.96875) - .type("indexed")) + geoBoundingBoxQuery("location").setCorners(74.579421999999994, 143.5, -66.668903999999998, 113.96875)) ).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); @@ -216,7 +214,6 @@ public void testCompleteLonRange() throws Exception { searchResponse = client().prepareSearch() .setQuery( geoBoundingBoxQuery("location").setValidationMethod(GeoValidationMethod.COERCE).setCorners(50, -180, -50, 180) - .type("indexed") ).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); searchResponse = client().prepareSearch() @@ -227,7 +224,6 @@ public void testCompleteLonRange() throws Exception { searchResponse = client().prepareSearch() .setQuery( geoBoundingBoxQuery("location").setValidationMethod(GeoValidationMethod.COERCE).setCorners(90, -180, -90, 180) - .type("indexed") ).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); @@ -239,7 +235,6 @@ public void testCompleteLonRange() throws Exception { searchResponse = client().prepareSearch() .setQuery( geoBoundingBoxQuery("location").setValidationMethod(GeoValidationMethod.COERCE).setCorners(50, 0, -50, 360) - .type("indexed") ).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L)); searchResponse = client().prepareSearch() @@ -250,7 +245,6 @@ public void testCompleteLonRange() throws Exception { searchResponse = client().prepareSearch() .setQuery( geoBoundingBoxQuery("location").setValidationMethod(GeoValidationMethod.COERCE).setCorners(90, 0, -90, 360) - .type("indexed") ).get(); assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L)); diff --git a/server/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilder.java b/server/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilder.java index f6c4874ed5af1..a6ee84c9a9bef 100644 --- a/server/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilder.java +++ b/server/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilder.java @@ -11,6 +11,7 @@ import org.apache.lucene.search.MatchNoDocsQuery; import org.apache.lucene.search.Query; import org.elasticsearch.ElasticsearchParseException; +import org.elasticsearch.Version; import org.elasticsearch.common.Numbers; import org.elasticsearch.common.xcontent.ParseField; import org.elasticsearch.common.ParsingException; @@ -41,15 +42,11 @@ public class GeoBoundingBoxQueryBuilder extends AbstractQueryBuilder { public static final String NAME = "geo_bounding_box"; - /** Default type for executing this query (memory as of this writing). */ - public static final GeoExecType DEFAULT_TYPE = GeoExecType.MEMORY; - /** * The default value for ignore_unmapped. */ public static final boolean DEFAULT_IGNORE_UNMAPPED = false; - private static final ParseField TYPE_FIELD = new ParseField("type").withAllDeprecated(); private static final ParseField VALIDATION_METHOD_FIELD = new ParseField("validation_method"); private static final ParseField IGNORE_UNMAPPED_FIELD = new ParseField("ignore_unmapped"); @@ -59,8 +56,6 @@ public class GeoBoundingBoxQueryBuilder extends AbstractQueryBuilder qb.type((GeoExecType) null)); - assertEquals("Type is not allowed to be null.", e.getMessage()); - } - - public void testValidationNullTypeString() { - GeoBoundingBoxQueryBuilder qb = new GeoBoundingBoxQueryBuilder("teststring"); - IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> qb.type((String) null)); - assertEquals("cannot parse type from null string", e.getMessage()); - } - public void testExceptionOnMissingTypes() { SearchExecutionContext context = createShardContextWithNoType(); GeoBoundingBoxQueryBuilder qb = createTestQueryBuilder(); @@ -376,8 +363,7 @@ public void testFromJson() throws IOException { " \"bottom_right\" : [ -71.12, 40.01 ]\n" + " },\n" + " \"validation_method\" : \"STRICT\",\n" + - " \"type\" : \"MEMORY\",\n" + - " \"ignore_unmapped\" : false,\n" + + " \"ignore_unmapped\" : false,\n" + " \"boost\" : 1.0\n" + " }\n" + "}"; @@ -389,8 +375,6 @@ public void testFromJson() throws IOException { assertEquals(json, -71.12, parsed.bottomRight().getLon(), 0.0001); assertEquals(json, 40.01, parsed.bottomRight().getLat(), 0.0001); assertEquals(json, 1.0, parsed.boost(), 0.0001); - assertEquals(json, GeoExecType.MEMORY, parsed.type()); - assertDeprecationWarning(); } public void testFromWKT() throws IOException { @@ -401,7 +385,6 @@ public void testFromWKT() throws IOException { " \"wkt\" : \"BBOX (-74.1, -71.12, 40.73, 40.01)\"\n" + " },\n" + " \"validation_method\" : \"STRICT\",\n" + - " \"type\" : \"MEMORY\",\n" + " \"ignore_unmapped\" : false,\n" + " \"boost\" : 1.0\n" + " }\n" + @@ -417,7 +400,6 @@ public void testFromWKT() throws IOException { " \"bottom_right\" : [ -71.12, 40.01 ]\n" + " },\n" + " \"validation_method\" : \"STRICT\",\n" + - " \"type\" : \"MEMORY\",\n" + " \"ignore_unmapped\" : false,\n" + " \"boost\" : 1.0\n" + " }\n" + @@ -434,8 +416,6 @@ public void testFromWKT() throws IOException { assertEquals(expectedJson, -71.12, parsed.bottomRight().getLon(), delta); assertEquals(expectedJson, 40.01, parsed.bottomRight().getLat(), delta); assertEquals(expectedJson, 1.0, parsed.boost(), delta); - assertEquals(expectedJson, GeoExecType.MEMORY, parsed.type()); - assertDeprecationWarning(); } public void testFromGeohash() throws IOException { @@ -447,7 +427,6 @@ public void testFromGeohash() throws IOException { " \"bottom_right\" : \"dq\"\n" + " },\n" + " \"validation_method\" : \"STRICT\",\n" + - " \"type\" : \"MEMORY\",\n" + " \"ignore_unmapped\" : false,\n" + " \"boost\" : 1.0\n" + " }\n" + @@ -461,7 +440,6 @@ public void testFromGeohash() throws IOException { " \"bottom_right\" : [ -67.5, 33.75 ]\n" + " },\n" + " \"validation_method\" : \"STRICT\",\n" + - " \"type\" : \"MEMORY\",\n" + " \"ignore_unmapped\" : false,\n" + " \"boost\" : 1.0\n" + " }\n" + @@ -474,8 +452,6 @@ public void testFromGeohash() throws IOException { assertEquals(json, -67.5, parsed.bottomRight().getLon(), 0.0001); assertEquals(json, 33.75, parsed.bottomRight().getLat(), 0.0001); assertEquals(json, 1.0, parsed.boost(), 0.0001); - assertEquals(json, GeoExecType.MEMORY, parsed.type()); - assertDeprecationWarning(); } public void testMalformedGeohashes() { @@ -487,7 +463,6 @@ public void testMalformedGeohashes() { " \"wkt\" : \"BBOX (-74.1, -71.12, 40.73, 40.01)\"\n" + " },\n" + " \"validation_method\" : \"STRICT\",\n" + - " \"type\" : \"MEMORY\",\n" + " \"ignore_unmapped\" : false,\n" + " \"boost\" : 1.0\n" + " }\n" + @@ -534,26 +509,4 @@ public void testIgnoreUnmapped() throws IOException { QueryShardException e = expectThrows(QueryShardException.class, () -> failingQueryBuilder.toQuery(searchExecutionContext)); assertThat(e.getMessage(), containsString("failed to find geo field [unmapped]")); } - - @Override - public void testValidOutput() throws IOException { - super.testValidOutput(); - assertDeprecationWarning(); - } - - @Override - public void testUnknownField() throws IOException { - super.testUnknownField(); - assertDeprecationWarning(); - } - - @Override - public void testFromXContent() throws IOException { - super.testFromXContent(); - assertDeprecationWarning(); - } - - private void assertDeprecationWarning() { - assertWarnings("Deprecated field [type] used, this field is unused and will be removed entirely"); - } }