2
2
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
3
// See the LICENSE file in the project root for more information
4
4
5
- using System ;
5
+ using System ;
6
6
using System . Collections . Generic ;
7
7
using System . Runtime . Serialization ;
8
8
using Elasticsearch . Net . Utf8Json ;
@@ -18,6 +18,14 @@ public interface IProcessor
18
18
[ IgnoreDataMember ]
19
19
string Name { get ; }
20
20
21
+ /// <summary>
22
+ /// A description to explain the purpose of the specific processor instance.
23
+ /// <para />
24
+ /// Valid in Elasticsearch 7.9.0+
25
+ /// </summary>
26
+ [ DataMember ( Name = "description" ) ]
27
+ string Description { get ; set ; }
28
+
21
29
/// <summary>
22
30
/// If a processor fails, call these processors instead. Read more about handling failures here:
23
31
/// https://www.elastic.co/guide/en/elasticsearch/reference/current/handling-failure-in-pipelines.html
@@ -54,6 +62,9 @@ public abstract class ProcessorBase : IProcessor
54
62
/// <inheritdoc cref="IProcessor.OnFailure"/>
55
63
public IEnumerable < IProcessor > OnFailure { get ; set ; }
56
64
protected abstract string Name { get ; }
65
+ /// <inheritdoc cref="IProcessor.Description"/>
66
+ public string Description { get ; set ; }
67
+
57
68
string IProcessor . Name => Name ;
58
69
}
59
70
@@ -65,11 +76,15 @@ public abstract class ProcessorDescriptorBase<TProcessorDescriptor, TProcessorIn
65
76
{
66
77
protected abstract string Name { get ; }
67
78
string IProcessor . Name => Name ;
79
+ string IProcessor . Description { get ; set ; }
68
80
IEnumerable < IProcessor > IProcessor . OnFailure { get ; set ; }
69
81
string IProcessor . If { get ; set ; }
70
82
string IProcessor . Tag { get ; set ; }
71
83
bool ? IProcessor . IgnoreFailure { get ; set ; }
72
84
85
+ /// <inheritdoc cref="IProcessor.Description"/>
86
+ public TProcessorDescriptor Description ( string description ) => Assign ( description , ( a , v ) => a . Description = v ) ;
87
+
73
88
/// <inheritdoc cref="IProcessor.OnFailure"/>
74
89
public TProcessorDescriptor OnFailure ( IEnumerable < IProcessor > processors ) => Assign ( processors . ToListOrNullIfEmpty ( ) , ( a , v ) => a . OnFailure = v ) ;
75
90
0 commit comments