Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
package org.elasticsearch.action;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.rest.RestStatus;

import java.io.IOException;
Expand Down Expand Up @@ -42,18 +40,12 @@ public RestStatus status() {

public RoutingMissingException(StreamInput in) throws IOException {
super(in);
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
in.readString();
}
id = in.readString();
}

@Override
protected void writeTo(StreamOutput out, Writer<Throwable> nestedExceptionsWriter) throws IOException {
super.writeTo(out, nestedExceptionsWriter);
if (out.getTransportVersion().before(TransportVersions.V_8_0_0)) {
out.writeString(MapperService.SINGLE_MAPPING_NAME);
}
out.writeString(id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

package org.elasticsearch.action.admin.indices.get;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.IndicesRequest;
import org.elasticsearch.action.support.IndicesOptions;
Expand Down Expand Up @@ -113,9 +112,6 @@ public GetIndexRequest(TimeValue masterTimeout) {
public GetIndexRequest(StreamInput in) throws IOException {
super(in);
indices = in.readStringArray();
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
in.readStringArray();
}
indicesOptions = IndicesOptions.readIndicesOptions(in);
features = in.readArray(i -> Feature.fromId(i.readByte()), Feature[]::new);
humanReadable = in.readBoolean();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

package org.elasticsearch.action.admin.indices.get;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.cluster.metadata.AliasMetadata;
import org.elasticsearch.cluster.metadata.MappingMetadata;
Expand All @@ -20,7 +19,6 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ChunkedToXContentObject;
import org.elasticsearch.core.UpdateForV10;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.xcontent.ToXContent;

import java.io.IOException;
Expand Down Expand Up @@ -77,18 +75,10 @@ public GetIndexResponse(
@UpdateForV10(owner = UpdateForV10.Owner.DATA_MANAGEMENT)
GetIndexResponse(StreamInput in) throws IOException {
this.indices = in.readStringArray();
mappings = in.readImmutableOpenMap(StreamInput::readString, in.getTransportVersion().before(TransportVersions.V_8_0_0) ? i -> {
int numMappings = i.readVInt();
assert numMappings == 0 || numMappings == 1 : "Expected 0 or 1 mappings but got " + numMappings;
if (numMappings == 1) {
String type = i.readString();
assert MapperService.SINGLE_MAPPING_NAME.equals(type) : "Expected [_doc] but got [" + type + "]";
return new MappingMetadata(i);
} else {
return MappingMetadata.EMPTY_MAPPINGS;
}
} : i -> i.readBoolean() ? new MappingMetadata(i) : MappingMetadata.EMPTY_MAPPINGS);

mappings = in.readImmutableOpenMap(
StreamInput::readString,
i -> i.readBoolean() ? new MappingMetadata(i) : MappingMetadata.EMPTY_MAPPINGS
);
aliases = in.readImmutableOpenMap(StreamInput::readString, i -> i.readCollectionAsList(AliasMetadata::new));
settings = in.readImmutableOpenMap(StreamInput::readString, Settings::readSettingsFromStream);
defaultSettings = in.readImmutableOpenMap(StreamInput::readString, Settings::readSettingsFromStream);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@

package org.elasticsearch.action.admin.indices.mapping.get;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.OriginalIndices;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.single.shard.SingleShardRequest;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;

Expand All @@ -29,14 +27,8 @@ public class GetFieldMappingsIndexRequest extends SingleShardRequest<GetFieldMap

GetFieldMappingsIndexRequest(StreamInput in) throws IOException {
super(in);
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
in.readStringArray(); // former types array
}
fields = in.readStringArray();
includeDefaults = in.readBoolean();
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
in.readBoolean(); // former probablySingleField boolean
}
originalIndices = OriginalIndices.readOriginalIndices(in);
}

Expand Down Expand Up @@ -74,14 +66,8 @@ public IndicesOptions indicesOptions() {
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
if (out.getTransportVersion().before(TransportVersions.V_8_0_0)) {
out.writeStringArray(Strings.EMPTY_ARRAY);
}
out.writeStringArray(fields);
out.writeBoolean(includeDefaults);
if (out.getTransportVersion().before(TransportVersions.V_8_0_0)) {
out.writeBoolean(false);
}
OriginalIndices.writeOriginalIndices(originalIndices, out);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

package org.elasticsearch.action.admin.indices.mapping.get;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.IndicesRequest;
import org.elasticsearch.action.LegacyActionRequest;
Expand All @@ -19,7 +18,6 @@
import org.elasticsearch.common.io.stream.StreamOutput;

import java.io.IOException;
import java.util.Arrays;

/**
* Request the mappings of specific fields
Expand All @@ -42,18 +40,7 @@ public GetFieldMappingsRequest() {}
public GetFieldMappingsRequest(StreamInput in) throws IOException {
super(in);
indices = in.readStringArray();
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
String[] types = in.readStringArray();
if (types != Strings.EMPTY_ARRAY) {
throw new IllegalArgumentException("Expected empty type array but received [" + Arrays.toString(types) + "]");
}

}
indicesOptions = IndicesOptions.readIndicesOptions(in);
// Consume the deprecated local parameter
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
in.readBoolean();
}
fields = in.readStringArray();
includeDefaults = in.readBoolean();
}
Expand Down Expand Up @@ -117,13 +104,7 @@ public ActionRequestValidationException validate() {
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeStringArray(indices);
if (out.getTransportVersion().before(TransportVersions.V_8_0_0)) {
out.writeStringArray(Strings.EMPTY_ARRAY);
}
indicesOptions.writeIndicesOptions(out);
if (out.getTransportVersion().before(TransportVersions.V_8_0_0)) {
out.writeBoolean(true);
}
out.writeStringArray(fields);
out.writeBoolean(includeDefaults);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@

package org.elasticsearch.action.admin.indices.mapping.get;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.index.mapper.Mapper;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.xcontent.ParseField;
import org.elasticsearch.xcontent.ToXContentFragment;
import org.elasticsearch.xcontent.ToXContentObject;
Expand All @@ -25,7 +23,6 @@

import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.Map;
import java.util.Objects;

Expand All @@ -46,17 +43,9 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte
}

GetFieldMappingsResponse(StreamInput in) throws IOException {
mappings = in.readImmutableMap(mapIn -> {
if (mapIn.getTransportVersion().before(TransportVersions.V_8_0_0)) {
int typesSize = mapIn.readVInt();
assert typesSize == 1 || typesSize == 0 : "Expected 0 or 1 types but got " + typesSize;
if (typesSize == 0) {
return Collections.emptyMap();
}
mapIn.readString(); // type
}
return mapIn.readImmutableMap(inpt -> new FieldMappingMetadata(inpt.readString(), inpt.readBytesReference()));
});
mappings = in.readImmutableMap(
mapIn -> mapIn.readImmutableMap(inpt -> new FieldMappingMetadata(inpt.readString(), inpt.readBytesReference()))
);
}

/** returns the retrieved field mapping. The return map keys are index, field (as specified in the request). */
Expand Down Expand Up @@ -134,10 +123,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeMap(mappings, (outpt, map) -> {
if (outpt.getTransportVersion().before(TransportVersions.V_8_0_0)) {
outpt.writeVInt(1);
outpt.writeString(MapperService.SINGLE_MAPPING_NAME);
}
outpt.writeMap(map, (o, v) -> {
o.writeString(v.fullName());
o.writeBytesReference(v.source);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

package org.elasticsearch.action.admin.indices.mapping.get;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.IndicesRequest;
import org.elasticsearch.action.support.IndicesOptions;
Expand Down Expand Up @@ -43,9 +42,6 @@ public GetMappingsRequest(TimeValue masterTimeout) {
public GetMappingsRequest(StreamInput in) throws IOException {
super(in);
indices = in.readStringArray();
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
in.readStringArray();
}
indicesOptions = IndicesOptions.readIndicesOptions(in);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
package org.elasticsearch.action.admin.indices.mapping.put;

import org.elasticsearch.ElasticsearchGenerationException;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.IndicesRequest;
import org.elasticsearch.action.support.IndicesOptions;
Expand All @@ -24,7 +23,6 @@
import org.elasticsearch.common.util.CollectionUtils;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.XContentFactory;
import org.elasticsearch.xcontent.XContentType;
Expand Down Expand Up @@ -97,12 +95,6 @@ public PutMappingRequest(StreamInput in) throws IOException {
super(in);
indices = in.readStringArray();
indicesOptions = IndicesOptions.readIndicesOptions(in);
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
String type = in.readOptionalString();
if (MapperService.SINGLE_MAPPING_NAME.equals(type) == false) {
throw new IllegalArgumentException("Expected type [_doc] but received [" + type + "]");
}
}
source = in.readString();
concreteIndex = in.readOptionalWriteable(Index::new);
origin = in.readOptionalString();
Expand Down Expand Up @@ -330,9 +322,6 @@ public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeStringArrayNullable(indices);
indicesOptions.writeIndicesOptions(out);
if (out.getTransportVersion().before(TransportVersions.V_8_0_0)) {
out.writeOptionalString(MapperService.SINGLE_MAPPING_NAME);
}
out.writeString(source);
out.writeOptionalWriteable(concreteIndex);
out.writeOptionalString(origin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ public IndicesSegmentsRequest() {

public IndicesSegmentsRequest(StreamInput in) throws IOException {
super(in);
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
in.readBoolean(); // old 'verbose' option, since removed
}
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
this.includeVectorFormatsInfo = in.readBoolean();
}
Expand All @@ -56,9 +53,6 @@ public boolean isIncludeVectorFormatsInfo() {
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
if (out.getTransportVersion().before(TransportVersions.V_8_0_0)) {
out.writeBoolean(false);
}
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
out.writeBoolean(includeVectorFormatsInfo);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import org.elasticsearch.ElasticsearchGenerationException;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.IndicesRequest;
import org.elasticsearch.action.admin.indices.alias.Alias;
Expand Down Expand Up @@ -77,15 +76,7 @@ public PutIndexTemplateRequest(StreamInput in) throws IOException {
order = in.readInt();
create = in.readBoolean();
settings = readSettingsFromStream(in);
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
int size = in.readVInt();
for (int i = 0; i < size; i++) {
in.readString(); // type - cannot assert on _doc because 7x allows arbitrary type names
this.mappings = in.readString();
}
} else {
this.mappings = in.readOptionalString();
}
mappings = in.readOptionalString();
int aliasesSize = in.readVInt();
for (int i = 0; i < aliasesSize; i++) {
aliases.add(new Alias(in));
Expand Down Expand Up @@ -450,15 +441,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeInt(order);
out.writeBoolean(create);
settings.writeTo(out);
if (out.getTransportVersion().before(TransportVersions.V_8_0_0)) {
out.writeVInt(mappings == null ? 0 : 1);
if (mappings != null) {
out.writeString(MapperService.SINGLE_MAPPING_NAME);
out.writeString(mappings);
}
} else {
out.writeOptionalString(mappings);
}
out.writeOptionalString(mappings);
out.writeCollection(aliases);
out.writeOptionalVInt(version);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

package org.elasticsearch.action.admin.indices.validate.query;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.support.broadcast.BroadcastShardRequest;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
Expand All @@ -34,14 +33,6 @@ public class ShardValidateQueryRequest extends BroadcastShardRequest {
public ShardValidateQueryRequest(StreamInput in) throws IOException {
super(in);
query = in.readNamedWriteable(QueryBuilder.class);
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
int typesSize = in.readVInt();
if (typesSize > 0) {
for (int i = 0; i < typesSize; i++) {
in.readString();
}
}
}
filteringAliases = AliasFilter.readFrom(in);
explain = in.readBoolean();
rewrite = in.readBoolean();
Expand Down Expand Up @@ -81,9 +72,6 @@ public long nowInMillis() {
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeNamedWriteable(query);
if (out.getTransportVersion().before(TransportVersions.V_8_0_0)) {
out.writeVInt(0); // no types to filter
}
filteringAliases.writeTo(out);
out.writeBoolean(explain);
out.writeBoolean(rewrite);
Expand Down
Loading