From 392b07b363d26bc68121a98caf5d691e42d5167b Mon Sep 17 00:00:00 2001 From: Jack Conradson Date: Fri, 26 Sep 2025 15:36:01 -0700 Subject: [PATCH] Migrate transport versions 8841050 through 8841041 (#135555) This has an unusual case where we took a dead primary id and combined it with a patch only id for a change that removed a boolean in 8.19. This worked because the primary id was created prior to the 9.1.0 release, so this still guarantees compatibility with all upgrade paths. ES-12334 --- .../action/GetDataStreamOptionsAction.java | 8 ++++++-- .../org/elasticsearch/TransportVersions.java | 20 ------------------- .../fetch/subphase/FetchSourceContext.java | 9 ++++++--- ...am_options_api_remove_include_defaults.csv | 9 +++++++++ .../esql_query_planning_duration.csv | 1 + ...ql_regex_match_with_case_insensitivity.csv | 1 + .../idp_custom_saml_attributes_allow_list.csv | 1 + .../referable/ilm_add_skip_setting.csv | 1 + .../definitions/referable/join_on_aliases.csv | 1 + .../referable/ml_inference_elastic_rerank.csv | 1 + ...nference_mistral_chat_completion_added.csv | 1 + .../referable/none_chunking_strategy.csv | 1 + .../search_source_exclude_vectors_param.csv | 1 + .../dead_esql_query_planning_duration.csv | 1 + .../dead_settings_in_data_streams.csv | 1 - .../ilm/IndexLifecycleExplainResponse.java | 9 +++++---- .../xpack/esql/action/EsqlExecutionInfo.java | 9 +++++---- .../esql/enrich/LookupFromIndexService.java | 9 +++++---- .../scalar/string/regex/RegexMatch.java | 17 ++++++++-------- .../saml/sp/SamlServiceProviderDocument.java | 14 ++++++------- .../sp/SamlServiceProviderDocumentTests.java | 12 ++++++++--- .../chunking/NoneChunkingSettings.java | 6 +++--- ...InferenceServiceRerankServiceSettings.java | 7 +++---- .../MistralChatCompletionServiceSettings.java | 9 +++++---- 24 files changed, 82 insertions(+), 67 deletions(-) create mode 100644 server/src/main/resources/transport/definitions/referable/data_stream_options_api_remove_include_defaults.csv create mode 100644 server/src/main/resources/transport/definitions/referable/esql_query_planning_duration.csv create mode 100644 server/src/main/resources/transport/definitions/referable/esql_regex_match_with_case_insensitivity.csv create mode 100644 server/src/main/resources/transport/definitions/referable/idp_custom_saml_attributes_allow_list.csv create mode 100644 server/src/main/resources/transport/definitions/referable/ilm_add_skip_setting.csv create mode 100644 server/src/main/resources/transport/definitions/referable/join_on_aliases.csv create mode 100644 server/src/main/resources/transport/definitions/referable/ml_inference_elastic_rerank.csv create mode 100644 server/src/main/resources/transport/definitions/referable/ml_inference_mistral_chat_completion_added.csv create mode 100644 server/src/main/resources/transport/definitions/referable/none_chunking_strategy.csv create mode 100644 server/src/main/resources/transport/definitions/referable/search_source_exclude_vectors_param.csv create mode 100644 server/src/main/resources/transport/definitions/unreferable/dead_esql_query_planning_duration.csv delete mode 100644 server/src/main/resources/transport/definitions/unreferable/dead_settings_in_data_streams.csv diff --git a/modules/data-streams/src/main/java/org/elasticsearch/datastreams/options/action/GetDataStreamOptionsAction.java b/modules/data-streams/src/main/java/org/elasticsearch/datastreams/options/action/GetDataStreamOptionsAction.java index 2f54c623b4e9f..dab0c66394c3a 100644 --- a/modules/data-streams/src/main/java/org/elasticsearch/datastreams/options/action/GetDataStreamOptionsAction.java +++ b/modules/data-streams/src/main/java/org/elasticsearch/datastreams/options/action/GetDataStreamOptionsAction.java @@ -8,7 +8,7 @@ */ package org.elasticsearch.datastreams.options.action; -import org.elasticsearch.TransportVersions; +import org.elasticsearch.TransportVersion; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.ActionType; @@ -50,6 +50,10 @@ private GetDataStreamOptionsAction() {/* no instances */} public static class Request extends LocalClusterStateRequest implements IndicesRequest.Replaceable { + private static final TransportVersion DATA_STREAM_OPTIONS_API_REMOVE_INCLUDE_DEFAULTS = TransportVersion.fromName( + "data_stream_options_api_remove_include_defaults" + ); + private String[] names; private IndicesOptions indicesOptions = IndicesOptions.builder() .concreteTargetOptions(IndicesOptions.ConcreteTargetOptions.ERROR_WHEN_UNAVAILABLE_TARGETS) @@ -95,7 +99,7 @@ public Request(StreamInput in) throws IOException { this.names = in.readOptionalStringArray(); this.indicesOptions = IndicesOptions.readIndicesOptions(in); // This boolean was removed in 8.19 - if (in.getTransportVersion().isPatchFrom(TransportVersions.DATA_STREAM_OPTIONS_API_REMOVE_INCLUDE_DEFAULTS_8_19) == false) { + if (in.getTransportVersion().supports(DATA_STREAM_OPTIONS_API_REMOVE_INCLUDE_DEFAULTS) == false) { in.readBoolean(); } } diff --git a/server/src/main/java/org/elasticsearch/TransportVersions.java b/server/src/main/java/org/elasticsearch/TransportVersions.java index 297d0424c526e..0cbd6ace85bd7 100644 --- a/server/src/main/java/org/elasticsearch/TransportVersions.java +++ b/server/src/main/java/org/elasticsearch/TransportVersions.java @@ -182,16 +182,6 @@ static TransportVersion def(int id) { public static final TransportVersion ML_INFERENCE_VERTEXAI_CHATCOMPLETION_ADDED_8_19 = def(8_841_0_38); public static final TransportVersion INFERENCE_CUSTOM_SERVICE_ADDED_8_19 = def(8_841_0_39); public static final TransportVersion IDP_CUSTOM_SAML_ATTRIBUTES_ADDED_8_19 = def(8_841_0_40); - public static final TransportVersion DATA_STREAM_OPTIONS_API_REMOVE_INCLUDE_DEFAULTS_8_19 = def(8_841_0_41); - public static final TransportVersion JOIN_ON_ALIASES_8_19 = def(8_841_0_42); - public static final TransportVersion ILM_ADD_SKIP_SETTING_8_19 = def(8_841_0_43); - public static final TransportVersion ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY_8_19 = def(8_841_0_44); - public static final TransportVersion ESQL_QUERY_PLANNING_DURATION_8_19 = def(8_841_0_45); - public static final TransportVersion SEARCH_SOURCE_EXCLUDE_VECTORS_PARAM_8_19 = def(8_841_0_46); - public static final TransportVersion ML_INFERENCE_MISTRAL_CHAT_COMPLETION_ADDED_8_19 = def(8_841_0_47); - public static final TransportVersion ML_INFERENCE_ELASTIC_RERANK_ADDED_8_19 = def(8_841_0_48); - public static final TransportVersion NONE_CHUNKING_STRATEGY_8_19 = def(8_841_0_49); - public static final TransportVersion IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST_8_19 = def(8_841_0_50); public static final TransportVersion INITIAL_ELASTICSEARCH_9_0 = def(9_000_0_00); public static final TransportVersion REMOVE_SNAPSHOT_FAILURES_90 = def(9_000_0_01); public static final TransportVersion TRANSPORT_STATS_HANDLING_TIME_REQUIRED_90 = def(9_000_0_02); @@ -251,11 +241,9 @@ static TransportVersion def(int id) { public static final TransportVersion REPO_ANALYSIS_COPY_BLOB = def(9_048_0_00); public static final TransportVersion AMAZON_BEDROCK_TASK_SETTINGS = def(9_049_0_00); public static final TransportVersion ESQL_REPORT_SHARD_PARTITIONING = def(9_050_0_00); - public static final TransportVersion DEAD_ESQL_QUERY_PLANNING_DURATION = def(9_051_0_00); public static final TransportVersion DEAD_ESQL_DOCUMENTS_FOUND_AND_VALUES_LOADED = def(9_052_0_00); public static final TransportVersion DEAD_BATCHED_QUERY_EXECUTION_DELAYABLE_WRITABLE = def(9_053_0_00); public static final TransportVersion DEAD_SEARCH_INCREMENTAL_TOP_DOCS_NULL = def(9_054_0_00); - public static final TransportVersion ESQL_QUERY_PLANNING_DURATION = def(9_055_0_00); public static final TransportVersion BATCHED_QUERY_EXECUTION_DELAYABLE_WRITABLE = def(9_057_0_00); public static final TransportVersion SEARCH_INCREMENTAL_TOP_DOCS_NULL = def(9_058_0_00); public static final TransportVersion COMPRESS_DELAYABLE_WRITEABLE = def(9_059_0_00); @@ -282,18 +270,10 @@ static TransportVersion def(int id) { public static final TransportVersion ML_INFERENCE_VERTEXAI_CHATCOMPLETION_ADDED = def(9_083_0_00); public static final TransportVersion INFERENCE_CUSTOM_SERVICE_ADDED = def(9_084_0_00); public static final TransportVersion ESQL_LIMIT_ROW_SIZE = def(9_085_0_00); - public static final TransportVersion ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY = def(9_086_0_00); public static final TransportVersion IDP_CUSTOM_SAML_ATTRIBUTES = def(9_087_0_00); - public static final TransportVersion JOIN_ON_ALIASES = def(9_088_0_00); - public static final TransportVersion ILM_ADD_SKIP_SETTING = def(9_089_0_00); - public static final TransportVersion ML_INFERENCE_MISTRAL_CHAT_COMPLETION_ADDED = def(9_090_0_00); - public static final TransportVersion IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST = def(9_091_0_00); - public static final TransportVersion SEARCH_SOURCE_EXCLUDE_VECTORS_PARAM = def(9_092_0_00); public static final TransportVersion SNAPSHOT_INDEX_SHARD_STATUS_MISSING_STATS = def(9_093_0_00); - public static final TransportVersion ML_INFERENCE_ELASTIC_RERANK = def(9_094_0_00); public static final TransportVersion SEARCH_LOAD_PER_INDEX_STATS = def(9_095_0_00); public static final TransportVersion HEAP_USAGE_IN_CLUSTER_INFO = def(9_096_0_00); - public static final TransportVersion NONE_CHUNKING_STRATEGY = def(9_097_0_00); public static final TransportVersion PROJECT_DELETION_GLOBAL_BLOCK = def(9_098_0_00); public static final TransportVersion SECURITY_CLOUD_API_KEY_REALM_AND_TYPE = def(9_099_0_00); public static final TransportVersion STATE_PARAM_GET_SNAPSHOT = def(9_100_0_00); diff --git a/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchSourceContext.java b/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchSourceContext.java index 367635a2d8c3a..66241cefced50 100644 --- a/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchSourceContext.java +++ b/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchSourceContext.java @@ -10,7 +10,6 @@ package org.elasticsearch.search.fetch.subphase; import org.elasticsearch.TransportVersion; -import org.elasticsearch.TransportVersions; import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.stream.StreamInput; @@ -47,6 +46,11 @@ public class FetchSourceContext implements Writeable, ToXContentObject { Strings.EMPTY_ARRAY, Strings.EMPTY_ARRAY ); + + private static final TransportVersion SEARCH_SOURCE_EXCLUDE_VECTORS_PARAM = TransportVersion.fromName( + "search_source_exclude_vectors_param" + ); + private final boolean fetchSource; private final String[] includes; private final String[] excludes; @@ -98,8 +102,7 @@ public void writeTo(StreamOutput out) throws IOException { } private static boolean isVersionCompatibleWithExcludeVectors(TransportVersion version) { - return version.isPatchFrom(TransportVersions.SEARCH_SOURCE_EXCLUDE_VECTORS_PARAM_8_19) - || version.onOrAfter(TransportVersions.SEARCH_SOURCE_EXCLUDE_VECTORS_PARAM); + return version.supports(SEARCH_SOURCE_EXCLUDE_VECTORS_PARAM); } public boolean fetchSource() { diff --git a/server/src/main/resources/transport/definitions/referable/data_stream_options_api_remove_include_defaults.csv b/server/src/main/resources/transport/definitions/referable/data_stream_options_api_remove_include_defaults.csv new file mode 100644 index 0000000000000..d30e8a8ad79a9 --- /dev/null +++ b/server/src/main/resources/transport/definitions/referable/data_stream_options_api_remove_include_defaults.csv @@ -0,0 +1,9 @@ +# We have taken a donor primary id from +# another collapsed primary id since +# we only have a patch id here given that +# this feature was removed in 8.19. +# This works because our donor was taken +# prior to 9.1.0 release. So this still +# honors bwc from 8.19 -> 9.1 and +# 9.0 -> 9.x. +9081000,8841041 diff --git a/server/src/main/resources/transport/definitions/referable/esql_query_planning_duration.csv b/server/src/main/resources/transport/definitions/referable/esql_query_planning_duration.csv new file mode 100644 index 0000000000000..11d918930681c --- /dev/null +++ b/server/src/main/resources/transport/definitions/referable/esql_query_planning_duration.csv @@ -0,0 +1 @@ +9055000,8841045 diff --git a/server/src/main/resources/transport/definitions/referable/esql_regex_match_with_case_insensitivity.csv b/server/src/main/resources/transport/definitions/referable/esql_regex_match_with_case_insensitivity.csv new file mode 100644 index 0000000000000..7960a93be2214 --- /dev/null +++ b/server/src/main/resources/transport/definitions/referable/esql_regex_match_with_case_insensitivity.csv @@ -0,0 +1 @@ +9086000,8841044 diff --git a/server/src/main/resources/transport/definitions/referable/idp_custom_saml_attributes_allow_list.csv b/server/src/main/resources/transport/definitions/referable/idp_custom_saml_attributes_allow_list.csv new file mode 100644 index 0000000000000..47e0eeca991aa --- /dev/null +++ b/server/src/main/resources/transport/definitions/referable/idp_custom_saml_attributes_allow_list.csv @@ -0,0 +1 @@ +9091000,8841050 diff --git a/server/src/main/resources/transport/definitions/referable/ilm_add_skip_setting.csv b/server/src/main/resources/transport/definitions/referable/ilm_add_skip_setting.csv new file mode 100644 index 0000000000000..1349e0a9861f6 --- /dev/null +++ b/server/src/main/resources/transport/definitions/referable/ilm_add_skip_setting.csv @@ -0,0 +1 @@ +9089000,8841043 diff --git a/server/src/main/resources/transport/definitions/referable/join_on_aliases.csv b/server/src/main/resources/transport/definitions/referable/join_on_aliases.csv new file mode 100644 index 0000000000000..090404bd5c353 --- /dev/null +++ b/server/src/main/resources/transport/definitions/referable/join_on_aliases.csv @@ -0,0 +1 @@ +9088000,8841042 diff --git a/server/src/main/resources/transport/definitions/referable/ml_inference_elastic_rerank.csv b/server/src/main/resources/transport/definitions/referable/ml_inference_elastic_rerank.csv new file mode 100644 index 0000000000000..c277b001af131 --- /dev/null +++ b/server/src/main/resources/transport/definitions/referable/ml_inference_elastic_rerank.csv @@ -0,0 +1 @@ +9094000,8841048 diff --git a/server/src/main/resources/transport/definitions/referable/ml_inference_mistral_chat_completion_added.csv b/server/src/main/resources/transport/definitions/referable/ml_inference_mistral_chat_completion_added.csv new file mode 100644 index 0000000000000..23c8f42ef4ec6 --- /dev/null +++ b/server/src/main/resources/transport/definitions/referable/ml_inference_mistral_chat_completion_added.csv @@ -0,0 +1 @@ +9090000,8841047 diff --git a/server/src/main/resources/transport/definitions/referable/none_chunking_strategy.csv b/server/src/main/resources/transport/definitions/referable/none_chunking_strategy.csv new file mode 100644 index 0000000000000..24864404b34aa --- /dev/null +++ b/server/src/main/resources/transport/definitions/referable/none_chunking_strategy.csv @@ -0,0 +1 @@ +9097000,8841049 diff --git a/server/src/main/resources/transport/definitions/referable/search_source_exclude_vectors_param.csv b/server/src/main/resources/transport/definitions/referable/search_source_exclude_vectors_param.csv new file mode 100644 index 0000000000000..9820bc5f20743 --- /dev/null +++ b/server/src/main/resources/transport/definitions/referable/search_source_exclude_vectors_param.csv @@ -0,0 +1 @@ +9092000,8841046 diff --git a/server/src/main/resources/transport/definitions/unreferable/dead_esql_query_planning_duration.csv b/server/src/main/resources/transport/definitions/unreferable/dead_esql_query_planning_duration.csv new file mode 100644 index 0000000000000..c691bd6aa064d --- /dev/null +++ b/server/src/main/resources/transport/definitions/unreferable/dead_esql_query_planning_duration.csv @@ -0,0 +1 @@ +9051000 diff --git a/server/src/main/resources/transport/definitions/unreferable/dead_settings_in_data_streams.csv b/server/src/main/resources/transport/definitions/unreferable/dead_settings_in_data_streams.csv deleted file mode 100644 index 06d0c5fec9c3b..0000000000000 --- a/server/src/main/resources/transport/definitions/unreferable/dead_settings_in_data_streams.csv +++ /dev/null @@ -1 +0,0 @@ -9081000 diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/IndexLifecycleExplainResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/IndexLifecycleExplainResponse.java index abc6362b1fcc2..322ce3141ff63 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/IndexLifecycleExplainResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/IndexLifecycleExplainResponse.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.core.ilm; +import org.elasticsearch.TransportVersion; import org.elasticsearch.TransportVersions; import org.elasticsearch.common.Strings; import org.elasticsearch.common.bytes.BytesReference; @@ -123,6 +124,8 @@ public class IndexLifecycleExplainResponse implements ToXContentObject, Writeabl PARSER.declareBoolean(ConstructingObjectParser.optionalConstructorArg(), SKIP_NAME); } + private static final TransportVersion ILM_ADD_SKIP_SETTING = TransportVersion.fromName("ilm_add_skip_setting"); + private final String index; private final Long indexCreationDate; private final String policyName; @@ -342,8 +345,7 @@ public IndexLifecycleExplainResponse(StreamInput in) throws IOException { } else { previousStepInfo = null; } - if (in.getTransportVersion().isPatchFrom(TransportVersions.ILM_ADD_SKIP_SETTING_8_19) - || in.getTransportVersion().onOrAfter(TransportVersions.ILM_ADD_SKIP_SETTING)) { + if (in.getTransportVersion().supports(ILM_ADD_SKIP_SETTING)) { skip = in.readBoolean(); } else { skip = false; @@ -398,8 +400,7 @@ public void writeTo(StreamOutput out) throws IOException { if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_16_0)) { out.writeOptionalBytesReference(previousStepInfo); } - if (out.getTransportVersion().isPatchFrom(TransportVersions.ILM_ADD_SKIP_SETTING_8_19) - || out.getTransportVersion().onOrAfter(TransportVersions.ILM_ADD_SKIP_SETTING)) { + if (out.getTransportVersion().supports(ILM_ADD_SKIP_SETTING)) { out.writeBoolean(skip); } } diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlExecutionInfo.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlExecutionInfo.java index 61d0d3b0e1026..45e0e51a1347a 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlExecutionInfo.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlExecutionInfo.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.esql.action; +import org.elasticsearch.TransportVersion; import org.elasticsearch.TransportVersions; import org.elasticsearch.action.search.ShardSearchFailure; import org.elasticsearch.common.collect.Iterators; @@ -62,6 +63,8 @@ public class EsqlExecutionInfo implements ChunkedToXContentObject, Writeable { public static final ParseField TOOK = new ParseField("took"); public static final ParseField IS_PARTIAL_FIELD = new ParseField("is_partial"); + private static final TransportVersion ESQL_QUERY_PLANNING_DURATION = TransportVersion.fromName("esql_query_planning_duration"); + // Map key is clusterAlias on the primary querying cluster of a CCS minimize_roundtrips=true query // The Map itself is immutable after construction - all Clusters will be accounted for at the start of the search. // Updates to the Cluster occur with the updateCluster method that given the key to map transforms an @@ -130,8 +133,7 @@ public EsqlExecutionInfo(StreamInput in) throws IOException { this.skipUnavailablePredicate = Predicates.always(); this.relativeStart = null; - if (in.getTransportVersion().onOrAfter(TransportVersions.ESQL_QUERY_PLANNING_DURATION) - || in.getTransportVersion().isPatchFrom(TransportVersions.ESQL_QUERY_PLANNING_DURATION_8_19)) { + if (in.getTransportVersion().supports(ESQL_QUERY_PLANNING_DURATION)) { this.overallTimeSpan = in.readOptional(TimeSpan::readFrom); this.planningTimeSpan = in.readOptional(TimeSpan::readFrom); } @@ -151,8 +153,7 @@ public void writeTo(StreamOutput out) throws IOException { if (out.getTransportVersion().onOrAfter(TransportVersions.ESQL_RESPONSE_PARTIAL)) { out.writeBoolean(isPartial); } - if (out.getTransportVersion().onOrAfter(TransportVersions.ESQL_QUERY_PLANNING_DURATION) - || out.getTransportVersion().isPatchFrom(TransportVersions.ESQL_QUERY_PLANNING_DURATION_8_19)) { + if (out.getTransportVersion().supports(ESQL_QUERY_PLANNING_DURATION)) { out.writeOptionalWriteable(overallTimeSpan); out.writeOptionalWriteable(planningTimeSpan); } diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/enrich/LookupFromIndexService.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/enrich/LookupFromIndexService.java index 72859b6210871..722757ece9643 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/enrich/LookupFromIndexService.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/enrich/LookupFromIndexService.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.esql.enrich; +import org.elasticsearch.TransportVersion; import org.elasticsearch.TransportVersions; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.service.ClusterService; @@ -132,6 +133,8 @@ public static class Request extends AbstractLookupService.Request { protected static class TransportRequest extends AbstractLookupService.TransportRequest { private final String matchField; + private static final TransportVersion JOIN_ON_ALIASES = TransportVersion.fromName("join_on_aliases"); + TransportRequest( String sessionId, ShardId shardId, @@ -153,8 +156,7 @@ static TransportRequest readFrom(StreamInput in, BlockFactory blockFactory) thro ShardId shardId = new ShardId(in); String indexPattern; - if (in.getTransportVersion().onOrAfter(TransportVersions.JOIN_ON_ALIASES) - || in.getTransportVersion().isPatchFrom(TransportVersions.JOIN_ON_ALIASES_8_19)) { + if (in.getTransportVersion().supports(JOIN_ON_ALIASES)) { indexPattern = in.readString(); } else { indexPattern = shardId.getIndexName(); @@ -199,8 +201,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeString(sessionId); out.writeWriteable(shardId); - if (out.getTransportVersion().onOrAfter(TransportVersions.JOIN_ON_ALIASES) - || out.getTransportVersion().isPatchFrom(TransportVersions.JOIN_ON_ALIASES_8_19)) { + if (out.getTransportVersion().supports(JOIN_ON_ALIASES)) { out.writeString(indexPattern); } else if (indexPattern.equals(shardId.getIndexName()) == false) { throw new EsqlIllegalArgumentException("Aliases and index patterns are not allowed for LOOKUP JOIN [{}]", indexPattern); diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/RegexMatch.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/RegexMatch.java index 140bbd697ce9e..711c2245c87e9 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/RegexMatch.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/RegexMatch.java @@ -8,7 +8,7 @@ package org.elasticsearch.xpack.esql.expression.function.scalar.string.regex; import org.apache.lucene.util.automaton.Automata; -import org.elasticsearch.TransportVersions; +import org.elasticsearch.TransportVersion; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.compute.operator.EvalOperator; @@ -30,6 +30,10 @@ abstract class RegexMatch

extends org.elasticsearch.xpack.esql.core.expression.predicate.regex.RegexMatch< P> implements EvaluatorMapper, TranslationAware.SingleValueTranslationAware { + private static final TransportVersion ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY = TransportVersion.fromName( + "esql_regex_match_with_case_insensitivity" + ); + abstract String name(); RegexMatch(Source source, Expression field, P pattern, boolean caseInsensitive) { @@ -73,24 +77,21 @@ public String nodeString() { void serializeCaseInsensitivity(StreamOutput out) throws IOException { var transportVersion = out.getTransportVersion(); - if (transportVersion.onOrAfter(TransportVersions.ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY) - || transportVersion.isPatchFrom(TransportVersions.ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY_8_19)) { + if (transportVersion.supports(ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY)) { out.writeBoolean(caseInsensitive()); } else if (caseInsensitive()) { // The plan has been optimized to run a case-insensitive match, which the remote peer cannot be notified of. Simply avoiding // the serialization of the boolean would result in wrong results. throw new EsqlIllegalArgumentException( - name() + " with case insensitivity is not supported in peer node's version [{}]. Upgrade to version [{}, {}] or newer.", + name() + " with case insensitivity is not supported in peer node's version [{}]. Upgrade to version [{}] or newer.", transportVersion, - TransportVersions.ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY_8_19, - TransportVersions.ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY + ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY ); } // else: write nothing, the remote peer can execute the case-sensitive query } static boolean deserializeCaseInsensitivity(StreamInput in) throws IOException { var transportVersion = in.getTransportVersion(); - return (transportVersion.onOrAfter(TransportVersions.ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY) - || transportVersion.isPatchFrom(TransportVersions.ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY_8_19)) && in.readBoolean(); + return transportVersion.supports(ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY) && in.readBoolean(); } } diff --git a/x-pack/plugin/identity-provider/src/main/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderDocument.java b/x-pack/plugin/identity-provider/src/main/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderDocument.java index 78e95fe0ae486..9cd1155bc9ef3 100644 --- a/x-pack/plugin/identity-provider/src/main/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderDocument.java +++ b/x-pack/plugin/identity-provider/src/main/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderDocument.java @@ -8,6 +8,7 @@ package org.elasticsearch.xpack.idp.saml.sp; import org.elasticsearch.ElasticsearchException; +import org.elasticsearch.TransportVersion; import org.elasticsearch.common.Strings; import org.elasticsearch.common.ValidationException; import org.elasticsearch.common.io.stream.StreamInput; @@ -42,9 +43,6 @@ import java.util.TreeSet; import java.util.function.BiConsumer; -import static org.elasticsearch.TransportVersions.IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST; -import static org.elasticsearch.TransportVersions.IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST_8_19; - /** * This class models the storage of a {@link SamlServiceProvider} as an Elasticsearch document. */ @@ -54,6 +52,10 @@ public class SamlServiceProviderDocument implements ToXContentObject, Writeable public static final String SIGN_LOGOUT = "logout"; private static final Set ALLOWED_SIGN_MESSAGES = Set.of(SIGN_AUTHN, SIGN_LOGOUT); + private static final TransportVersion IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST = TransportVersion.fromName( + "idp_custom_saml_attributes_allow_list" + ); + public static class Privileges { public String resource; // we use a sorted set so that the order is consistent in XContent APIs @@ -277,8 +279,7 @@ public SamlServiceProviderDocument(StreamInput in) throws IOException { attributeNames.name = in.readOptionalString(); attributeNames.roles = in.readOptionalString(); - if (in.getTransportVersion().isPatchFrom(IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST_8_19) - || in.getTransportVersion().onOrAfter(IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST)) { + if (in.getTransportVersion().supports(IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST)) { attributeNames.extensions = in.readCollectionAsImmutableSet(StreamInput::readString); } @@ -307,8 +308,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeOptionalString(attributeNames.name); out.writeOptionalString(attributeNames.roles); - if (out.getTransportVersion().isPatchFrom(IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST_8_19) - || out.getTransportVersion().onOrAfter(IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST)) { + if (out.getTransportVersion().supports(IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST)) { out.writeStringCollection(attributeNames.extensions); } diff --git a/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderDocumentTests.java b/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderDocumentTests.java index b4cfef81dfa98..90626f60a3250 100644 --- a/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderDocumentTests.java +++ b/x-pack/plugin/identity-provider/src/test/java/org/elasticsearch/xpack/idp/saml/sp/SamlServiceProviderDocumentTests.java @@ -41,6 +41,12 @@ public class SamlServiceProviderDocumentTests extends IdpSamlTestCase { + private static final TransportVersion IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST = TransportVersion.fromName( + "idp_custom_saml_attributes_allow_list" + ); + private static final TransportVersion IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST_PATCH = IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST + .nextPatchVersion(); + public void testValidationFailuresForMissingFields() throws Exception { final SamlServiceProviderDocument doc = new SamlServiceProviderDocument(); doc.setDocId(randomAlphaOfLength(16)); @@ -97,12 +103,12 @@ public void testSerializationBeforeExtensionAttributes() throws Exception { ? TransportVersionUtils.randomVersionBetween( random(), TransportVersions.STORED_SCRIPT_CONTENT_LENGTH_90, - TransportVersionUtils.getPreviousVersion(TransportVersions.IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST) + TransportVersionUtils.getPreviousVersion(IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST) ) : TransportVersionUtils.randomVersionBetween( random(), TransportVersions.V_8_0_0, - TransportVersionUtils.getPreviousVersion(TransportVersions.IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST_8_19) + TransportVersionUtils.getPreviousVersion(IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST_PATCH) ); final SamlServiceProviderDocument copy = copyWriteable( original, @@ -189,7 +195,7 @@ private SamlServiceProviderDocument assertXContentRoundTrip(SamlServiceProviderD private SamlServiceProviderDocument assertSerializationRoundTrip(SamlServiceProviderDocument doc) throws IOException { final TransportVersion version = TransportVersionUtils.randomVersionBetween( random(), - TransportVersions.IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST, + IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST, TransportVersion.current() ); final SamlServiceProviderDocument read = copyWriteable( diff --git a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/chunking/NoneChunkingSettings.java b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/chunking/NoneChunkingSettings.java index bd3da61d81063..c51168b32e56f 100644 --- a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/chunking/NoneChunkingSettings.java +++ b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/chunking/NoneChunkingSettings.java @@ -8,7 +8,6 @@ package org.elasticsearch.xpack.inference.chunking; import org.elasticsearch.TransportVersion; -import org.elasticsearch.TransportVersions; import org.elasticsearch.common.Strings; import org.elasticsearch.common.ValidationException; import org.elasticsearch.common.io.stream.StreamOutput; @@ -30,6 +29,8 @@ public class NoneChunkingSettings implements ChunkingSettings { private static final ChunkingStrategy STRATEGY = ChunkingStrategy.NONE; private static final Set VALID_KEYS = Set.of(ChunkingSettingsOptions.STRATEGY.toString()); + private static final TransportVersion NONE_CHUNKING_STRATEGY = TransportVersion.fromName("none_chunking_strategy"); + private NoneChunkingSettings() {} @Override @@ -49,8 +50,7 @@ public TransportVersion getMinimalSupportedVersion() { @Override public boolean supportsVersion(TransportVersion version) { - return version.isPatchFrom(TransportVersions.NONE_CHUNKING_STRATEGY_8_19) - || version.onOrAfter(TransportVersions.NONE_CHUNKING_STRATEGY); + return version.supports(NONE_CHUNKING_STRATEGY); } @Override diff --git a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/elastic/rerank/ElasticInferenceServiceRerankServiceSettings.java b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/elastic/rerank/ElasticInferenceServiceRerankServiceSettings.java index eff22c2771930..9754b725c0dce 100644 --- a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/elastic/rerank/ElasticInferenceServiceRerankServiceSettings.java +++ b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/elastic/rerank/ElasticInferenceServiceRerankServiceSettings.java @@ -8,7 +8,6 @@ package org.elasticsearch.xpack.inference.services.elastic.rerank; import org.elasticsearch.TransportVersion; -import org.elasticsearch.TransportVersions; import org.elasticsearch.common.ValidationException; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -36,6 +35,7 @@ public class ElasticInferenceServiceRerankServiceSettings extends FilteredXConte public static final String NAME = "elastic_rerank_service_settings"; private static final RateLimitSettings DEFAULT_RATE_LIMIT_SETTINGS = new RateLimitSettings(500); + private static final TransportVersion ML_INFERENCE_ELASTIC_RERANK = TransportVersion.fromName("ml_inference_elastic_rerank"); public static ElasticInferenceServiceRerankServiceSettings fromMap(Map map, ConfigurationParseContext context) { ValidationException validationException = new ValidationException(); @@ -84,13 +84,12 @@ public String getWriteableName() { @Override public TransportVersion getMinimalSupportedVersion() { assert false : "should never be called when supportsVersion is used"; - return TransportVersions.ML_INFERENCE_ELASTIC_RERANK; + return ML_INFERENCE_ELASTIC_RERANK; } @Override public boolean supportsVersion(TransportVersion version) { - return version.onOrAfter(TransportVersions.ML_INFERENCE_ELASTIC_RERANK) - || version.isPatchFrom(TransportVersions.ML_INFERENCE_ELASTIC_RERANK_ADDED_8_19); + return version.supports(ML_INFERENCE_ELASTIC_RERANK); } @Override diff --git a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/mistral/completion/MistralChatCompletionServiceSettings.java b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/mistral/completion/MistralChatCompletionServiceSettings.java index 89b9475ad65d8..96267c962be71 100644 --- a/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/mistral/completion/MistralChatCompletionServiceSettings.java +++ b/x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/mistral/completion/MistralChatCompletionServiceSettings.java @@ -8,7 +8,6 @@ package org.elasticsearch.xpack.inference.services.mistral.completion; import org.elasticsearch.TransportVersion; -import org.elasticsearch.TransportVersions; import org.elasticsearch.common.ValidationException; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; @@ -34,6 +33,9 @@ */ public class MistralChatCompletionServiceSettings extends FilteredXContentObject implements ServiceSettings { public static final String NAME = "mistral_completions_service_settings"; + private static final TransportVersion ML_INFERENCE_MISTRAL_CHAT_COMPLETION_ADDED = TransportVersion.fromName( + "ml_inference_mistral_chat_completion_added" + ); private final String modelId; private final RateLimitSettings rateLimitSettings; @@ -79,13 +81,12 @@ public String getWriteableName() { @Override public TransportVersion getMinimalSupportedVersion() { assert false : "should never be called when supportsVersion is used"; - return TransportVersions.ML_INFERENCE_MISTRAL_CHAT_COMPLETION_ADDED; + return ML_INFERENCE_MISTRAL_CHAT_COMPLETION_ADDED; } @Override public boolean supportsVersion(TransportVersion version) { - return version.onOrAfter(TransportVersions.ML_INFERENCE_MISTRAL_CHAT_COMPLETION_ADDED) - || version.isPatchFrom(TransportVersions.ML_INFERENCE_MISTRAL_CHAT_COMPLETION_ADDED_8_19); + return version.supports(ML_INFERENCE_MISTRAL_CHAT_COMPLETION_ADDED); } @Override