Skip to content

Commit

Permalink
[Backport 7.6] Add index.final_pipeline index setting (#4417)
Browse files Browse the repository at this point in the history
Relates: #4341, elastic/elasticsearch#49470

This commit adds final pipeline to index settings and deprecates
required pipeline.

Co-authored-by: Russ Cam <[email protected]>
  • Loading branch information
github-actions[bot] and russcam authored Feb 21, 2020
1 parent b3fd1b0 commit 1d281f9
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,19 @@ public interface IDynamicIndexSettings : IIsADictionary<string, object>
string DefaultPipeline { get; set; }

/// <summary>
/// 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.
/// </summary>
[Obsolete("Use FinalPipeline")]
string RequiredPipeline { get; set; }

/// <summary>
/// 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.
/// </summary>
string FinalPipeline { get; set; }
}

/// <inheritdoc />
Expand Down Expand Up @@ -195,8 +203,12 @@ public Time RefreshInterval
public string DefaultPipeline { get; set; }

/// <inheritdoc cref="IDynamicIndexSettings.RequiredPipeline" />
[Obsolete("Use FinalPipeline")]
public string RequiredPipeline { get; set; }

/// <inheritdoc cref="IDynamicIndexSettings.FinalPipeline" />
public string FinalPipeline { get; set; }

/// <summary> Add any setting to the index </summary>
public void Add(string setting, object value) => BackingDictionary[setting] = value;
}
Expand Down Expand Up @@ -232,8 +244,12 @@ public TDescriptor Setting(string setting, object value)
public TDescriptor DefaultPipeline(string defaultPipeline) => Assign(defaultPipeline, (a, v) => a.DefaultPipeline = v);

/// <inheritdoc cref="IDynamicIndexSettings.RequiredPipeline" />
[Obsolete("Use FinalPipeline")]
public TDescriptor RequiredPipeline(string requiredPipeline) => Assign(requiredPipeline, (a, v) => a.RequiredPipeline = v);

/// <inheritdoc cref="IDynamicIndexSettings.RequiredPipeline" />
public TDescriptor FinalPipeline(string finalPipeline) => Assign(finalPipeline, (a, v) => a.FinalPipeline = v);

/// <inheritdoc cref="IDynamicIndexSettings.BlocksMetadata" />
public TDescriptor BlocksMetadata(bool? blocksMetadata = true) => Assign(blocksMetadata, (a, v) => a.BlocksMetadata = v);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -184,7 +187,10 @@ private static void SetKnownIndexSettings(ref JsonReader reader, IJsonFormatterR
Set<bool?>(s, settings, BlocksReadOnlyAllowDelete, v => s.BlocksReadOnlyAllowDelete = v, formatterResolver);
Set<int?>(s, settings, Priority, v => s.Priority = v, formatterResolver);
Set<string>(s, settings, DefaultPipeline, v => s.DefaultPipeline = v, formatterResolver);
#pragma warning disable 618
Set<string>(s, settings, RequiredPipeline, v => s.RequiredPipeline = v, formatterResolver);
#pragma warning restore 618
Set<string>(s, settings, FinalPipeline, v => s.FinalPipeline = v, formatterResolver);

Set<Union<int, RecoveryInitialShards>>(s, settings, UpdatableIndexSettings.RecoveryInitialShards,
v => s.RecoveryInitialShards = v, formatterResolver);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;

namespace Nest
{
/// <summary>
Expand Down Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescripto
{ "index.number_of_replicas", 2 },
{ "index.auto_expand_replicas", "1-3" },
{ "index.default_pipeline", "a-default-pipeline" },
{ "index.required_pipeline", "a-required-pipeline" },
{ "index.final_pipeline", "a-final-pipeline" },
{ "index.refresh_interval", -1 },
{ "index.blocks.read_only", true },
{ "index.blocks.read", true },
Expand Down Expand Up @@ -48,7 +48,7 @@ public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescripto
.NumberOfShards(1)
.NumberOfReplicas(2)
.DefaultPipeline("a-default-pipeline")
.RequiredPipeline("a-required-pipeline")
.FinalPipeline("a-final-pipeline")
.AutoExpandReplicas("1-3")
.BlocksMetadata()
.BlocksRead()
Expand Down Expand Up @@ -78,7 +78,7 @@ public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescripto
NumberOfShards = 1,
NumberOfReplicas = 2,
DefaultPipeline = "a-default-pipeline",
RequiredPipeline = "a-required-pipeline",
FinalPipeline = "a-final-pipeline",
AutoExpandReplicas = "1-3",
BlocksMetadata = true,
BlocksRead = true,
Expand Down

0 comments on commit 1d281f9

Please sign in to comment.