Skip to content

Commit

Permalink
Add preserve_trailing to Split processor (#4402)
Browse files Browse the repository at this point in the history
Relates: #4341, elastic/elasticsearch#48664

Add the preserve_trailing property to split processor,
which is available in Elasticsearch 7.6.0+

(cherry picked from commit ee23ef2)
  • Loading branch information
russcam committed Feb 23, 2020
1 parent 501d90b commit 136cb8e
Showing 1 changed file with 15 additions and 0 deletions.
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);
}
}

0 comments on commit 136cb8e

Please sign in to comment.