Skip to content

Commit

Permalink
Add ignore_empty_value to set processor (#4915) (#4932)
Browse files Browse the repository at this point in the history
Relates: elastic/elasticsearch#57030

Co-authored-by: Russ Cam <[email protected]>
  • Loading branch information
github-actions[bot] and russcam authored Aug 5, 2020
1 parent 23abe0a commit 69fab71
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Nest/Ingest/Processors/SetProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ public interface ISetProcessor : IProcessor
/// </summary>
[DataMember(Name = "override")]
bool? Override { get; set; }

/// <summary>
/// If <c>true</c> and value is a template snippet that evaluates to null or the
/// empty string, the processor quietly exits without modifying the document.
/// Defaults to <c>false</c>.
/// <para />
/// Valid in Elasticsearch 7.9.0+
/// </summary>
[DataMember(Name = "ignore_empty_value")]
bool? IgnoreEmptyValue { get; set; }
}

/// <inheritdoc cref="ISetProcessor" />
Expand All @@ -47,6 +57,8 @@ public class SetProcessor : ProcessorBase, ISetProcessor
public object Value { get; set; }
/// <inheritdoc />
public bool? Override { get; set; }
/// <inheritdoc />
public bool? IgnoreEmptyValue { get; set; }
protected override string Name => "set";
}

Expand All @@ -58,6 +70,7 @@ public class SetProcessorDescriptor<T> : ProcessorDescriptorBase<SetProcessorDes
Field ISetProcessor.Field { get; set; }
object ISetProcessor.Value { get; set; }
bool? ISetProcessor.Override { get; set; }
bool? ISetProcessor.IgnoreEmptyValue { get; set; }

/// <inheritdoc cref="ISetProcessor.Field"/>
public SetProcessorDescriptor<T> Field(Field field) => Assign(field, (a, v) => a.Field = v);
Expand All @@ -71,5 +84,9 @@ public SetProcessorDescriptor<T> Field<TValue>(Expression<Func<T, TValue>> objec

/// <inheritdoc cref="ISetProcessor.Override"/>
public SetProcessorDescriptor<T> Override(bool? @override = true) => Assign(@override, (a, v) => a.Override = v);

/// <inheritdoc cref="ISetProcessor.IgnoreEmptyValue"/>
public SetProcessorDescriptor<T> IgnoreEmptyValue(bool? ignoreEmptyValue = true) =>
Assign(ignoreEmptyValue, (a, v) => a.IgnoreEmptyValue = v);
}
}

0 comments on commit 69fab71

Please sign in to comment.