Skip to content

Commit 9f475f3

Browse files
authored
Comment geo and aggs deprecated names (elastic#119872) (elastic#120287)
This adds comments to the deprecated names in geo and aggregations explaining that we're not removing them so we don't break any callers. Some of these have been deprecated for ten years but we're keeping them.
1 parent c6987a6 commit 9f475f3

File tree

7 files changed

+35
-0
lines changed

7 files changed

+35
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
import java.util.Objects;
3737

3838
/**
39+
* Deprecated geo query. Deprecated in #64227, 7.12/8.0. We do not plan to remove this so we
40+
* do not break any users using this.
3941
* @deprecated use {@link GeoShapeQueryBuilder}
4042
*/
4143
@Deprecated

server/src/main/java/org/elasticsearch/search/SearchModule.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,10 @@ private void registerQueryParsers(List<SearchPlugin> plugins) {
11801180
);
11811181
registerQuery(
11821182
new QuerySpec<>(
1183+
/*
1184+
* Deprecated in #64227, 7.12/8.0. We do not plan to remove this so we
1185+
* do not break any users using this.
1186+
*/
11831187
(new ParseField(GeoPolygonQueryBuilder.NAME).withAllDeprecated(GeoPolygonQueryBuilder.GEO_POLYGON_DEPRECATION_MSG)),
11841188
GeoPolygonQueryBuilder::new,
11851189
GeoPolygonQueryBuilder::fromXContent

server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/GeoDistanceAggregationBuilder.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ public class GeoDistanceAggregationBuilder extends ValuesSourceAggregationBuilde
4848
public static final String NAME = "geo_distance";
4949
public static final ValuesSourceRegistry.RegistryKey<GeoDistanceAggregatorSupplier> REGISTRY_KEY =
5050
new ValuesSourceRegistry.RegistryKey<>(NAME, GeoDistanceAggregatorSupplier.class);
51+
/**
52+
* The point from which to measure the distance. This has many other names that have been
53+
* deprecated since 2014, but we have no plans to remove these names so we don't break anyone
54+
* using them.
55+
*/
5156
static final ParseField ORIGIN_FIELD = new ParseField("origin", "center", "point", "por");
5257
static final ParseField UNIT_FIELD = new ParseField("unit");
5358
static final ParseField DISTANCE_TYPE_FIELD = new ParseField("distance_type");

server/src/main/java/org/elasticsearch/search/aggregations/metrics/CardinalityAggregationBuilder.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ public final class CardinalityAggregationBuilder extends ValuesSourceAggregation
3737
public static final ValuesSourceRegistry.RegistryKey<CardinalityAggregatorSupplier> REGISTRY_KEY =
3838
new ValuesSourceRegistry.RegistryKey<>(NAME, CardinalityAggregatorSupplier.class);
3939

40+
/**
41+
* Pre-2.0 rehashing was configurable, but it hasn't been for ~10 years. We always rehash because it's
42+
* quite cheap. Attempting to enable or disable it is just a noop with a deprecation message. We have
43+
* no plans to remove this parameter because it isn't worth breaking even the tiny fraction of users
44+
* who are sending it. Deprecation was in #12931.
45+
*/
4046
private static final ParseField REHASH = new ParseField("rehash").withAllDeprecated("no replacement - values will always be rehashed");
4147
public static final ParseField PRECISION_THRESHOLD_FIELD = new ParseField("precision_threshold");
4248
public static final ParseField EXECUTION_HINT_FIELD_NAME = new ParseField("execution_hint");

server/src/main/java/org/elasticsearch/search/aggregations/metrics/PercentilesMethod.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
public enum PercentilesMethod implements Writeable {
2424
/**
2525
* The TDigest method for calculating percentiles
26+
* <p>
27+
* The {@code TDigest} and {@code TDIGEST} names have been deprecated since 8.0,
28+
* but we don't have any plans to remove it so we don't break anyone using it.
29+
* </p>
2630
*/
2731
TDIGEST("tdigest", "TDigest", "TDIGEST") {
2832
@Override
@@ -32,6 +36,10 @@ PercentilesConfig configFromStream(StreamInput in) throws IOException {
3236
},
3337
/**
3438
* The HDRHistogram method of calculating percentiles
39+
* <p>
40+
* The {@code HDR} name has been deprecated since 8.0, but we don't have any plans
41+
* to remove it so we don't break anyone using it.
42+
* </p>
3543
*/
3644
HDR("hdr", "HDR") {
3745
@Override

server/src/main/java/org/elasticsearch/search/aggregations/support/ValueType.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ public enum ValueType implements Writeable {
5252
private final byte id;
5353
private final String preferredName;
5454

55+
/**
56+
* Name of the {@code value_type} field in the JSON. The name {@code valueType} has
57+
* been deprecated since before #22160, but we have no plans to remove it so we don't
58+
* break anyone that might be using it.
59+
*/
5560
public static final ParseField VALUE_TYPE = new ParseField("value_type", "valueType");
5661

5762
ValueType(byte id, String description, String preferredName, ValuesSourceType valuesSourceType, DocValueFormat defaultFormat) {

server/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ public class GeoDistanceSortBuilder extends SortBuilder<GeoDistanceSortBuilder>
7777
private static final ParseField UNIT_FIELD = new ParseField("unit");
7878
private static final ParseField DISTANCE_TYPE_FIELD = new ParseField("distance_type");
7979
private static final ParseField VALIDATION_METHOD_FIELD = new ParseField("validation_method");
80+
/**
81+
* Name for the sort {@link SortMode} which is mostly about sorting on multivalued fields.
82+
* The {@code sort_mode} name has been deprecated since 5.0, but we don't plan to remove
83+
* this so we don't break anyone using this.
84+
*/
8085
private static final ParseField SORTMODE_FIELD = new ParseField("mode", "sort_mode");
8186
private static final ParseField IGNORE_UNMAPPED = new ParseField("ignore_unmapped");
8287

0 commit comments

Comments
 (0)