From 1d281f9945aa1e53c34126e6244db7adca1dae19 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 21 Feb 2020 10:20:31 +0100 Subject: [PATCH] [Backport 7.6] Add index.final_pipeline index setting (#4417) Relates: #4341, elastic/elasticsearch#49470 This commit adds final pipeline to index settings and deprecates required pipeline. Co-authored-by: Russ Cam --- .../Settings/DynamicIndexSettings.cs | 18 +++++++++++++++++- .../Settings/IndexSettingsFormatter.cs | 6 ++++++ .../Settings/UpdatableIndexSettings.cs | 4 ++++ .../Settings/TypedIndexSettings.cs | 6 +++--- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/Nest/IndexModules/IndexSettings/Settings/DynamicIndexSettings.cs b/src/Nest/IndexModules/IndexSettings/Settings/DynamicIndexSettings.cs index 41b023fca6c..bd75f2daca3 100644 --- a/src/Nest/IndexModules/IndexSettings/Settings/DynamicIndexSettings.cs +++ b/src/Nest/IndexModules/IndexSettings/Settings/DynamicIndexSettings.cs @@ -113,11 +113,19 @@ public interface IDynamicIndexSettings : IIsADictionary string DefaultPipeline { get; set; } /// - /// The required ingest node pipeline for this index. Index requests will fail if the required pipeline is set and the pipeline + /// The required ingest pipeline for this index. Index requests will fail if the required pipeline is set and the pipeline /// does not exist. The required pipeline can not be overridden with the pipeline parameter. A default pipeline and a required pipeline /// can not both be set. The special pipeline name _none indicates no ingest pipeline will run. /// + [Obsolete("Use FinalPipeline")] string RequiredPipeline { get; set; } + + /// + /// The final ingest pipeline for this index. Index requests will fail if the final pipeline is set and the pipeline does not exist. + /// The final pipeline always runs after the request pipeline (if specified) and the default pipeline (if it exists). The special pipeline + /// name `_none` indicates no ingest pipeline will run. + /// + string FinalPipeline { get; set; } } /// @@ -195,8 +203,12 @@ public Time RefreshInterval public string DefaultPipeline { get; set; } /// + [Obsolete("Use FinalPipeline")] public string RequiredPipeline { get; set; } + /// + public string FinalPipeline { get; set; } + /// Add any setting to the index public void Add(string setting, object value) => BackingDictionary[setting] = value; } @@ -232,8 +244,12 @@ public TDescriptor Setting(string setting, object value) public TDescriptor DefaultPipeline(string defaultPipeline) => Assign(defaultPipeline, (a, v) => a.DefaultPipeline = v); /// + [Obsolete("Use FinalPipeline")] public TDescriptor RequiredPipeline(string requiredPipeline) => Assign(requiredPipeline, (a, v) => a.RequiredPipeline = v); + /// + public TDescriptor FinalPipeline(string finalPipeline) => Assign(finalPipeline, (a, v) => a.FinalPipeline = v); + /// public TDescriptor BlocksMetadata(bool? blocksMetadata = true) => Assign(blocksMetadata, (a, v) => a.BlocksMetadata = v); diff --git a/src/Nest/IndexModules/IndexSettings/Settings/IndexSettingsFormatter.cs b/src/Nest/IndexModules/IndexSettings/Settings/IndexSettingsFormatter.cs index 33e28a4813e..72ed7242591 100644 --- a/src/Nest/IndexModules/IndexSettings/Settings/IndexSettingsFormatter.cs +++ b/src/Nest/IndexModules/IndexSettings/Settings/IndexSettingsFormatter.cs @@ -51,7 +51,10 @@ void Set(string knownKey, object newValue) Set(NumberOfReplicas, value.NumberOfReplicas); Set(RefreshInterval, value.RefreshInterval); Set(DefaultPipeline, value.DefaultPipeline); +#pragma warning disable 618 Set(RequiredPipeline, value.RequiredPipeline); +#pragma warning restore 618 + Set(FinalPipeline, value.FinalPipeline); Set(BlocksReadOnly, value.BlocksReadOnly); Set(BlocksRead, value.BlocksRead); Set(BlocksWrite, value.BlocksWrite); @@ -184,7 +187,10 @@ private static void SetKnownIndexSettings(ref JsonReader reader, IJsonFormatterR Set(s, settings, BlocksReadOnlyAllowDelete, v => s.BlocksReadOnlyAllowDelete = v, formatterResolver); Set(s, settings, Priority, v => s.Priority = v, formatterResolver); Set(s, settings, DefaultPipeline, v => s.DefaultPipeline = v, formatterResolver); +#pragma warning disable 618 Set(s, settings, RequiredPipeline, v => s.RequiredPipeline = v, formatterResolver); +#pragma warning restore 618 + Set(s, settings, FinalPipeline, v => s.FinalPipeline = v, formatterResolver); Set>(s, settings, UpdatableIndexSettings.RecoveryInitialShards, v => s.RecoveryInitialShards = v, formatterResolver); diff --git a/src/Nest/IndexModules/IndexSettings/Settings/UpdatableIndexSettings.cs b/src/Nest/IndexModules/IndexSettings/Settings/UpdatableIndexSettings.cs index 240feff2a8d..3b0e639a164 100644 --- a/src/Nest/IndexModules/IndexSettings/Settings/UpdatableIndexSettings.cs +++ b/src/Nest/IndexModules/IndexSettings/Settings/UpdatableIndexSettings.cs @@ -1,3 +1,5 @@ +using System; + namespace Nest { /// @@ -60,7 +62,9 @@ public static class UpdatableIndexSettings public const string RefreshInterval = "index.refresh_interval"; public const string DefaultPipeline = "index.default_pipeline"; + [Obsolete("Use FinalPipeline")] public const string RequiredPipeline = "index.required_pipeline"; + public const string FinalPipeline = "index.final_pipeline"; public const string RequestsCacheEnable = "index.requests.cache.enable"; public const string RoutingAllocationDisableAllocation = "index.routing.allocation.disable_allocation"; diff --git a/tests/Tests/IndexModules/IndexSettings/Settings/TypedIndexSettings.cs b/tests/Tests/IndexModules/IndexSettings/Settings/TypedIndexSettings.cs index ae18f20a809..29661f36655 100644 --- a/tests/Tests/IndexModules/IndexSettings/Settings/TypedIndexSettings.cs +++ b/tests/Tests/IndexModules/IndexSettings/Settings/TypedIndexSettings.cs @@ -20,7 +20,7 @@ public class Usage : PromiseUsageTestBase