22// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33// See the LICENSE file in the project root for more information
44
5- using System ;
5+ using System ;
66using System . Collections . Generic ;
77using System . Runtime . Serialization ;
88using Elasticsearch . Net . Utf8Json ;
@@ -18,6 +18,14 @@ public interface IProcessor
1818 [ IgnoreDataMember ]
1919 string Name { get ; }
2020
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+
2129 /// <summary>
2230 /// If a processor fails, call these processors instead. Read more about handling failures here:
2331 /// https://www.elastic.co/guide/en/elasticsearch/reference/current/handling-failure-in-pipelines.html
@@ -54,6 +62,9 @@ public abstract class ProcessorBase : IProcessor
5462 /// <inheritdoc cref="IProcessor.OnFailure"/>
5563 public IEnumerable < IProcessor > OnFailure { get ; set ; }
5664 protected abstract string Name { get ; }
65+ /// <inheritdoc cref="IProcessor.Description"/>
66+ public string Description { get ; set ; }
67+
5768 string IProcessor . Name => Name ;
5869 }
5970
@@ -65,11 +76,15 @@ public abstract class ProcessorDescriptorBase<TProcessorDescriptor, TProcessorIn
6576 {
6677 protected abstract string Name { get ; }
6778 string IProcessor . Name => Name ;
79+ string IProcessor . Description { get ; set ; }
6880 IEnumerable < IProcessor > IProcessor . OnFailure { get ; set ; }
6981 string IProcessor . If { get ; set ; }
7082 string IProcessor . Tag { get ; set ; }
7183 bool ? IProcessor . IgnoreFailure { get ; set ; }
7284
85+ /// <inheritdoc cref="IProcessor.Description"/>
86+ public TProcessorDescriptor Description ( string description ) => Assign ( description , ( a , v ) => a . Description = v ) ;
87+
7388 /// <inheritdoc cref="IProcessor.OnFailure"/>
7489 public TProcessorDescriptor OnFailure ( IEnumerable < IProcessor > processors ) => Assign ( processors . ToListOrNullIfEmpty ( ) , ( a , v ) => a . OnFailure = v ) ;
7590
0 commit comments