Skip to content

Commit 6cc462b

Browse files
authored
[Remove] various builder and mapping deprecations (#1752)
This commit removes the following deprecations and invalid tests: * LegacyUpdateMappingIntegrationIT * ShapeBuilder new z axis checks * MatchPhrase new zeroTermsQuery checks * TypeQuery utf8 * CompositeValuesSource format checks * LegacyESVersionTests bumped to 6.8.15 * LegacyDynamicMapping, LegacySimilarity, LegacyMapperService tests Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
1 parent 8c2d8f5 commit 6cc462b

File tree

11 files changed

+38
-629
lines changed

11 files changed

+38
-629
lines changed

server/src/internalClusterTest/java/org/opensearch/indices/mapping/LegacyUpdateMappingIntegrationIT.java

Lines changed: 0 additions & 239 deletions
This file was deleted.

server/src/main/java/org/opensearch/common/geo/builders/ShapeBuilder.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import org.apache.logging.log4j.Logger;
4040
import org.apache.logging.log4j.LogManager;
4141
import org.opensearch.Assertions;
42-
import org.opensearch.LegacyESVersion;
4342
import org.opensearch.common.Strings;
4443
import org.opensearch.common.geo.GeoShapeType;
4544
import org.opensearch.common.geo.parsers.GeoWKTParser;
@@ -128,10 +127,7 @@ protected ShapeBuilder(StreamInput in) throws IOException {
128127
protected static Coordinate readFromStream(StreamInput in) throws IOException {
129128
double x = in.readDouble();
130129
double y = in.readDouble();
131-
Double z = null;
132-
if (in.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
133-
z = in.readOptionalDouble();
134-
}
130+
Double z = in.readOptionalDouble();
135131
return z == null ? new Coordinate(x, y) : new Coordinate(x, y, z);
136132
}
137133

@@ -146,9 +142,7 @@ public void writeTo(StreamOutput out) throws IOException {
146142
protected static void writeCoordinateTo(Coordinate coordinate, StreamOutput out) throws IOException {
147143
out.writeDouble(coordinate.x);
148144
out.writeDouble(coordinate.y);
149-
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
150-
out.writeOptionalDouble(Double.isNaN(coordinate.z) ? null : coordinate.z);
151-
}
145+
out.writeOptionalDouble(Double.isNaN(coordinate.z) ? null : coordinate.z);
152146
}
153147

154148
@SuppressWarnings("unchecked")

server/src/main/java/org/opensearch/index/query/MatchPhraseQueryBuilder.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
package org.opensearch.index.query;
3434

3535
import org.apache.lucene.search.Query;
36-
import org.opensearch.LegacyESVersion;
3736
import org.opensearch.common.ParseField;
3837
import org.opensearch.common.ParsingException;
3938
import org.opensearch.common.Strings;
@@ -85,9 +84,7 @@ public MatchPhraseQueryBuilder(StreamInput in) throws IOException {
8584
fieldName = in.readString();
8685
value = in.readGenericValue();
8786
slop = in.readVInt();
88-
if (in.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
89-
zeroTermsQuery = ZeroTermsQuery.readFromStream(in);
90-
}
87+
zeroTermsQuery = ZeroTermsQuery.readFromStream(in);
9188
analyzer = in.readOptionalString();
9289
}
9390

@@ -96,9 +93,7 @@ protected void doWriteTo(StreamOutput out) throws IOException {
9693
out.writeString(fieldName);
9794
out.writeGenericValue(value);
9895
out.writeVInt(slop);
99-
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
100-
zeroTermsQuery.writeTo(out);
101-
}
96+
zeroTermsQuery.writeTo(out);
10297
out.writeOptionalString(analyzer);
10398
}
10499

server/src/main/java/org/opensearch/index/query/TypeQueryBuilder.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434

3535
import org.apache.lucene.search.MatchNoDocsQuery;
3636
import org.apache.lucene.search.Query;
37-
import org.apache.lucene.util.BytesRef;
38-
import org.opensearch.LegacyESVersion;
3937
import org.opensearch.common.ParseField;
4038
import org.opensearch.common.ParsingException;
4139
import org.opensearch.common.io.stream.StreamInput;
@@ -71,20 +69,12 @@ public TypeQueryBuilder(String type) {
7169
*/
7270
public TypeQueryBuilder(StreamInput in) throws IOException {
7371
super(in);
74-
if (in.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
75-
type = in.readString();
76-
} else {
77-
type = in.readBytesRef().utf8ToString();
78-
}
72+
type = in.readString();
7973
}
8074

8175
@Override
8276
protected void doWriteTo(StreamOutput out) throws IOException {
83-
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
84-
out.writeString(type);
85-
} else {
86-
out.writeBytesRef(new BytesRef(type));
87-
}
77+
out.writeString(type);
8878
}
8979

9080
public String type() {

server/src/main/java/org/opensearch/search/aggregations/bucket/composite/CompositeValuesSourceBuilder.java

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
package org.opensearch.search.aggregations.bucket.composite;
3434

35-
import org.opensearch.LegacyESVersion;
3635
import org.opensearch.common.io.stream.StreamInput;
3736
import org.opensearch.common.io.stream.StreamOutput;
3837
import org.opensearch.common.io.stream.Writeable;
@@ -76,21 +75,9 @@ public abstract class CompositeValuesSourceBuilder<AB extends CompositeValuesSou
7675
if (in.readBoolean()) {
7776
this.userValueTypeHint = ValueType.readFromStream(in);
7877
}
79-
if (in.getVersion().onOrAfter(LegacyESVersion.V_6_4_0)) {
80-
this.missingBucket = in.readBoolean();
81-
} else {
82-
this.missingBucket = false;
83-
}
84-
if (in.getVersion().before(LegacyESVersion.V_7_0_0)) {
85-
// skip missing value for BWC
86-
in.readGenericValue();
87-
}
78+
this.missingBucket = in.readBoolean();
8879
this.order = SortOrder.readFromStream(in);
89-
if (in.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
90-
this.format = in.readOptionalString();
91-
} else {
92-
this.format = null;
93-
}
80+
this.format = in.readOptionalString();
9481
}
9582

9683
@Override
@@ -107,17 +94,9 @@ public final void writeTo(StreamOutput out) throws IOException {
10794
if (hasValueType) {
10895
userValueTypeHint.writeTo(out);
10996
}
110-
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_4_0)) {
111-
out.writeBoolean(missingBucket);
112-
}
113-
if (out.getVersion().before(LegacyESVersion.V_7_0_0)) {
114-
// write missing value for BWC
115-
out.writeGenericValue(null);
116-
}
97+
out.writeBoolean(missingBucket);
11798
order.writeTo(out);
118-
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
119-
out.writeOptionalString(format);
120-
}
99+
out.writeOptionalString(format);
121100
innerWriteTo(out);
122101
}
123102

0 commit comments

Comments
 (0)