Skip to content

Commit ee4096e

Browse files
Mpdreamzrusscam
authored andcommitted
Add ignore_missing to the remove processor (#3441)
1 parent ae5ae5b commit ee4096e

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed
Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
using Newtonsoft.Json;
22
using System;
3-
using System.Collections.Generic;
4-
using System.Linq;
53
using System.Linq.Expressions;
6-
using System.Text;
7-
using System.Threading.Tasks;
84

95
namespace Nest
106
{
@@ -14,25 +10,42 @@ public interface IRemoveProcessor : IProcessor
1410
{
1511
[JsonProperty("field")]
1612
Field Field { get; set; }
13+
14+
/// <summary>
15+
/// If <c>true</c> and <see cref="Field"/> does not exist or is null,
16+
/// the processor quietly exits without modifying the document. Default is <c>false</c>
17+
/// </summary>
18+
[JsonProperty("ignore_missing")]
19+
bool? IgnoreMissing { get; set; }
1720
}
1821

22+
/// <inheritdoc cref="IRemoveProcessor" />
1923
public class RemoveProcessor : ProcessorBase, IRemoveProcessor
2024
{
2125
protected override string Name => "remove";
26+
/// <inheritdoc cref="IRemoveProcessor.Field" />
2227
public Field Field { get; set; }
28+
/// <inheritdoc cref="IRemoveProcessor.IgnoreMissing" />
29+
public bool? IgnoreMissing { get; set; }
2330
}
2431

32+
/// <inheritdoc cref="IRemoveProcessor" />
2533
public class RemoveProcessorDescriptor<T>
2634
: ProcessorDescriptorBase<RemoveProcessorDescriptor<T>, IRemoveProcessor>, IRemoveProcessor
2735
where T : class
2836
{
2937
protected override string Name => "remove";
3038

3139
Field IRemoveProcessor.Field { get; set; }
40+
bool? IRemoveProcessor.IgnoreMissing { get; set; }
3241

42+
/// <inheritdoc cref="IRemoveProcessor.Field" />
3343
public RemoveProcessorDescriptor<T> Field(Field field) => Assign(a => a.Field = field);
3444

35-
public RemoveProcessorDescriptor<T> Field(Expression<Func<T, object>> objectPath) =>
36-
Assign(a => a.Field = objectPath);
45+
/// <inheritdoc cref="IRemoveProcessor.Field" />
46+
public RemoveProcessorDescriptor<T> Field(Expression<Func<T, object>> objectPath) => Assign(a => a.Field = objectPath);
47+
48+
/// <inheritdoc cref="IRemoveProcessor.IgnoreMissing" />
49+
public RemoveProcessorDescriptor<T> IgnoreMissing(bool? ignoreMissing = true) => Assign(a => a.IgnoreMissing = ignoreMissing);
3750
}
3851
}

0 commit comments

Comments
 (0)