Skip to content
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

Add preserve_trailing to Split processor #4402

Merged
merged 1 commit into from
Feb 21, 2020
Merged
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
15 changes: 15 additions & 0 deletions src/Nest/Ingest/Processors/SplitProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ public interface ISplitProcessor : IProcessor
/// </summary>
[DataMember(Name = "target_field")]
Field TargetField { get; set; }

/// <summary>
/// Preserves empty trailing fields, if any.
/// <para />
/// Available in Elasticsearch 7.6.0+.
/// </summary>
[DataMember(Name = "preserve_trailing")]
bool? PreserveTrailing { get; set; }
}

/// <inheritdoc cref="SplitProcessor" />
Expand All @@ -51,6 +59,9 @@ public class SplitProcessor : ProcessorBase, ISplitProcessor

/// <inheritdoc />
public Field TargetField { get; set; }

/// <inheritdoc />
public bool? PreserveTrailing { get; set; }
protected override string Name => "split";
}

Expand All @@ -65,6 +76,7 @@ public class SplitProcessorDescriptor<T>
bool? ISplitProcessor.IgnoreMissing { get; set; }
string ISplitProcessor.Separator { get; set; }
Field ISplitProcessor.TargetField { get; set; }
bool? ISplitProcessor.PreserveTrailing { get; set; }

/// <inheritdoc cref="SplitProcessor.Field" />
public SplitProcessorDescriptor<T> Field(Field field) => Assign(field, (a, v) => a.Field = v);
Expand All @@ -85,5 +97,8 @@ public SplitProcessorDescriptor<T> TargetField(Expression<Func<T, object>> objec

/// <inheritdoc cref="SplitProcessor.IgnoreMissing" />
public SplitProcessorDescriptor<T> IgnoreMissing(bool? ignoreMissing = true) => Assign(ignoreMissing, (a, v) => a.IgnoreMissing = v);

/// <inheritdoc cref="SplitProcessor.PreserveTrailing" />
public SplitProcessorDescriptor<T> PreserveTrailing(bool? preserveTrailing = true) => Assign(preserveTrailing, (a, v) => a.PreserveTrailing = v);
}
}