Skip to content

Add the ability to require an ingest pipeline. #4274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ public interface IDynamicIndexSettings : IIsADictionary<string, object>
/// The special pipeline name _none indicates no ingest pipeline should be run.`
/// </summary>
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
/// 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>
string RequiredPipeline { get; set; }
}

/// <inheritdoc />
Expand Down Expand Up @@ -179,6 +186,9 @@ public Time RefreshInterval
/// <inheritdoc cref="IDynamicIndexSettings.DefaultPipeline" />
public string DefaultPipeline { get; set; }

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

/// <summary> Add any setting to the index </summary>
public void Add(string setting, object value) => BackingDictionary[setting] = value;
}
Expand Down Expand Up @@ -213,6 +223,9 @@ public TDescriptor Setting(string setting, object value)
/// <inheritdoc cref="IDynamicIndexSettings.DefaultPipeline" />
public TDescriptor DefaultPipeline(string defaultPipeline) => Assign(defaultPipeline, (a, v) => a.DefaultPipeline = v);

/// <inheritdoc cref="IDynamicIndexSettings.RequiredPipeline" />
public TDescriptor RequiredPipeline(string requiredPipeline) => Assign(requiredPipeline, (a, v) => a.RequiredPipeline = 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,6 +51,7 @@ void Set(string knownKey, object newValue)
Set(NumberOfReplicas, value.NumberOfReplicas);
Set(RefreshInterval, value.RefreshInterval);
Set(DefaultPipeline, value.DefaultPipeline);
Set(RequiredPipeline, value.RequiredPipeline);
Set(BlocksReadOnly, value.BlocksReadOnly);
Set(BlocksRead, value.BlocksRead);
Set(BlocksWrite, value.BlocksWrite);
Expand Down Expand Up @@ -179,6 +180,7 @@ private static void SetKnownIndexSettings(ref JsonReader reader, IJsonFormatterR
Set<bool?>(s, settings, BlocksMetadata, v => s.BlocksMetadata = v, formatterResolver);
Set<int?>(s, settings, Priority, v => s.Priority = v, formatterResolver);
Set<string>(s, settings, DefaultPipeline, v => s.DefaultPipeline = v, formatterResolver);
Set<string>(s, settings, RequiredPipeline, v => s.RequiredPipeline = 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
Expand Up @@ -59,6 +59,7 @@ public static class UpdatableIndexSettings
public const string RefreshInterval = "index.refresh_interval";

public const string DefaultPipeline = "index.default_pipeline";
public const string RequiredPipeline = "index.required_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,6 +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.refresh_interval", -1 },
{ "index.blocks.read_only", true },
{ "index.blocks.read", true },
Expand All @@ -46,6 +47,7 @@ public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescripto
.NumberOfShards(1)
.NumberOfReplicas(2)
.DefaultPipeline("a-default-pipeline")
.RequiredPipeline("a-required-pipeline")
.AutoExpandReplicas("1-3")
.BlocksMetadata()
.BlocksRead()
Expand Down Expand Up @@ -74,6 +76,7 @@ public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescripto
NumberOfShards = 1,
NumberOfReplicas = 2,
DefaultPipeline = "a-default-pipeline",
RequiredPipeline = "a-required-pipeline",
AutoExpandReplicas = "1-3",
BlocksMetadata = true,
BlocksRead = true,
Expand Down