Skip to content

Commit 28b4982

Browse files
authored
Deprecate Bounding box query type parameter (#74493)
This parameter has no effect on the query execution.
1 parent f0e0c6a commit 28b4982

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

docs/reference/query-dsl/geo-bounding-box-query.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ GET my_locations/_search
427427
}
428428
}
429429
--------------------------------------------------
430+
// TEST[warning:Deprecated field [type] used, this field is unused and will be removed entirely]
430431

431432
[discrete]
432433
==== Ignore Unmapped

server/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class GeoBoundingBoxQueryBuilder extends AbstractQueryBuilder<GeoBounding
4949
*/
5050
public static final boolean DEFAULT_IGNORE_UNMAPPED = false;
5151

52-
private static final ParseField TYPE_FIELD = new ParseField("type");
52+
private static final ParseField TYPE_FIELD = new ParseField("type").withAllDeprecated();
5353
private static final ParseField VALIDATION_METHOD_FIELD = new ParseField("validation_method");
5454
private static final ParseField IGNORE_UNMAPPED_FIELD = new ParseField("ignore_unmapped");
5555

server/src/test/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilderTests.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ public void testFromJson() throws IOException {
390390
assertEquals(json, 40.01, parsed.bottomRight().getLat(), 0.0001);
391391
assertEquals(json, 1.0, parsed.boost(), 0.0001);
392392
assertEquals(json, GeoExecType.MEMORY, parsed.type());
393+
assertDeprecationWarning();
393394
}
394395

395396
public void testFromWKT() throws IOException {
@@ -434,6 +435,7 @@ public void testFromWKT() throws IOException {
434435
assertEquals(expectedJson, 40.01, parsed.bottomRight().getLat(), delta);
435436
assertEquals(expectedJson, 1.0, parsed.boost(), delta);
436437
assertEquals(expectedJson, GeoExecType.MEMORY, parsed.type());
438+
assertDeprecationWarning();
437439
}
438440

439441
public void testFromGeohash() throws IOException {
@@ -473,6 +475,7 @@ public void testFromGeohash() throws IOException {
473475
assertEquals(json, 33.75, parsed.bottomRight().getLat(), 0.0001);
474476
assertEquals(json, 1.0, parsed.boost(), 0.0001);
475477
assertEquals(json, GeoExecType.MEMORY, parsed.type());
478+
assertDeprecationWarning();
476479
}
477480

478481
public void testMalformedGeohashes() {
@@ -531,4 +534,26 @@ public void testIgnoreUnmapped() throws IOException {
531534
QueryShardException e = expectThrows(QueryShardException.class, () -> failingQueryBuilder.toQuery(searchExecutionContext));
532535
assertThat(e.getMessage(), containsString("failed to find geo field [unmapped]"));
533536
}
537+
538+
@Override
539+
public void testValidOutput() throws IOException {
540+
super.testValidOutput();
541+
assertDeprecationWarning();
542+
}
543+
544+
@Override
545+
public void testUnknownField() throws IOException {
546+
super.testUnknownField();
547+
assertDeprecationWarning();
548+
}
549+
550+
@Override
551+
public void testFromXContent() throws IOException {
552+
super.testFromXContent();
553+
assertDeprecationWarning();
554+
}
555+
556+
private void assertDeprecationWarning() {
557+
assertWarnings("Deprecated field [type] used, this field is unused and will be removed entirely");
558+
}
534559
}

0 commit comments

Comments
 (0)