From 681f5096e24967fc99699e682906776c1a75d39e Mon Sep 17 00:00:00 2001 From: Luigi Dell'Aquila Date: Thu, 31 Oct 2024 13:16:01 +0100 Subject: [PATCH 1/7] ES|QL: Mute test for #116003 (#116005) --- .../xpack/esql/action/TelemetryIT.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/TelemetryIT.java b/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/TelemetryIT.java index 325e8500295ea..25603acece3cb 100644 --- a/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/TelemetryIT.java +++ b/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/TelemetryIT.java @@ -128,20 +128,22 @@ public static Iterable parameters() { : Collections.emptyMap(), Build.current().isSnapshot() ? Map.ofEntries(Map.entry("MAX", 1)) : Collections.emptyMap(), Build.current().isSnapshot() - ) }, - new Object[] { - new Test( - """ - FROM idx - | EVAL ip = to_ip(host), x = to_string(host), y = to_string(host) - | INLINESTATS max(id) - """, - Build.current().isSnapshot() ? Map.of("FROM", 1, "EVAL", 1, "INLINESTATS", 1, "STATS", 1) : Collections.emptyMap(), - Build.current().isSnapshot() - ? Map.ofEntries(Map.entry("MAX", 1), Map.entry("TO_IP", 1), Map.entry("TO_STRING", 2)) - : Collections.emptyMap(), - Build.current().isSnapshot() ) } + // awaits fix for https://github.com/elastic/elasticsearch/issues/116003 + // , + // new Object[] { + // new Test( + // """ + // FROM idx + // | EVAL ip = to_ip(host), x = to_string(host), y = to_string(host) + // | INLINESTATS max(id) + // """, + // Build.current().isSnapshot() ? Map.of("FROM", 1, "EVAL", 1, "INLINESTATS", 1, "STATS", 1) : Collections.emptyMap(), + // Build.current().isSnapshot() + // ? Map.ofEntries(Map.entry("MAX", 1), Map.entry("TO_IP", 1), Map.entry("TO_STRING", 2)) + // : Collections.emptyMap(), + // Build.current().isSnapshot() + // ) } ); } From 1c644cc78702cca6ac7fd17d58b001c0581b1259 Mon Sep 17 00:00:00 2001 From: Michael Peterson Date: Thu, 31 Oct 2024 08:42:36 -0400 Subject: [PATCH 2/7] Unmute esql-across-clusters yaml docs test (#115880) --- muted-tests.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/muted-tests.yml b/muted-tests.yml index a97164586848c..dd26d342df79b 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -228,9 +228,6 @@ tests: - class: org.elasticsearch.xpack.restart.MLModelDeploymentFullClusterRestartIT method: testDeploymentSurvivesRestart {cluster=UPGRADED} issue: https://github.com/elastic/elasticsearch/issues/115528 -- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT - method: test {yaml=reference/esql/esql-across-clusters/line_197} - issue: https://github.com/elastic/elasticsearch/issues/115575 - class: org.elasticsearch.oldrepos.OldRepositoryAccessIT method: testOldRepoAccess issue: https://github.com/elastic/elasticsearch/issues/115631 From 37a4ee3102a070c29c7d414bfaeb809a3a59e76b Mon Sep 17 00:00:00 2001 From: Kostas Krikellas <131142368+kkrik-es@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:28:30 +0200 Subject: [PATCH 3/7] Check index setting for source mode in SourceOnlySnapshotRepository (#116002) * Check index setting for source mode in SourceOnlySnapshotRepository * update * Revert "update" This reverts commit 9bbf0490f7d21b8c08489e05da563e3a76815847. --- .../index/mapper/SourceFieldMapper.java | 6 ++- .../SourceOnlySnapshotRepository.java | 6 ++- .../SourceOnlySnapshotShardTests.java | 50 +++++++++++++++++++ 3 files changed, 59 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/index/mapper/SourceFieldMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/SourceFieldMapper.java index 372e0bbdfecf4..1162734c0dc81 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/SourceFieldMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/SourceFieldMapper.java @@ -242,7 +242,7 @@ public SourceFieldMapper build() { } private Mode resolveSourceMode() { - // If the `index.mapper.source.mode` exists it takes precedence to determine the source mode for `_source` + // If the `index.mapping.source.mode` exists it takes precedence to determine the source mode for `_source` // otherwise the mode is determined according to `_source.mode`. if (INDEX_MAPPER_SOURCE_MODE_SETTING.exists(settings)) { return INDEX_MAPPER_SOURCE_MODE_SETTING.get(settings); @@ -439,6 +439,10 @@ public static boolean isSynthetic(IndexSettings indexSettings) { return INDEX_MAPPER_SOURCE_MODE_SETTING.get(indexSettings.getSettings()) == SourceFieldMapper.Mode.SYNTHETIC; } + public static boolean isStored(IndexSettings indexSettings) { + return INDEX_MAPPER_SOURCE_MODE_SETTING.get(indexSettings.getSettings()) == Mode.STORED; + } + public boolean isDisabled() { return mode == Mode.DISABLED; } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/snapshots/sourceonly/SourceOnlySnapshotRepository.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/snapshots/sourceonly/SourceOnlySnapshotRepository.java index 698193d5c1c28..579e3fb43b194 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/snapshots/sourceonly/SourceOnlySnapshotRepository.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/snapshots/sourceonly/SourceOnlySnapshotRepository.java @@ -33,6 +33,7 @@ import org.elasticsearch.index.engine.EngineFactory; import org.elasticsearch.index.engine.ReadOnlyEngine; import org.elasticsearch.index.mapper.MapperService; +import org.elasticsearch.index.mapper.SourceFieldMapper; import org.elasticsearch.index.store.Store; import org.elasticsearch.index.translog.TranslogStats; import org.elasticsearch.repositories.FilterRepository; @@ -134,8 +135,9 @@ private static Metadata metadataToSnapshot(Collection indices, Metadata @Override public void snapshotShard(SnapshotShardContext context) { final MapperService mapperService = context.mapperService(); - if (mapperService.documentMapper() != null // if there is no mapping this is null - && mapperService.documentMapper().sourceMapper().isComplete() == false) { + if ((mapperService.documentMapper() != null // if there is no mapping this is null + && mapperService.documentMapper().sourceMapper().isComplete() == false) + || (mapperService.documentMapper() == null && SourceFieldMapper.isStored(mapperService.getIndexSettings()) == false)) { context.onFailure( new IllegalStateException( "Can't snapshot _source only on an index that has incomplete source ie. has _source disabled or filters the source" diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/snapshots/sourceonly/SourceOnlySnapshotShardTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/snapshots/sourceonly/SourceOnlySnapshotShardTests.java index 54390365c62af..81d194ce84131 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/snapshots/sourceonly/SourceOnlySnapshotShardTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/snapshots/sourceonly/SourceOnlySnapshotShardTests.java @@ -53,6 +53,7 @@ import org.elasticsearch.index.engine.InternalEngineFactory; import org.elasticsearch.index.fieldvisitor.FieldsVisitor; import org.elasticsearch.index.mapper.SeqNoFieldMapper; +import org.elasticsearch.index.mapper.SourceFieldMapper; import org.elasticsearch.index.mapper.SourceToParse; import org.elasticsearch.index.seqno.RetentionLeaseSyncer; import org.elasticsearch.index.seqno.SeqNoStats; @@ -150,6 +151,55 @@ public void testSourceIncomplete() throws IOException { closeShards(shard); } + public void testSourceIncompleteSyntheticSourceNoDoc() throws IOException { + ShardRouting shardRouting = shardRoutingBuilder( + new ShardId("index", "_na_", 0), + randomAlphaOfLength(10), + true, + ShardRoutingState.INITIALIZING + ).withRecoverySource(RecoverySource.EmptyStoreRecoverySource.INSTANCE).build(); + Settings settings = Settings.builder() + .put(IndexMetadata.SETTING_VERSION_CREATED, IndexVersion.current()) + .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) + .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + .put(SourceFieldMapper.INDEX_MAPPER_SOURCE_MODE_SETTING.getKey(), "synthetic") + .build(); + IndexMetadata metadata = IndexMetadata.builder(shardRouting.getIndexName()).settings(settings).primaryTerm(0, primaryTerm).build(); + IndexShard shard = newShard(shardRouting, metadata, null, new InternalEngineFactory()); + recoverShardFromStore(shard); + SnapshotId snapshotId = new SnapshotId("test", "test"); + IndexId indexId = new IndexId(shard.shardId().getIndexName(), shard.shardId().getIndex().getUUID()); + SourceOnlySnapshotRepository repository = new SourceOnlySnapshotRepository(createRepository()); + repository.start(); + try (Engine.IndexCommitRef snapshotRef = shard.acquireLastIndexCommit(true)) { + IndexShardSnapshotStatus indexShardSnapshotStatus = IndexShardSnapshotStatus.newInitializing(new ShardGeneration(-1L)); + final PlainActionFuture future = new PlainActionFuture<>(); + runAsSnapshot( + shard.getThreadPool(), + () -> repository.snapshotShard( + new SnapshotShardContext( + shard.store(), + shard.mapperService(), + snapshotId, + indexId, + new SnapshotIndexCommit(snapshotRef), + null, + indexShardSnapshotStatus, + IndexVersion.current(), + randomMillisUpToYear9999(), + future + ) + ) + ); + IllegalStateException illegalStateException = expectThrows(IllegalStateException.class, future::actionGet); + assertEquals( + "Can't snapshot _source only on an index that has incomplete source ie. has _source disabled or filters the source", + illegalStateException.getMessage() + ); + } + closeShards(shard); + } + public void testIncrementalSnapshot() throws IOException { IndexShard shard = newStartedShard(); for (int i = 0; i < 10; i++) { From 70516c795cc8a9b1318fa3f46599f09c524b3746 Mon Sep 17 00:00:00 2001 From: elasticsearchmachine <58790826+elasticsearchmachine@users.noreply.github.com> Date: Fri, 1 Nov 2024 00:37:24 +1100 Subject: [PATCH 4/7] Mute org.elasticsearch.search.query.SearchQueryIT testAllDocsQueryString #115728 --- muted-tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/muted-tests.yml b/muted-tests.yml index dd26d342df79b..c781a7d30a597 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -284,6 +284,9 @@ tests: - class: org.elasticsearch.index.reindex.ReindexNodeShutdownIT method: testReindexWithShutdown issue: https://github.com/elastic/elasticsearch/issues/115996 +- class: org.elasticsearch.search.query.SearchQueryIT + method: testAllDocsQueryString + issue: https://github.com/elastic/elasticsearch/issues/115728 # Examples: # From c77fb33070077e50c09def22c121ecc05e0be092 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Zolt=C3=A1n=20Szab=C3=B3?= Date: Thu, 31 Oct 2024 14:49:11 +0100 Subject: [PATCH 5/7] Adds hands-on learning for Search link to the landing page (#116007) Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com> --- docs/reference/landing-page.asciidoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/reference/landing-page.asciidoc b/docs/reference/landing-page.asciidoc index 1f2145a3aae82..6449a799ffd16 100644 --- a/docs/reference/landing-page.asciidoc +++ b/docs/reference/landing-page.asciidoc @@ -79,6 +79,11 @@

