Skip to content

Commit d0dd49b

Browse files
authored
Deprecate Bounding box query type parameter (#74493) (#74535)
This parameter has no effect on the query execution.
1 parent 30ecf8b commit d0dd49b

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
@@ -396,6 +396,7 @@ public void testFromJson() throws IOException {
396396
assertEquals(json, 40.01, parsed.bottomRight().getLat(), 0.0001);
397397
assertEquals(json, 1.0, parsed.boost(), 0.0001);
398398
assertEquals(json, GeoExecType.MEMORY, parsed.type());
399+
assertDeprecationWarning();
399400
}
400401

401402
public void testFromWKT() throws IOException {
@@ -440,6 +441,7 @@ public void testFromWKT() throws IOException {
440441
assertEquals(expectedJson, 40.01, parsed.bottomRight().getLat(), delta);
441442
assertEquals(expectedJson, 1.0, parsed.boost(), delta);
442443
assertEquals(expectedJson, GeoExecType.MEMORY, parsed.type());
444+
assertDeprecationWarning();
443445
}
444446

445447
public void testFromGeohash() throws IOException {
@@ -479,6 +481,7 @@ public void testFromGeohash() throws IOException {
479481
assertEquals(json, 33.75, parsed.bottomRight().getLat(), 0.0001);
480482
assertEquals(json, 1.0, parsed.boost(), 0.0001);
481483
assertEquals(json, GeoExecType.MEMORY, parsed.type());
484+
assertDeprecationWarning();
482485
}
483486

484487
public void testMalformedGeohashes() {
@@ -537,4 +540,26 @@ public void testIgnoreUnmapped() throws IOException {
537540
QueryShardException e = expectThrows(QueryShardException.class, () -> failingQueryBuilder.toQuery(searchExecutionContext));
538541
assertThat(e.getMessage(), containsString("failed to find geo field [unmapped]"));
539542
}
543+
544+
@Override
545+
public void testValidOutput() throws IOException {
546+
super.testValidOutput();
547+
assertDeprecationWarning();
548+
}
549+
550+
@Override
551+
public void testUnknownField() throws IOException {
552+
super.testUnknownField();
553+
assertDeprecationWarning();
554+
}
555+
556+
@Override
557+
public void testFromXContent() throws IOException {
558+
super.testFromXContent();
559+
assertDeprecationWarning();
560+
}
561+
562+
private void assertDeprecationWarning() {
563+
assertWarnings("Deprecated field [type] used, this field is unused and will be removed entirely");
564+
}
540565
}

0 commit comments

Comments
 (0)