From 70083ac220d97d2e8343d7d7829ab5554671f512 Mon Sep 17 00:00:00 2001 From: Tal Levy Date: Mon, 13 May 2019 18:35:48 -0400 Subject: [PATCH] remove 6.6.x version constants relates to refactoring work #41164. --- .../main/java/org/elasticsearch/Version.java | 12 ----- .../ClusterFormationFailureHelper.java | 4 +- .../index/mapper/BaseGeoShapeFieldMapper.java | 2 +- .../mapper/LegacyGeoShapeFieldMapper.java | 5 +- .../java/org/elasticsearch/VersionTests.java | 2 +- .../state/ClusterStateRequestTests.java | 6 +-- .../query/GeoShapeQueryBuilderTests.java | 2 +- .../action/AutoFollowCoordinatorTests.java | 10 ++-- .../xpack/core/ccr/AutoFollowStats.java | 10 +--- .../xpack/core/indexing/IndexerJobStats.java | 29 +++++----- .../IndexLifecycleMetadata.java | 2 +- .../xpack/core/ml/action/OpenJobAction.java | 8 +-- .../core/ml/action/StartDatafeedAction.java | 12 ++--- .../xpack/core/ml/datafeed/AggProvider.java | 37 ++----------- .../core/ml/datafeed/DatafeedConfig.java | 10 +--- .../core/ml/datafeed/DatafeedUpdate.java | 10 +--- .../xpack/core/ml/datafeed/QueryProvider.java | 35 ++---------- .../xpack/core/ml/job/config/JobUpdate.java | 10 +--- .../rollup/action/StopRollupJobAction.java | 12 ++--- .../core/ml/datafeed/AggProviderTests.java | 20 ------- .../core/ml/datafeed/QueryProviderTests.java | 22 -------- .../IndexLifecycleMetadataTests.java | 4 +- .../ml/MlConfigMigrationEligibilityCheck.java | 9 ---- ...lConfigMigrationEligibilityCheckTests.java | 24 +++++---- .../MlMigrationFullClusterRestartIT.java | 53 ------------------- 25 files changed, 65 insertions(+), 285 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/Version.java b/server/src/main/java/org/elasticsearch/Version.java index c2d927f457bd1..4a1956275829d 100644 --- a/server/src/main/java/org/elasticsearch/Version.java +++ b/server/src/main/java/org/elasticsearch/Version.java @@ -98,12 +98,6 @@ public class Version implements Comparable, ToXContentFragment { public static final Version V_6_5_3 = new Version(V_6_5_3_ID, org.apache.lucene.util.Version.LUCENE_7_5_0); public static final int V_6_5_4_ID = 6050499; public static final Version V_6_5_4 = new Version(V_6_5_4_ID, org.apache.lucene.util.Version.LUCENE_7_5_0); - public static final int V_6_6_0_ID = 6060099; - public static final Version V_6_6_0 = new Version(V_6_6_0_ID, org.apache.lucene.util.Version.LUCENE_7_6_0); - public static final int V_6_6_1_ID = 6060199; - public static final Version V_6_6_1 = new Version(V_6_6_1_ID, org.apache.lucene.util.Version.LUCENE_7_6_0); - public static final int V_6_6_2_ID = 6060299; - public static final Version V_6_6_2 = new Version(V_6_6_2_ID, org.apache.lucene.util.Version.LUCENE_7_6_0); public static final int V_6_7_0_ID = 6070099; public static final Version V_6_7_0 = new Version(V_6_7_0_ID, org.apache.lucene.util.Version.LUCENE_7_7_0); public static final int V_6_7_1_ID = 6070199; @@ -162,12 +156,6 @@ public static Version fromId(int id) { return V_6_7_2; case V_6_7_0_ID: return V_6_7_0; - case V_6_6_2_ID: - return V_6_6_2; - case V_6_6_1_ID: - return V_6_6_1; - case V_6_6_0_ID: - return V_6_6_0; case V_6_5_4_ID: return V_6_5_4; case V_6_5_3_ID: diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelper.java b/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelper.java index a707a9ae980b7..2157d05538948 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelper.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelper.java @@ -150,8 +150,6 @@ String getDescription() { if (clusterState.getLastAcceptedConfiguration().isEmpty()) { - // TODO handle the case that there is a 6.x node around here, when rolling upgrades are supported - final String bootstrappingDescription; if (INITIAL_MASTER_NODES_SETTING.get(Settings.EMPTY).equals(INITIAL_MASTER_NODES_SETTING.get(settings))) { @@ -165,7 +163,7 @@ String getDescription() { return String.format(Locale.ROOT, "master not discovered yet, this node has not previously joined a bootstrapped (v%d+) cluster, and %s: %s", - Version.V_6_6_0.major + 1, bootstrappingDescription, discoveryStateIgnoringQuorum); + Version.CURRENT.major + 1, bootstrappingDescription, discoveryStateIgnoringQuorum); } assert clusterState.getLastCommittedConfiguration().isEmpty() == false; diff --git a/server/src/main/java/org/elasticsearch/index/mapper/BaseGeoShapeFieldMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/BaseGeoShapeFieldMapper.java index 74892bf7d516c..20151f301d791 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/BaseGeoShapeFieldMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/BaseGeoShapeFieldMapper.java @@ -190,7 +190,7 @@ public Mapper.Builder parse(String name, Map node, ParserContext } } final Builder builder; - if (parsedDeprecatedParams || parserContext.indexVersionCreated().before(Version.V_6_6_0)) { + if (parsedDeprecatedParams) { // Legacy index-based shape builder = new LegacyGeoShapeFieldMapper.Builder(name, deprecatedParameters); } else { diff --git a/server/src/main/java/org/elasticsearch/index/mapper/LegacyGeoShapeFieldMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/LegacyGeoShapeFieldMapper.java index 9c8726a498a3c..c4996eab901dd 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/LegacyGeoShapeFieldMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/LegacyGeoShapeFieldMapper.java @@ -208,8 +208,6 @@ private void setupFieldTypeDeprecatedParameters(BuilderContext context) { } if (deprecatedParameters.tree != null) { ft.setTree(deprecatedParameters.tree); - } else if (context.indexCreatedVersion().before(Version.V_6_6_0)) { - ft.setTree(DeprecatedParameters.PrefixTrees.GEOHASH); } if (deprecatedParameters.treeLevels != null) { ft.setTreeLevels(deprecatedParameters.treeLevels); @@ -527,8 +525,7 @@ protected void doXContentBody(XContentBuilder builder, boolean includeDefaults, super.doXContentBody(builder, includeDefaults, params); if (includeDefaults - || (fieldType().tree().equals(indexCreatedVersion.onOrAfter(Version.V_6_6_0) ? - DeprecatedParameters.Defaults.TREE : DeprecatedParameters.PrefixTrees.GEOHASH)) == false) { + || (fieldType().tree().equals(DeprecatedParameters.Defaults.TREE)) == false) { builder.field(DeprecatedParameters.Names.TREE.getPreferredName(), fieldType().tree()); } diff --git a/server/src/test/java/org/elasticsearch/VersionTests.java b/server/src/test/java/org/elasticsearch/VersionTests.java index 21a18e4a26ba5..49ffadc52ab72 100644 --- a/server/src/test/java/org/elasticsearch/VersionTests.java +++ b/server/src/test/java/org/elasticsearch/VersionTests.java @@ -345,7 +345,7 @@ public static void assertUnknownVersion(Version version) { public void testIsCompatible() { assertTrue(isCompatible(Version.CURRENT, Version.CURRENT.minimumCompatibilityVersion())); - assertFalse(isCompatible(Version.V_6_6_0, Version.V_7_0_0)); + assertFalse(isCompatible(Version.fromString("6.6.0"), Version.fromString("7.0.0"))); assertFalse(isCompatible(Version.V_6_7_0, Version.V_7_0_0)); assertTrue(isCompatible(Version.V_6_8_0, Version.V_7_0_0)); assertFalse(isCompatible(Version.fromId(2000099), Version.V_7_0_0)); diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequestTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequestTests.java index f2214f4ba81fa..b219e208a6049 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequestTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/state/ClusterStateRequestTests.java @@ -67,10 +67,8 @@ public void testSerialization() throws Exception { assertThat(deserializedCSRequest.blocks(), equalTo(clusterStateRequest.blocks())); assertThat(deserializedCSRequest.indices(), equalTo(clusterStateRequest.indices())); assertOptionsMatch(deserializedCSRequest.indicesOptions(), clusterStateRequest.indicesOptions()); - if (testVersion.onOrAfter(Version.V_6_6_0)) { - assertThat(deserializedCSRequest.waitForMetaDataVersion(), equalTo(clusterStateRequest.waitForMetaDataVersion())); - assertThat(deserializedCSRequest.waitForTimeout(), equalTo(clusterStateRequest.waitForTimeout())); - } + assertThat(deserializedCSRequest.waitForMetaDataVersion(), equalTo(clusterStateRequest.waitForMetaDataVersion())); + assertThat(deserializedCSRequest.waitForTimeout(), equalTo(clusterStateRequest.waitForTimeout())); } } diff --git a/server/src/test/java/org/elasticsearch/index/query/GeoShapeQueryBuilderTests.java b/server/src/test/java/org/elasticsearch/index/query/GeoShapeQueryBuilderTests.java index 4851387b1a497..cfb2c62fc9f4f 100644 --- a/server/src/test/java/org/elasticsearch/index/query/GeoShapeQueryBuilderTests.java +++ b/server/src/test/java/org/elasticsearch/index/query/GeoShapeQueryBuilderTests.java @@ -72,7 +72,7 @@ protected String fieldName() { @Override protected Settings createTestIndexSettings() { // force the new shape impl - Version version = VersionUtils.randomVersionBetween(random(), Version.V_6_6_0, Version.CURRENT); + Version version = VersionUtils.randomIndexCompatibleVersion(random()); return Settings.builder() .put(super.createTestIndexSettings()) .put(IndexMetaData.SETTING_VERSION_CREATED, version) diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/AutoFollowCoordinatorTests.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/AutoFollowCoordinatorTests.java index 75e6a732c8210..a6c15a40a6507 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/AutoFollowCoordinatorTests.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/AutoFollowCoordinatorTests.java @@ -814,7 +814,7 @@ public void testAutoFollowerSoftDeletesDisabled() { when(client.getRemoteClusterClient(anyString())).thenReturn(client); ClusterState remoteState = randomBoolean() ? createRemoteClusterState("logs-20190101", false) : - createRemoteClusterState("logs-20190101", null); + createRemoteClusterState("logs-20190101", randomBoolean()); AutoFollowPattern autoFollowPattern = new AutoFollowPattern("remote", Collections.singletonList("logs-*"), null, null, null, null, null, null, null, null, null, null, null); @@ -953,13 +953,9 @@ void cleanFollowedRemoteIndices(ClusterState remoteClusterState, List pa assertThat(entries.get(0).getValue(), nullValue()); } - private static ClusterState createRemoteClusterState(String indexName, Boolean enableSoftDeletes) { + private static ClusterState createRemoteClusterState(String indexName, boolean enableSoftDeletes) { Settings.Builder indexSettings; - if (enableSoftDeletes != null) { - indexSettings = settings(Version.CURRENT).put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), enableSoftDeletes); - } else { - indexSettings = settings(Version.V_6_6_0); - } + indexSettings = settings(Version.CURRENT).put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), enableSoftDeletes); IndexMetaData indexMetaData = IndexMetaData.builder(indexName) .settings(indexSettings) diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/AutoFollowStats.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/AutoFollowStats.java index 600bd5fced3ae..8d437c53e2473 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/AutoFollowStats.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/AutoFollowStats.java @@ -125,11 +125,7 @@ public AutoFollowStats(StreamInput in) throws IOException { recentAutoFollowErrors = new TreeMap<>(in.readMap((Writeable.Reader) StreamInput::readString, (Writeable.Reader>) in1 -> new Tuple<>(-1L, in1.readException()))); } - if (in.getVersion().onOrAfter(Version.V_6_6_0)) { - autoFollowedClusters = new TreeMap<>(in.readMap(StreamInput::readString, AutoFollowedCluster::new)); - } else { - autoFollowedClusters = Collections.emptyNavigableMap(); - } + autoFollowedClusters = new TreeMap<>(in.readMap(StreamInput::readString, AutoFollowedCluster::new)); } @Override @@ -145,9 +141,7 @@ public void writeTo(StreamOutput out) throws IOException { } else { out.writeMap(recentAutoFollowErrors, StreamOutput::writeString, (out1, value) -> out1.writeException(value.v2())); } - if (out.getVersion().onOrAfter(Version.V_6_6_0)) { - out.writeMap(autoFollowedClusters, StreamOutput::writeString, (out1, value) -> value.writeTo(out1)); - } + out.writeMap(autoFollowedClusters, StreamOutput::writeString, (out1, value) -> value.writeTo(out1)); } public long getNumberOfFailedFollowIndices() { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexing/IndexerJobStats.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexing/IndexerJobStats.java index 2ef9d242d9ef4..72134b0553b98 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexing/IndexerJobStats.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexing/IndexerJobStats.java @@ -5,7 +5,6 @@ */ package org.elasticsearch.xpack.core.indexing; -import org.elasticsearch.Version; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -61,14 +60,12 @@ public IndexerJobStats(StreamInput in) throws IOException { this.numInputDocuments = in.readVLong(); this.numOuputDocuments = in.readVLong(); this.numInvocations = in.readVLong(); - if (in.getVersion().onOrAfter(Version.V_6_6_0)) { - this.indexTime = in.readVLong(); - this.searchTime = in.readVLong(); - this.indexTotal = in.readVLong(); - this.searchTotal = in.readVLong(); - this.indexFailures = in.readVLong(); - this.searchFailures = in.readVLong(); - } + this.indexTime = in.readVLong(); + this.searchTime = in.readVLong(); + this.indexTotal = in.readVLong(); + this.searchTotal = in.readVLong(); + this.indexFailures = in.readVLong(); + this.searchFailures = in.readVLong(); } public long getNumPages() { @@ -163,14 +160,12 @@ public void writeTo(StreamOutput out) throws IOException { out.writeVLong(numInputDocuments); out.writeVLong(numOuputDocuments); out.writeVLong(numInvocations); - if (out.getVersion().onOrAfter(Version.V_6_6_0)) { - out.writeVLong(indexTime); - out.writeVLong(searchTime); - out.writeVLong(indexTotal); - out.writeVLong(searchTotal); - out.writeVLong(indexFailures); - out.writeVLong(searchFailures); - } + out.writeVLong(indexTime); + out.writeVLong(searchTime); + out.writeVLong(indexTotal); + out.writeVLong(searchTotal); + out.writeVLong(indexFailures); + out.writeVLong(searchFailures); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/IndexLifecycleMetadata.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/IndexLifecycleMetadata.java index c0cafa8e9079e..161033601ee3f 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/IndexLifecycleMetadata.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/IndexLifecycleMetadata.java @@ -106,7 +106,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws @Override public Version getMinimalSupportedVersion() { - return Version.V_6_6_0; + return Version.CURRENT.minimumCompatibilityVersion(); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/OpenJobAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/OpenJobAction.java index 418ae16d3e632..4468baac6e5c7 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/OpenJobAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/OpenJobAction.java @@ -170,9 +170,7 @@ public JobParams(String jobId) { public JobParams(StreamInput in) throws IOException { jobId = in.readString(); timeout = TimeValue.timeValueMillis(in.readVLong()); - if (in.getVersion().onOrAfter(Version.V_6_6_0)) { - job = in.readOptionalWriteable(Job::new); - } + job = in.readOptionalWriteable(Job::new); } public String getJobId() { @@ -209,9 +207,7 @@ public String getWriteableName() { public void writeTo(StreamOutput out) throws IOException { out.writeString(jobId); out.writeVLong(timeout.millis()); - if (out.getVersion().onOrAfter(Version.V_6_6_0)) { - out.writeOptionalWriteable(job); - } + out.writeOptionalWriteable(job); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/StartDatafeedAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/StartDatafeedAction.java index cdfdf06bf85ac..0ba35e6b521e2 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/StartDatafeedAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/StartDatafeedAction.java @@ -195,10 +195,8 @@ public DatafeedParams(StreamInput in) throws IOException { startTime = in.readVLong(); endTime = in.readOptionalLong(); timeout = TimeValue.timeValueMillis(in.readVLong()); - if (in.getVersion().onOrAfter(Version.V_6_6_0)) { - jobId = in.readOptionalString(); - datafeedIndices = in.readStringList(); - } + jobId = in.readOptionalString(); + datafeedIndices = in.readStringList(); } DatafeedParams() { @@ -272,10 +270,8 @@ public void writeTo(StreamOutput out) throws IOException { out.writeVLong(startTime); out.writeOptionalLong(endTime); out.writeVLong(timeout.millis()); - if (out.getVersion().onOrAfter(Version.V_6_6_0)) { - out.writeOptionalString(jobId); - out.writeStringCollection(datafeedIndices); - } + out.writeOptionalString(jobId); + out.writeStringCollection(datafeedIndices); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/AggProvider.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/AggProvider.java index 8585e4122e673..1c39c6d985d45 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/AggProvider.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/AggProvider.java @@ -7,8 +7,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.Version; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Writeable; @@ -68,14 +66,7 @@ static AggProvider fromParsedAggs(AggregatorFactories.Builder parsedAggs) throws } static AggProvider fromStream(StreamInput in) throws IOException { - if (in.getVersion().onOrAfter(Version.V_6_7_0)) { // Has our bug fix for query/agg providers - return new AggProvider(in.readMap(), in.readOptionalWriteable(AggregatorFactories.Builder::new), in.readException()); - } else if (in.getVersion().onOrAfter(Version.V_6_6_0)) { // Has the bug, but supports lazy objects - return new AggProvider(in.readMap(), null, null); - } else { // only supports eagerly parsed objects - // Upstream, we have read the bool already and know for sure that we have parsed aggs in the stream - return AggProvider.fromParsedAggs(new AggregatorFactories.Builder(in)); - } + return new AggProvider(in.readMap(), in.readOptionalWriteable(AggregatorFactories.Builder::new), in.readException()); } AggProvider(Map aggs, AggregatorFactories.Builder parsedAggs, Exception parsingException) { @@ -92,29 +83,9 @@ static AggProvider fromStream(StreamInput in) throws IOException { @Override public void writeTo(StreamOutput out) throws IOException { - if (out.getVersion().onOrAfter(Version.V_6_7_0)) { // Has our bug fix for query/agg providers - out.writeMap(aggs); - out.writeOptionalWriteable(parsedAggs); - out.writeException(parsingException); - } else if (out.getVersion().onOrAfter(Version.V_6_6_0)) { // Has the bug, but supports lazy objects - // We allow the lazy parsing nodes that have the bug throw any parsing errors themselves as - // they already have the ability to fully parse the passed Maps - out.writeMap(aggs); - } else { // only supports eagerly parsed objects - if (parsingException != null) { - if (parsingException instanceof IOException) { - throw (IOException) parsingException; - } else { - throw new ElasticsearchException(parsingException); - } - } else if (parsedAggs == null) { - // This is an admittedly rare case but we should fail early instead of writing null when there - // actually are aggregations defined - throw new ElasticsearchException("Unsupported operation: parsed aggregations are null"); - } - // Upstream we already verified that this calling object is not null, no need to write a second boolean to the stream - parsedAggs.writeTo(out); - } + out.writeMap(aggs); + out.writeOptionalWriteable(parsedAggs); + out.writeException(parsingException); } public Exception getParsingException() { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java index 810d97df34636..20ee3f4f48d11 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedConfig.java @@ -227,11 +227,7 @@ public DatafeedConfig(StreamInput in) throws IOException { } else { this.headers = Collections.emptyMap(); } - if (in.getVersion().onOrAfter(Version.V_6_6_0)) { - delayedDataCheckConfig = in.readOptionalWriteable(DelayedDataCheckConfig::new); - } else { - delayedDataCheckConfig = DelayedDataCheckConfig.defaultDelayedDataCheckConfig(); - } + delayedDataCheckConfig = in.readOptionalWriteable(DelayedDataCheckConfig::new); } /** @@ -435,9 +431,7 @@ public void writeTo(StreamOutput out) throws IOException { if (out.getVersion().onOrAfter(Version.V_6_2_0)) { out.writeMap(headers, StreamOutput::writeString, StreamOutput::writeString); } - if (out.getVersion().onOrAfter(Version.V_6_6_0)) { - out.writeOptionalWriteable(delayedDataCheckConfig); - } + out.writeOptionalWriteable(delayedDataCheckConfig); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedUpdate.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedUpdate.java index ccbb516197217..c1005bb971a56 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedUpdate.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/DatafeedUpdate.java @@ -134,11 +134,7 @@ public DatafeedUpdate(StreamInput in) throws IOException { } this.scrollSize = in.readOptionalVInt(); this.chunkingConfig = in.readOptionalWriteable(ChunkingConfig::new); - if (in.getVersion().onOrAfter(Version.V_6_6_0)) { - delayedDataCheckConfig = in.readOptionalWriteable(DelayedDataCheckConfig::new); - } else { - delayedDataCheckConfig = null; - } + delayedDataCheckConfig = in.readOptionalWriteable(DelayedDataCheckConfig::new); } /** @@ -181,9 +177,7 @@ public void writeTo(StreamOutput out) throws IOException { } out.writeOptionalVInt(scrollSize); out.writeOptionalWriteable(chunkingConfig); - if (out.getVersion().onOrAfter(Version.V_6_6_0)) { - out.writeOptionalWriteable(delayedDataCheckConfig); - } + out.writeOptionalWriteable(delayedDataCheckConfig); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/QueryProvider.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/QueryProvider.java index ff6d2f595af81..755c5a3526d01 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/QueryProvider.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/QueryProvider.java @@ -7,8 +7,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.Version; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Writeable; @@ -74,13 +72,7 @@ static QueryProvider fromParsedQuery(QueryBuilder parsedQuery) throws IOExceptio } static QueryProvider fromStream(StreamInput in) throws IOException { - if (in.getVersion().onOrAfter(Version.V_6_7_0)) { // Has our bug fix for query/agg providers - return new QueryProvider(in.readMap(), in.readOptionalNamedWriteable(QueryBuilder.class), in.readException()); - } else if (in.getVersion().onOrAfter(Version.V_6_6_0)) { // Has the bug, but supports lazy objects - return new QueryProvider(in.readMap(), null, null); - } else { // only supports eagerly parsed objects - return QueryProvider.fromParsedQuery(in.readNamedWriteable(QueryBuilder.class)); - } + return new QueryProvider(in.readMap(), in.readOptionalNamedWriteable(QueryBuilder.class), in.readException()); } QueryProvider(Map query, QueryBuilder parsedQuery, Exception parsingException) { @@ -95,28 +87,9 @@ static QueryProvider fromStream(StreamInput in) throws IOException { @Override public void writeTo(StreamOutput out) throws IOException { - if (out.getVersion().onOrAfter(Version.V_6_7_0)) { // Has our bug fix for query/agg providers - out.writeMap(query); - out.writeOptionalNamedWriteable(parsedQuery); - out.writeException(parsingException); - } else if (out.getVersion().onOrAfter(Version.V_6_6_0)) { // Has the bug, but supports lazy objects - // We allow the lazy parsing nodes that have the bug throw any parsing errors themselves as - // they already have the ability to fully parse the passed Maps - out.writeMap(query); - } else { // only supports eagerly parsed objects - if (parsingException != null) { // Do we have a parsing error? Throw it - if (parsingException instanceof IOException) { - throw (IOException) parsingException; - } else { - throw new ElasticsearchException(parsingException); - } - } else if (parsedQuery == null) { // Do we have a query defined but not parsed? - // This is an admittedly rare case but we should fail early instead of writing null when there - // actually is a query defined - throw new ElasticsearchException("Unsupported operation: parsed query is null"); - } - out.writeNamedWriteable(parsedQuery); - } + out.writeMap(query); + out.writeOptionalNamedWriteable(parsedQuery); + out.writeException(parsingException); } public Exception getParsingException() { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/JobUpdate.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/JobUpdate.java index 36e1fc1096675..2ff4c85dada8c 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/JobUpdate.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/JobUpdate.java @@ -140,11 +140,7 @@ public JobUpdate(StreamInput in) throws IOException { } else { jobVersion = null; } - if (in.getVersion().onOrAfter(Version.V_6_6_0)) { - clearJobFinishTime = in.readOptionalBoolean(); - } else { - clearJobFinishTime = null; - } + clearJobFinishTime = in.readOptionalBoolean(); if (in.getVersion().onOrAfter(Version.V_7_0_0) && in.readBoolean()) { modelSnapshotMinVersion = Version.readVersion(in); } else { @@ -188,9 +184,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeBoolean(false); } } - if (out.getVersion().onOrAfter(Version.V_6_6_0)) { - out.writeOptionalBoolean(clearJobFinishTime); - } + out.writeOptionalBoolean(clearJobFinishTime); if (out.getVersion().onOrAfter(Version.V_7_0_0)) { if (modelSnapshotMinVersion != null) { out.writeBoolean(true); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/StopRollupJobAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/StopRollupJobAction.java index 6fc079e0328c9..8756a4046e2e0 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/StopRollupJobAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/StopRollupJobAction.java @@ -70,20 +70,16 @@ public Request() {} public Request(StreamInput in) throws IOException { super(in); id = in.readString(); - if (in.getVersion().onOrAfter(Version.V_6_6_0)) { - waitForCompletion = in.readBoolean(); - timeout = in.readTimeValue(); - } + waitForCompletion = in.readBoolean(); + timeout = in.readTimeValue(); } @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); out.writeString(id); - if (out.getVersion().onOrAfter(Version.V_6_6_0)) { - out.writeBoolean(waitForCompletion); - out.writeTimeValue(timeout); - } + out.writeBoolean(waitForCompletion); + out.writeTimeValue(timeout); } public String getId() { diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/datafeed/AggProviderTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/datafeed/AggProviderTests.java index dc87cf744cb98..bab7c1ed465d4 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/datafeed/AggProviderTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/datafeed/AggProviderTests.java @@ -96,26 +96,6 @@ public void testEmptyAggMap() throws IOException { assertThat(e.getMessage(), equalTo("Datafeed aggregations are not parsable")); } - public void testSerializationBetweenBugVersion() throws IOException { - AggProvider tempAggProvider = createRandomValidAggProvider(); - AggProvider aggProviderWithEx = new AggProvider(tempAggProvider.getAggs(), tempAggProvider.getParsedAggs(), new IOException("ex")); - try (BytesStreamOutput output = new BytesStreamOutput()) { - output.setVersion(Version.V_6_6_2); - aggProviderWithEx.writeTo(output); - try (StreamInput in = new NamedWriteableAwareStreamInput(output.bytes().streamInput(), writableRegistry())) { - in.setVersion(Version.V_6_6_2); - AggProvider streamedAggProvider = AggProvider.fromStream(in); - assertThat(streamedAggProvider.getAggs(), equalTo(aggProviderWithEx.getAggs())); - assertThat(streamedAggProvider.getParsingException(), is(nullValue())); - - AggregatorFactories.Builder streamedParsedAggs = XContentObjectTransformer.aggregatorTransformer(xContentRegistry()) - .fromMap(streamedAggProvider.getAggs()); - assertThat(streamedParsedAggs, equalTo(aggProviderWithEx.getParsedAggs())); - assertThat(streamedAggProvider.getParsedAggs(), is(nullValue())); - } - } - } - public void testSerializationBetweenEagerVersion() throws IOException { AggProvider validAggProvider = createRandomValidAggProvider(); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/datafeed/QueryProviderTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/datafeed/QueryProviderTests.java index fb6c2e280d975..c33e70da0207d 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/datafeed/QueryProviderTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/datafeed/QueryProviderTests.java @@ -96,28 +96,6 @@ public void testEmptyQueryMap() throws IOException { assertThat(e.getMessage(), equalTo("Datafeed query is not parsable")); } - public void testSerializationBetweenBugVersion() throws IOException { - QueryProvider tempQueryProvider = createRandomValidQueryProvider(); - QueryProvider queryProviderWithEx = new QueryProvider(tempQueryProvider.getQuery(), - tempQueryProvider.getParsedQuery(), - new IOException("ex")); - try (BytesStreamOutput output = new BytesStreamOutput()) { - output.setVersion(Version.V_6_6_2); - queryProviderWithEx.writeTo(output); - try (StreamInput in = new NamedWriteableAwareStreamInput(output.bytes().streamInput(), writableRegistry())) { - in.setVersion(Version.V_6_6_2); - QueryProvider streamedQueryProvider = QueryProvider.fromStream(in); - assertThat(streamedQueryProvider.getQuery(), equalTo(queryProviderWithEx.getQuery())); - assertThat(streamedQueryProvider.getParsingException(), is(nullValue())); - - QueryBuilder streamedParsedQuery = XContentObjectTransformer.queryBuilderTransformer(xContentRegistry()) - .fromMap(streamedQueryProvider.getQuery()); - assertThat(streamedParsedQuery, equalTo(queryProviderWithEx.getParsedQuery())); - assertThat(streamedQueryProvider.getParsedQuery(), is(nullValue())); - } - } - } - public void testSerializationBetweenEagerVersion() throws IOException { QueryProvider validQueryProvider = createRandomValidQueryProvider(); diff --git a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/indexlifecycle/IndexLifecycleMetadataTests.java b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/indexlifecycle/IndexLifecycleMetadataTests.java index 2444cbf99fd52..65f8399a6bd76 100644 --- a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/indexlifecycle/IndexLifecycleMetadataTests.java +++ b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/indexlifecycle/IndexLifecycleMetadataTests.java @@ -17,6 +17,7 @@ import org.elasticsearch.common.xcontent.NamedXContentRegistry; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.test.AbstractDiffableSerializationTestCase; +import org.elasticsearch.test.VersionUtils; import org.elasticsearch.xpack.core.indexlifecycle.AllocateAction; import org.elasticsearch.xpack.core.indexlifecycle.DeleteAction; import org.elasticsearch.xpack.core.indexlifecycle.ForceMergeAction; @@ -137,7 +138,8 @@ protected Reader> diffReader() { } public void testMinimumSupportedVersion() { - assertEquals(Version.V_6_6_0, createTestInstance().getMinimalSupportedVersion()); + Version min = createTestInstance().getMinimalSupportedVersion(); + assertTrue(min.onOrBefore(VersionUtils.randomCompatibleVersion(random(), Version.CURRENT))); } public void testcontext() { diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlConfigMigrationEligibilityCheck.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlConfigMigrationEligibilityCheck.java index daa143ec01977..0336849c2d5a1 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlConfigMigrationEligibilityCheck.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlConfigMigrationEligibilityCheck.java @@ -23,8 +23,6 @@ */ public class MlConfigMigrationEligibilityCheck { - private static final Version MIN_NODE_VERSION = Version.V_6_6_0; - public static final Setting ENABLE_CONFIG_MIGRATION = Setting.boolSetting( "xpack.ml.enable_config_migration", true, Setting.Property.Dynamic, Setting.Property.NodeScope); @@ -43,7 +41,6 @@ private void setConfigMigrationEnabled(boolean configMigrationEnabled) { /** * Can migration start? Returns: * False if config migration is disabled via the setting {@link #ENABLE_CONFIG_MIGRATION} - * False if the min node version of the cluster is before {@link #MIN_NODE_VERSION} * False if the .ml-config index shards are not active * True otherwise * @param clusterState The cluster state @@ -53,12 +50,6 @@ public boolean canStartMigration(ClusterState clusterState) { if (isConfigMigrationEnabled == false) { return false; } - - Version minNodeVersion = clusterState.nodes().getMinNodeVersion(); - if (minNodeVersion.before(MIN_NODE_VERSION)) { - return false; - } - return mlConfigIndexIsAllocated(clusterState); } diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/MlConfigMigrationEligibilityCheckTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/MlConfigMigrationEligibilityCheckTests.java index 4d07a93e1019c..340faab11ac8f 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/MlConfigMigrationEligibilityCheckTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/MlConfigMigrationEligibilityCheckTests.java @@ -28,6 +28,7 @@ import org.elasticsearch.persistent.PersistentTasksCustomMetaData; import org.elasticsearch.search.SearchModule; import org.elasticsearch.test.ESTestCase; +import org.elasticsearch.test.VersionUtils; import org.elasticsearch.xpack.core.ml.MlMetadata; import org.elasticsearch.xpack.core.ml.MlTasks; import org.elasticsearch.xpack.core.ml.action.OpenJobAction; @@ -76,10 +77,11 @@ public void testCanStartMigration_givenNodesNotUpToVersion() { addMlConfigIndex(metaData, routingTable); // mixed 6.5 and 6.6 nodes + Version prevVersion = VersionUtils.getPreviousVersion(Version.CURRENT); ClusterState clusterState = ClusterState.builder(new ClusterName("_name")) .nodes(DiscoveryNodes.builder() - .add(new DiscoveryNode("node_id1", new TransportAddress(InetAddress.getLoopbackAddress(), 9300), Version.V_6_5_0)) - .add(new DiscoveryNode("node_id2", new TransportAddress(InetAddress.getLoopbackAddress(), 9301), Version.V_6_6_0))) + .add(new DiscoveryNode("node_id1", new TransportAddress(InetAddress.getLoopbackAddress(), 9300), prevVersion)) + .add(new DiscoveryNode("node_id2", new TransportAddress(InetAddress.getLoopbackAddress(), 9301), Version.CURRENT))) .routingTable(routingTable.build()) .metaData(metaData) .build(); @@ -97,11 +99,11 @@ public void testCanStartMigration_givenNodesNotUpToVersionAndMigrationIsEnabled( RoutingTable.Builder routingTable = RoutingTable.builder(); addMlConfigIndex(metaData, routingTable); - // mixed 6.5 and 6.6 nodes + Version prevVersion = VersionUtils.getPreviousVersion(Version.CURRENT); ClusterState clusterState = ClusterState.builder(new ClusterName("_name")) .nodes(DiscoveryNodes.builder() - .add(new DiscoveryNode("node_id1", new TransportAddress(InetAddress.getLoopbackAddress(), 9300), Version.V_6_6_0)) - .add(new DiscoveryNode("node_id2", new TransportAddress(InetAddress.getLoopbackAddress(), 9301), Version.V_6_6_0))) + .add(new DiscoveryNode("node_id1", new TransportAddress(InetAddress.getLoopbackAddress(), 9300), prevVersion)) + .add(new DiscoveryNode("node_id2", new TransportAddress(InetAddress.getLoopbackAddress(), 9301), Version.CURRENT))) .routingTable(routingTable.build()) .metaData(metaData) .build(); @@ -161,11 +163,11 @@ private void addMlConfigIndex(MetaData.Builder metaData, RoutingTable.Builder ro public void testJobIsEligibleForMigration_givenNodesNotUpToVersion() { - // mixed 6.5 and 6.6 nodes + Version prevVersion = VersionUtils.getPreviousVersion(Version.CURRENT); ClusterState clusterState = ClusterState.builder(new ClusterName("_name")) .nodes(DiscoveryNodes.builder() - .add(new DiscoveryNode("node_id1", new TransportAddress(InetAddress.getLoopbackAddress(), 9300), Version.V_6_5_0)) - .add(new DiscoveryNode("node_id2", new TransportAddress(InetAddress.getLoopbackAddress(), 9301), Version.V_6_6_0))) + .add(new DiscoveryNode("node_id1", new TransportAddress(InetAddress.getLoopbackAddress(), 9300), prevVersion)) + .add(new DiscoveryNode("node_id2", new TransportAddress(InetAddress.getLoopbackAddress(), 9301), Version.CURRENT))) .build(); Settings settings = newSettings(true); @@ -307,11 +309,11 @@ public void testJobIsEligibleForMigration_givenOpenAndUnallocatedJob() { } public void testDatafeedIsEligibleForMigration_givenNodesNotUpToVersion() { - // mixed 6.5 and 6.6 nodes + Version prevVersion = VersionUtils.getPreviousVersion(Version.CURRENT); ClusterState clusterState = ClusterState.builder(new ClusterName("_name")) .nodes(DiscoveryNodes.builder() - .add(new DiscoveryNode("node_id1", new TransportAddress(InetAddress.getLoopbackAddress(), 9300), Version.V_6_5_0)) - .add(new DiscoveryNode("node_id2", new TransportAddress(InetAddress.getLoopbackAddress(), 9301), Version.V_6_6_0))) + .add(new DiscoveryNode("node_id1", new TransportAddress(InetAddress.getLoopbackAddress(), 9300), prevVersion)) + .add(new DiscoveryNode("node_id2", new TransportAddress(InetAddress.getLoopbackAddress(), 9301), Version.CURRENT))) .build(); Settings settings = newSettings(true); diff --git a/x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/MlMigrationFullClusterRestartIT.java b/x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/MlMigrationFullClusterRestartIT.java index 3c849811f5620..14f5d66a0fff2 100644 --- a/x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/MlMigrationFullClusterRestartIT.java +++ b/x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/MlMigrationFullClusterRestartIT.java @@ -5,7 +5,6 @@ */ package org.elasticsearch.xpack.restart; -import org.elasticsearch.Version; import org.elasticsearch.client.Request; import org.elasticsearch.client.Response; import org.elasticsearch.common.Strings; @@ -30,12 +29,10 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; -import java.util.Arrays; import java.util.Base64; import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.concurrent.TimeUnit; import static org.hamcrest.Matchers.isEmptyOrNullString; @@ -128,10 +125,6 @@ private void oldClusterTests() throws IOException { } private void upgradedClusterTests() throws Exception { - // wait for the closed and open jobs and datafeed to be migrated - waitForMigration(Arrays.asList(OLD_CLUSTER_CLOSED_JOB_ID, OLD_CLUSTER_OPEN_JOB_ID), - Arrays.asList(OLD_CLUSTER_STOPPED_DATAFEED_ID, OLD_CLUSTER_STARTED_DATAFEED_ID)); - waitForJobToBeAssigned(OLD_CLUSTER_OPEN_JOB_ID); waitForDatafeedToBeAssigned(OLD_CLUSTER_STARTED_DATAFEED_ID); // The persistent task params for the job & datafeed left open @@ -181,40 +174,6 @@ private void waitForDatafeedToBeAssigned(String datafeedId) throws Exception { }, 30, TimeUnit.SECONDS); } - @SuppressWarnings("unchecked") - private void waitForMigration(List expectedMigratedJobs, List expectedMigratedDatafeeds) throws Exception { - - // After v6.6.0 jobs are created in the index so no migration will take place - if (getOldClusterVersion().onOrAfter(Version.V_6_6_0)) { - return; - } - - assertBusy(() -> { - // wait for the eligible configs to be moved from the clusterstate - Request getClusterState = new Request("GET", "/_cluster/state/metadata"); - Response response = client().performRequest(getClusterState); - Map responseMap = entityAsMap(response); - - List> jobs = - (List>) XContentMapValues.extractValue("metadata.ml.jobs", responseMap); - - if (jobs != null) { - for (String jobId : expectedMigratedJobs) { - assertJobNotPresent(jobId, jobs); - } - } - - List> datafeeds = - (List>) XContentMapValues.extractValue("metadata.ml.datafeeds", responseMap); - - if (datafeeds != null) { - for (String datafeedId : expectedMigratedDatafeeds) { - assertDatafeedNotPresent(datafeedId, datafeeds); - } - } - }, 30, TimeUnit.SECONDS); - } - @SuppressWarnings("unchecked") private void checkTaskParamsAreUpdated(String jobId, String datafeedId) throws Exception { Request getClusterState = new Request("GET", "/_cluster/state/metadata"); @@ -240,18 +199,6 @@ else if (id.equals(MlTasks.datafeedTaskId(datafeedId))) { } } - private void assertDatafeedNotPresent(String datafeedId, List> datafeeds) { - Optional config = datafeeds.stream().map(map -> map.get("datafeed_id")) - .filter(id -> id.equals(datafeedId)).findFirst(); - assertFalse(config.isPresent()); - } - - private void assertJobNotPresent(String jobId, List> jobs) { - Optional config = jobs.stream().map(map -> map.get("job_id")) - .filter(id -> id.equals(jobId)).findFirst(); - assertFalse(config.isPresent()); - } - private void addAggregations(DatafeedConfig.Builder dfBuilder) { TermsAggregationBuilder airline = AggregationBuilders.terms("airline"); MaxAggregationBuilder maxTime = AggregationBuilders.max("time").field("time").subAggregation(airline);