@@ -35,6 +35,15 @@ public interface IGeoIpProcessor : IProcessor
35
35
36
36
[ DataMember ( Name = "target_field" ) ]
37
37
Field TargetField { get ; set ; }
38
+
39
+ /// <summary>
40
+ /// If <c>true</c>, only first found geoip data will be returned, even if field contains array.
41
+ /// Defaults to <c>true</c>
42
+ /// <para />
43
+ /// Available in Elasticsearch 7.6.0+
44
+ /// </summary>
45
+ [ DataMember ( Name = "first_only" ) ]
46
+ bool ? FirstOnly { get ; set ; }
38
47
}
39
48
40
49
/// <summary>
@@ -58,6 +67,10 @@ public class GeoIpProcessor : ProcessorBase, IGeoIpProcessor
58
67
public IEnumerable < string > Properties { get ; set ; }
59
68
60
69
public Field TargetField { get ; set ; }
70
+
71
+ /// <inheritdoc />
72
+ public bool ? FirstOnly { get ; set ; }
73
+
61
74
protected override string Name => "geoip" ;
62
75
}
63
76
@@ -81,13 +94,14 @@ public class GeoIpProcessorDescriptor<T>
81
94
bool ? IGeoIpProcessor . IgnoreMissing { get ; set ; }
82
95
IEnumerable < string > IGeoIpProcessor . Properties { get ; set ; }
83
96
Field IGeoIpProcessor . TargetField { get ; set ; }
97
+ bool ? IGeoIpProcessor . FirstOnly { get ; set ; }
84
98
85
99
public GeoIpProcessorDescriptor < T > Field ( Field field ) => Assign ( field , ( a , v ) => a . Field = v ) ;
86
100
87
101
public GeoIpProcessorDescriptor < T > Field < TValue > ( Expression < Func < T , TValue > > objectPath ) =>
88
102
Assign ( objectPath , ( a , v ) => a . Field = v ) ;
89
103
90
- /// <inheritdoc />
104
+ /// <inheritdoc cref="IGeoIpProcessor.IgnoreMissing" />
91
105
public GeoIpProcessorDescriptor < T > IgnoreMissing ( bool ? ignoreMissing = true ) => Assign ( ignoreMissing , ( a , v ) => a . IgnoreMissing = v ) ;
92
106
93
107
public GeoIpProcessorDescriptor < T > TargetField ( Field field ) => Assign ( field , ( a , v ) => a . TargetField = v ) ;
@@ -100,5 +114,8 @@ public GeoIpProcessorDescriptor<T> TargetField<TValue>(Expression<Func<T, TValue
100
114
public GeoIpProcessorDescriptor < T > Properties ( IEnumerable < string > properties ) => Assign ( properties , ( a , v ) => a . Properties = v ) ;
101
115
102
116
public GeoIpProcessorDescriptor < T > Properties ( params string [ ] properties ) => Assign ( properties , ( a , v ) => a . Properties = v ) ;
117
+
118
+ /// <inheritdoc cref="IGeoIpProcessor.FirstOnly"/>
119
+ public GeoIpProcessorDescriptor < T > FirstOnly ( bool ? firstOnly = true ) => Assign ( firstOnly , ( a , v ) => a . FirstOnly = v ) ;
103
120
}
104
121
}
0 commit comments