Skip to content
Merged
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 @@ -8,7 +8,6 @@
*/
package org.elasticsearch.ingest.common;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.ActionResponse;
Expand Down Expand Up @@ -60,9 +59,7 @@ public Request(boolean sorted, String ecsCompatibility) {
Request(StreamInput in) throws IOException {
super(in);
this.sorted = in.readBoolean();
this.ecsCompatibility = in.getTransportVersion().onOrAfter(TransportVersions.V_8_0_0)
? in.readString()
: GrokProcessor.DEFAULT_ECS_COMPATIBILITY_MODE;
this.ecsCompatibility = in.readString();
}

@Override
Expand All @@ -74,9 +71,7 @@ public ActionRequestValidationException validate() {
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeBoolean(sorted);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_0_0)) {
out.writeString(ecsCompatibility);
}
out.writeString(ecsCompatibility);
}

public boolean sorted() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ protected NodeResponse(StreamInput in) throws IOException {
}
databases = in.readCollectionAsImmutableSet(StreamInput::readString);
filesInTemp = in.readCollectionAsImmutableSet(StreamInput::readString);
configDatabases = in.getTransportVersion().onOrAfter(TransportVersions.V_8_0_0)
? in.readCollectionAsImmutableSet(StreamInput::readString)
: null;
configDatabases = in.readCollectionAsImmutableSet(StreamInput::readString);
}

protected NodeResponse(
Expand Down Expand Up @@ -226,9 +224,7 @@ public void writeTo(StreamOutput out) throws IOException {
}
out.writeStringCollection(databases);
out.writeStringCollection(filesInTemp);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_0_0)) {
out.writeStringCollection(configDatabases);
}
out.writeStringCollection(configDatabases);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ResourceNotFoundException;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.io.stream.InputStreamStreamInput;
Expand Down Expand Up @@ -206,15 +205,7 @@ protected PercolateQueryBuilder(String field, Supplier<BytesReference> documentS
super(in);
field = in.readString();
name = in.readOptionalString();
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
String documentType = in.readOptionalString();
assert documentType == null;
}
indexedDocumentIndex = in.readOptionalString();
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
String indexedDocumentType = in.readOptionalString();
assert indexedDocumentType == null;
}
indexedDocumentId = in.readOptionalString();
indexedDocumentRouting = in.readOptionalString();
indexedDocumentPreference = in.readOptionalString();
Expand Down Expand Up @@ -248,15 +239,7 @@ protected void doWriteTo(StreamOutput out) throws IOException {
}
out.writeString(field);
out.writeOptionalString(name);
if (out.getTransportVersion().before(TransportVersions.V_8_0_0)) {
// In 7x, typeless percolate queries are represented by null documentType values
out.writeOptionalString(null);
}
out.writeOptionalString(indexedDocumentIndex);
if (out.getTransportVersion().before(TransportVersions.V_8_0_0)) {
// In 7x, typeless percolate queries are represented by null indexedDocumentType values
out.writeOptionalString(null);
}
out.writeOptionalString(indexedDocumentId);
out.writeOptionalString(indexedDocumentRouting);
out.writeOptionalString(indexedDocumentPreference);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
package org.elasticsearch.system_indices.task;

import org.elasticsearch.TransportVersion;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.cluster.Diff;
import org.elasticsearch.cluster.DiffableUtils;
import org.elasticsearch.cluster.NamedDiff;
Expand All @@ -35,7 +34,6 @@
*/
public class FeatureMigrationResults implements Metadata.ProjectCustom {
public static final String TYPE = "system_index_migration";
public static final TransportVersion MIGRATION_ADDED_VERSION = TransportVersions.V_8_0_0;

static final ParseField RESULTS_FIELD = new ParseField("results");

Expand Down Expand Up @@ -94,7 +92,7 @@ public String getWriteableName() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return MIGRATION_ADDED_VERSION;
return TransportVersion.minimumCompatible();
}

@Override
Expand Down Expand Up @@ -164,7 +162,7 @@ static Diff<SingleFeatureMigrationResult> readDiffFrom(StreamInput in) throws IO

