diff --git a/libs/x-content/src/main/java/org/opensearch/common/xcontent/XContentType.java b/libs/x-content/src/main/java/org/opensearch/common/xcontent/XContentType.java index 4611ee58d001b..02ae4d0a7f46d 100644 --- a/libs/x-content/src/main/java/org/opensearch/common/xcontent/XContentType.java +++ b/libs/x-content/src/main/java/org/opensearch/common/xcontent/XContentType.java @@ -35,13 +35,11 @@ import com.fasterxml.jackson.dataformat.cbor.CBORConstants; import com.fasterxml.jackson.dataformat.smile.SmileConstants; -import org.opensearch.Version; import org.opensearch.common.annotation.PublicApi; import org.opensearch.common.xcontent.cbor.CborXContent; import org.opensearch.common.xcontent.json.JsonXContent; import org.opensearch.common.xcontent.smile.SmileXContent; import org.opensearch.common.xcontent.yaml.YamlXContent; -import org.opensearch.core.common.io.stream.StreamOutput; import org.opensearch.core.xcontent.MediaType; import org.opensearch.core.xcontent.XContent; import org.opensearch.core.xcontent.XContentBuilder; @@ -239,7 +237,7 @@ public XContentBuilder contentBuilder(final OutputStream os) throws IOException } }; - private int index; + private final int index; XContentType(int index) { this.index = index; @@ -259,15 +257,6 @@ public String format() { return subtype(); } - @Override - public void writeTo(StreamOutput output) throws IOException { - if (output.getVersion().onOrAfter(Version.V_3_0_0)) { - output.writeVInt(uniqueId()); - } else { - output.writeString(this.mediaType()); - } - } - @Override public int uniqueId() { return this.ordinal();