Get to know Elasticsearch

+

+Demos: + Hands-on learning for Search +

+

New webinar: Architect search apps with Google Cloud From d9f6451b2f67ec4d471718ceb2e80c79df5aeca6 Mon Sep 17 00:00:00 2001 From: Simon Cooper Date: Thu, 31 Oct 2024 13:56:58 +0000 Subject: [PATCH 6/7] Remove BuildVersion.id() (#115795) BuildVersion should be entirely opaque, it should be only possible to do equality comparisons --- .../org/elasticsearch/env/BuildVersion.java | 40 ++++++++++++++++--- .../env/DefaultBuildVersion.java | 24 +++++++++-- .../org/elasticsearch/env/NodeMetadata.java | 2 +- .../gateway/PersistedClusterStateService.java | 6 +-- .../internal/BuildExtension.java | 15 +++++++ .../service/ReservedStateVersion.java | 6 +-- .../elasticsearch/env/BuildVersionTests.java | 4 ++ .../ReservedClusterStateServiceTests.java | 5 ++- 8 files changed, 85 insertions(+), 17 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/env/BuildVersion.java b/server/src/main/java/org/elasticsearch/env/BuildVersion.java index 5536b06d4d587..7a6b27eab2330 100644 --- a/server/src/main/java/org/elasticsearch/env/BuildVersion.java +++ b/server/src/main/java/org/elasticsearch/env/BuildVersion.java @@ -11,9 +11,13 @@ import org.elasticsearch.Build; import org.elasticsearch.Version; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.internal.BuildExtension; import org.elasticsearch.plugins.ExtensionLoader; +import org.elasticsearch.xcontent.ToXContentFragment; +import java.io.IOException; import java.util.ServiceLoader; /** @@ -31,7 +35,7 @@ * provide versions that accommodate different release models or versioning * schemes.

*/ -public abstract class BuildVersion { +public abstract class BuildVersion implements ToXContentFragment, Writeable { /** * Check whether this version is on or after a minimum threshold. @@ -58,6 +62,11 @@ public abstract class BuildVersion { */ public abstract boolean isFutureVersion(); + /** + * Returns this build version in a form suitable for storing in node metadata + */ + public abstract String toNodeMetadata(); + /** * Create a {@link BuildVersion} from a version ID number. * @@ -72,6 +81,16 @@ public static BuildVersion fromVersionId(int versionId) { return CurrentExtensionHolder.BUILD_EXTENSION.fromVersionId(versionId); } + /** + * Create a {@link BuildVersion} from a version in node metadata + * + * @param version The string stored in node metadata + * @return a version representing a build or release of Elasticsearch + */ + public static BuildVersion fromNodeMetadata(String version) { + return CurrentExtensionHolder.BUILD_EXTENSION.fromNodeMetadata(version); + } + /** * Create a {@link BuildVersion} from a version string. * @@ -82,6 +101,16 @@ public static BuildVersion fromString(String version) { return CurrentExtensionHolder.BUILD_EXTENSION.fromString(version); } + /** + * Read a {@link BuildVersion} from an input stream + * + * @param input The stream to read + * @return a version representing a build or release of Elasticsearch + */ + public static BuildVersion fromStream(StreamInput input) throws IOException { + return CurrentExtensionHolder.BUILD_EXTENSION.fromStream(input); + } + /** * Get the current build version. * @@ -94,9 +123,6 @@ public static BuildVersion current() { return CurrentExtensionHolder.BUILD_EXTENSION.currentBuildVersion(); } - // only exists for NodeMetadata#toXContent - public abstract int id(); - private static class CurrentExtensionHolder { private static final BuildExtension BUILD_EXTENSION = findExtension(); @@ -125,6 +151,10 @@ public BuildVersion fromVersionId(int versionId) { public BuildVersion fromString(String version) { return new DefaultBuildVersion(version); } - } + @Override + public BuildVersion fromStream(StreamInput in) throws IOException { + return new DefaultBuildVersion(in); + } + } } diff --git a/server/src/main/java/org/elasticsearch/env/DefaultBuildVersion.java b/server/src/main/java/org/elasticsearch/env/DefaultBuildVersion.java index 9cf0d60719653..a7e1a4fee341d 100644 --- a/server/src/main/java/org/elasticsearch/env/DefaultBuildVersion.java +++ b/server/src/main/java/org/elasticsearch/env/DefaultBuildVersion.java @@ -10,7 +10,11 @@ package org.elasticsearch.env; import org.elasticsearch.Version; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.xcontent.XContentBuilder; +import java.io.IOException; import java.util.Objects; /** @@ -28,7 +32,7 @@ final class DefaultBuildVersion extends BuildVersion { public static BuildVersion CURRENT = new DefaultBuildVersion(Version.CURRENT.id()); - private final Version version; + final Version version; DefaultBuildVersion(int versionId) { assert versionId >= 0 : "Release version IDs must be non-negative integers"; @@ -39,6 +43,10 @@ final class DefaultBuildVersion extends BuildVersion { this.version = Version.fromString(Objects.requireNonNull(version)); } + DefaultBuildVersion(StreamInput in) throws IOException { + this(in.readVInt()); + } + @Override public boolean onOrAfterMinimumCompatible() { return Version.CURRENT.minimumCompatibilityVersion().onOrBefore(version); @@ -50,8 +58,18 @@ public boolean isFutureVersion() { } @Override - public int id() { - return version.id(); + public String toNodeMetadata() { + return Integer.toString(version.id()); + } + + @Override + public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { + return builder.value(version.id()); + } + + @Override + public void writeTo(StreamOutput out) throws IOException { + out.writeVInt(version.id()); } @Override diff --git a/server/src/main/java/org/elasticsearch/env/NodeMetadata.java b/server/src/main/java/org/elasticsearch/env/NodeMetadata.java index 5b2ee39c1b622..c71a3798be1f7 100644 --- a/server/src/main/java/org/elasticsearch/env/NodeMetadata.java +++ b/server/src/main/java/org/elasticsearch/env/NodeMetadata.java @@ -204,7 +204,7 @@ protected XContentBuilder newXContentBuilder(XContentType type, OutputStream str @Override public void toXContent(XContentBuilder builder, NodeMetadata nodeMetadata) throws IOException { builder.field(NODE_ID_KEY, nodeMetadata.nodeId); - builder.field(NODE_VERSION_KEY, nodeMetadata.nodeVersion.id()); + builder.field(NODE_VERSION_KEY, nodeMetadata.nodeVersion); builder.field(OLDEST_INDEX_VERSION_KEY, nodeMetadata.oldestIndexVersion.id()); } diff --git a/server/src/main/java/org/elasticsearch/gateway/PersistedClusterStateService.java b/server/src/main/java/org/elasticsearch/gateway/PersistedClusterStateService.java index 92b8686700a05..44be3a3812fd1 100644 --- a/server/src/main/java/org/elasticsearch/gateway/PersistedClusterStateService.java +++ b/server/src/main/java/org/elasticsearch/gateway/PersistedClusterStateService.java @@ -364,7 +364,7 @@ public static NodeMetadata nodeMetadata(Path... dataPaths) throws IOException { ); } else if (nodeId == null) { nodeId = thisNodeId; - version = BuildVersion.fromVersionId(Integer.parseInt(userData.get(NODE_VERSION_KEY))); + version = BuildVersion.fromNodeMetadata(userData.get(NODE_VERSION_KEY)); if (userData.containsKey(OLDEST_INDEX_VERSION_KEY)) { oldestIndexVersion = IndexVersion.fromId(Integer.parseInt(userData.get(OLDEST_INDEX_VERSION_KEY))); } else { @@ -395,7 +395,7 @@ public static void overrideVersion(BuildVersion newVersion, Path... dataPaths) t try (IndexWriter indexWriter = createIndexWriter(new NIOFSDirectory(dataPath.resolve(METADATA_DIRECTORY_NAME)), true)) { final Map commitData = new HashMap<>(userData); - commitData.put(NODE_VERSION_KEY, Integer.toString(newVersion.id())); + commitData.put(NODE_VERSION_KEY, newVersion.toNodeMetadata()); commitData.put(OVERRIDDEN_NODE_VERSION_KEY, Boolean.toString(true)); indexWriter.setLiveCommitData(commitData.entrySet()); indexWriter.commit(); @@ -852,7 +852,7 @@ void prepareCommit( final Map commitData = Maps.newMapWithExpectedSize(COMMIT_DATA_SIZE); commitData.put(CURRENT_TERM_KEY, Long.toString(currentTerm)); commitData.put(LAST_ACCEPTED_VERSION_KEY, Long.toString(lastAcceptedVersion)); - commitData.put(NODE_VERSION_KEY, Integer.toString(BuildVersion.current().id())); + commitData.put(NODE_VERSION_KEY, BuildVersion.current().toNodeMetadata()); commitData.put(OLDEST_INDEX_VERSION_KEY, Integer.toString(oldestIndexVersion.id())); commitData.put(NODE_ID_KEY, nodeId); commitData.put(CLUSTER_UUID_KEY, clusterUUID); diff --git a/server/src/main/java/org/elasticsearch/internal/BuildExtension.java b/server/src/main/java/org/elasticsearch/internal/BuildExtension.java index 427e186bc40cf..7b4f5a7fadb4c 100644 --- a/server/src/main/java/org/elasticsearch/internal/BuildExtension.java +++ b/server/src/main/java/org/elasticsearch/internal/BuildExtension.java @@ -10,8 +10,11 @@ package org.elasticsearch.internal; import org.elasticsearch.Build; +import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.env.BuildVersion; +import java.io.IOException; + /** * Allows plugging in current build info. */ @@ -39,8 +42,20 @@ default boolean hasReleaseVersioning() { */ BuildVersion fromVersionId(int versionId); + /** + * Returns the {@link BuildVersion} as read from node metadata + */ + default BuildVersion fromNodeMetadata(String version) { + return fromVersionId(Integer.parseInt(version)); + } + /** * Returns the {@link BuildVersion} for a given version string. */ BuildVersion fromString(String version); + + /** + * Reads a {@link BuildVersion} from the given stream + */ + BuildVersion fromStream(StreamInput in) throws IOException; } diff --git a/server/src/main/java/org/elasticsearch/reservedstate/service/ReservedStateVersion.java b/server/src/main/java/org/elasticsearch/reservedstate/service/ReservedStateVersion.java index 116d470755e1c..ed10df2552b6b 100644 --- a/server/src/main/java/org/elasticsearch/reservedstate/service/ReservedStateVersion.java +++ b/server/src/main/java/org/elasticsearch/reservedstate/service/ReservedStateVersion.java @@ -48,12 +48,12 @@ public static ReservedStateVersion parse(XContentParser parser) { } public static ReservedStateVersion readFrom(StreamInput input) throws IOException { - return new ReservedStateVersion(input.readLong(), BuildVersion.fromVersionId(input.readVInt())); + return new ReservedStateVersion(input.readLong(), BuildVersion.fromStream(input)); } @Override public void writeTo(StreamOutput out) throws IOException { - out.writeLong(version()); - out.writeVInt(buildVersion().id()); + out.writeLong(version); + buildVersion.writeTo(out); } } diff --git a/server/src/test/java/org/elasticsearch/env/BuildVersionTests.java b/server/src/test/java/org/elasticsearch/env/BuildVersionTests.java index dab0adc2446ce..9fd889426fd2d 100644 --- a/server/src/test/java/org/elasticsearch/env/BuildVersionTests.java +++ b/server/src/test/java/org/elasticsearch/env/BuildVersionTests.java @@ -42,4 +42,8 @@ public void testIsFutureVersion() { assertFalse(afterMinCompat.isFutureVersion()); assertTrue(futureVersion.isFutureVersion()); } + + public static BuildVersion increment(BuildVersion version) { + return BuildVersion.fromVersionId(((DefaultBuildVersion) version).version.id() + 1); + } } diff --git a/server/src/test/java/org/elasticsearch/reservedstate/service/ReservedClusterStateServiceTests.java b/server/src/test/java/org/elasticsearch/reservedstate/service/ReservedClusterStateServiceTests.java index 5c7dd6cb346b9..efe3566064170 100644 --- a/server/src/test/java/org/elasticsearch/reservedstate/service/ReservedClusterStateServiceTests.java +++ b/server/src/test/java/org/elasticsearch/reservedstate/service/ReservedClusterStateServiceTests.java @@ -26,6 +26,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.core.Releasable; import org.elasticsearch.env.BuildVersion; +import org.elasticsearch.env.BuildVersionTests; import org.elasticsearch.reservedstate.ReservedClusterStateHandler; import org.elasticsearch.reservedstate.TransformState; import org.elasticsearch.reservedstate.action.ReservedClusterSettingsAction; @@ -519,7 +520,7 @@ public void testCheckMetadataVersion() { task = new ReservedStateUpdateTask( "test", - new ReservedStateChunk(Map.of(), new ReservedStateVersion(124L, BuildVersion.fromVersionId(BuildVersion.current().id() + 1))), + new ReservedStateChunk(Map.of(), new ReservedStateVersion(124L, BuildVersionTests.increment(BuildVersion.current()))), ReservedStateVersionCheck.HIGHER_VERSION_ONLY, Map.of(), List.of(), @@ -529,7 +530,7 @@ public void testCheckMetadataVersion() { assertThat("Cluster state should not be modified", task.execute(state), sameInstance(state)); task = new ReservedStateUpdateTask( "test", - new ReservedStateChunk(Map.of(), new ReservedStateVersion(124L, BuildVersion.fromVersionId(BuildVersion.current().id() + 1))), + new ReservedStateChunk(Map.of(), new ReservedStateVersion(124L, BuildVersionTests.increment(BuildVersion.current()))), ReservedStateVersionCheck.HIGHER_OR_SAME_VERSION, Map.of(), List.of(), From 6a3a447f1885418164ca62294226b00ba2965089 Mon Sep 17 00:00:00 2001 From: Tim Grein Date: Thu, 31 Oct 2024 15:25:20 +0100 Subject: [PATCH 7/7] Remove double "the" from median absolute deviation description (#115826) --- .../esql/functions/examples/median_absolute_deviation.asciidoc | 2 +- .../expression/function/aggregate/MedianAbsoluteDeviation.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/esql/functions/examples/median_absolute_deviation.asciidoc b/docs/reference/esql/functions/examples/median_absolute_deviation.asciidoc index 9084c008e890a..cfd3d0a9159aa 100644 --- a/docs/reference/esql/functions/examples/median_absolute_deviation.asciidoc +++ b/docs/reference/esql/functions/examples/median_absolute_deviation.asciidoc @@ -10,7 +10,7 @@ include::{esql-specs}/median_absolute_deviation.csv-spec[tag=median-absolute-dev |=== include::{esql-specs}/median_absolute_deviation.csv-spec[tag=median-absolute-deviation-result] |=== -The expression can use inline functions. For example, to calculate the the median absolute deviation of the maximum values of a multivalued column, first use `MV_MAX` to get the maximum value per row, and use the result with the `MEDIAN_ABSOLUTE_DEVIATION` function +The expression can use inline functions. For example, to calculate the median absolute deviation of the maximum values of a multivalued column, first use `MV_MAX` to get the maximum value per row, and use the result with the `MEDIAN_ABSOLUTE_DEVIATION` function [source.merge.styled,esql] ---- include::{esql-specs}/median_absolute_deviation.csv-spec[tag=docsStatsMADNestedExpression] diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/MedianAbsoluteDeviation.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/MedianAbsoluteDeviation.java index dfcbd6d22abae..42960cafdfd3a 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/MedianAbsoluteDeviation.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/MedianAbsoluteDeviation.java @@ -58,7 +58,7 @@ public class MedianAbsoluteDeviation extends NumericAggregate implements Surroga examples = { @Example(file = "median_absolute_deviation", tag = "median-absolute-deviation"), @Example( - description = "The expression can use inline functions. For example, to calculate the the " + description = "The expression can use inline functions. For example, to calculate the " + "median absolute deviation of the maximum values of a multivalued column, first " + "use `MV_MAX` to get the maximum value per row, and use the result with the " + "`MEDIAN_ABSOLUTE_DEVIATION` function",