@Override
public TransportVersion getMinimalSupportedVersion() {
return MIGRATION_ADDED_VERSION;
return TransportVersion.minimumCompatible();
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

import java.io.IOException;

import static org.elasticsearch.system_indices.task.FeatureMigrationResults.MIGRATION_ADDED_VERSION;

/**
* The params used to initialize {@link SystemIndexMigrator} when it's initially kicked off.
*
Expand Down Expand Up @@ -68,7 +66,7 @@ public String getWriteableName() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return MIGRATION_ADDED_VERSION;
return TransportVersion.minimumCompatible();
}

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

package org.elasticsearch.xpack.ml.autoscaling;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.settings.Settings;
Expand Down Expand Up @@ -49,11 +48,7 @@ public MlScalingReason(StreamInput in) throws IOException {
this.waitingAnalyticsJobs = in.readStringCollectionAsList();
this.waitingAnomalyJobs = in.readStringCollectionAsList();
this.waitingSnapshotUpgrades = in.readStringCollectionAsList();
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_0_0)) {
this.waitingModels = in.readStringCollectionAsList();
} else {
this.waitingModels = List.of();
}
this.waitingModels = in.readStringCollectionAsList();
this.passedConfiguration = Settings.readSettingsFromStream(in);
this.currentMlCapacity = new AutoscalingCapacity(in);
this.requiredCapacity = in.readOptionalWriteable(AutoscalingCapacity::new);
Expand Down Expand Up @@ -136,9 +131,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeStringCollection(this.waitingAnalyticsJobs);
out.writeStringCollection(this.waitingAnomalyJobs);
out.writeStringCollection(this.waitingSnapshotUpgrades);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_0_0)) {
out.writeStringCollection(this.waitingModels);
}
out.writeStringCollection(this.waitingModels);
this.passedConfiguration.writeTo(out);
this.currentMlCapacity.writeTo(out);
out.writeOptionalWriteable(this.requiredCapacity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ElasticsearchStatusException;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.PlainActionFuture;
import org.elasticsearch.cluster.ClusterState;
Expand Down Expand Up @@ -47,7 +46,7 @@ public DatafeedConfigAutoUpdater(DatafeedConfigProvider provider, IndexNameExpre

@Override
public boolean isMinTransportVersionSupported(TransportVersion minNodeVersion) {
return minNodeVersion.onOrAfter(TransportVersions.V_8_0_0);
return true;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

import org.apache.commons.math3.util.FastMath;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.search.aggregations.bucket.AbstractNXYSignificanceHeuristicTestCase;
import org.elasticsearch.search.aggregations.bucket.terms.heuristic.SignificanceHeuristic;
import org.elasticsearch.test.TransportVersionUtils;
import org.elasticsearch.xcontent.NamedXContentRegistry;
import org.elasticsearch.xpack.ml.MachineLearning;
import org.elasticsearch.xpack.ml.MachineLearningTests;
Expand All @@ -34,7 +34,7 @@ public class PValueScoreTests extends AbstractNXYSignificanceHeuristicTestCase {

@Override
protected TransportVersion randomVersion() {
return randomFrom(TransportVersions.V_8_0_0);
return TransportVersionUtils.randomCompatibleVersion(random());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@

import org.apache.http.util.EntityUtils;
import org.elasticsearch.Build;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.Version;
import org.elasticsearch.client.Node;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.Response;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.WarningsHandler;
import org.elasticsearch.cluster.metadata.DataStream;
import org.elasticsearch.cluster.metadata.DataStreamTestHelper;
import org.elasticsearch.common.settings.SecureString;
Expand Down Expand Up @@ -541,25 +538,6 @@ private void createDataStreamFromNonDataStreamIndices(String dataStreamFromNonDa
indexTemplate.replace("$TEMPLATE", templateWithNoTimestamp).replace("$PATTERN", dataStreamFromNonDataStreamIndices + "-*")
);
String indexName = dataStreamFromNonDataStreamIndices + "-01";
if (minimumTransportVersion().before(TransportVersions.V_8_0_0)) {
/*
* It is not possible to create a 7.x index template with a type. And you can't create an empty index with a type. But you can
* create the index with a type by posting a document to an index with a type. We do that here so that we test that the type is
* removed when we reindex into 8.x.
*/
String typeName = "test-type";
Request createIndexRequest = new Request("POST", indexName + "/" + typeName);
createIndexRequest.setJsonEntity("""
{
"@timestamp": "2099-11-15T13:12:00",
"message": "GET /search HTTP/1.1 200 1070000",
"user": {
"id": "kimchy"
}
}""");
createIndexRequest.setOptions(RequestOptions.DEFAULT.toBuilder().setWarningsHandler(WarningsHandler.PERMISSIVE).build());
assertOK(client().performRequest(createIndexRequest));
}
assertOK(client().performRequest(putIndexTemplateRequest));
bulkLoadDataMissingTimestamp(indexName);
/*
Expand Down