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
6
using System . Diagnostics ;
6
7
using System . Runtime . Serialization ;
7
8
using Elasticsearch . Net . Utf8Json ;
@@ -37,6 +38,22 @@ public interface IGeoPointProperty : IDocValuesProperty
37
38
/// </summary>
38
39
[ DataMember ( Name = "null_value" ) ]
39
40
GeoLocation NullValue { get ; set ; }
41
+
42
+ /// <summary>
43
+ /// If this parameter is set, then the field will index values generated by this script, rather than reading the values directly from
44
+ /// the source. If a value is set for this field on the input document, then the document will be rejected with an error. Scripts are
45
+ /// in the same format as their runtime equivalent, and should emit points as a pair of (lat, lon) double values.
46
+ /// </summary>
47
+ [ DataMember ( Name = "script" ) ]
48
+ IInlineScript Script { get ; set ; }
49
+
50
+ /// <summary>
51
+ /// Defines what to do if the script defined by the `script` parameter throws an error at indexing time.Accepts `reject` (default), which
52
+ /// will cause the entire document to be rejected, and `ignore`, which will register the field in the document's ignored metadata field and
53
+ /// continue indexing.This parameter can only be set if the `script` field is also set.
54
+ /// </summary>
55
+ [ DataMember ( Name = "on_script_error" ) ]
56
+ OnScriptError ? OnScriptError { get ; set ; }
40
57
}
41
58
42
59
/// <inheritdoc cref="IGeoPointProperty"/>
@@ -53,6 +70,12 @@ public GeoPointProperty() : base(FieldType.GeoPoint) { }
53
70
54
71
/// <inheritdoc />
55
72
public GeoLocation NullValue { get ; set ; }
73
+
74
+ /// <inheritdoc />
75
+ public IInlineScript Script { get ; set ; }
76
+
77
+ /// <inheritdoc />
78
+ public OnScriptError ? OnScriptError { get ; set ; }
56
79
}
57
80
58
81
/// <inheritdoc cref="IGeoPointProperty"/>
@@ -66,6 +89,8 @@ public GeoPointPropertyDescriptor() : base(FieldType.GeoPoint) { }
66
89
bool ? IGeoPointProperty . IgnoreMalformed { get ; set ; }
67
90
bool ? IGeoPointProperty . IgnoreZValue { get ; set ; }
68
91
GeoLocation IGeoPointProperty . NullValue { get ; set ; }
92
+ IInlineScript IGeoPointProperty . Script { get ; set ; }
93
+ OnScriptError ? IGeoPointProperty . OnScriptError { get ; set ; }
69
94
70
95
/// <inheritdoc cref="IGeoPointProperty.IgnoreMalformed" />
71
96
public GeoPointPropertyDescriptor < T > IgnoreMalformed ( bool ? ignoreMalformed = true ) => Assign ( ignoreMalformed , ( a , v ) => a . IgnoreMalformed = v ) ;
@@ -75,5 +100,17 @@ public GeoPointPropertyDescriptor() : base(FieldType.GeoPoint) { }
75
100
76
101
/// <inheritdoc cref="IGeoPointProperty.NullValue" />
77
102
public GeoPointPropertyDescriptor < T > NullValue ( GeoLocation defaultValue ) => Assign ( defaultValue , ( a , v ) => a . NullValue = v ) ;
103
+
104
+ /// <inheritdoc cref="INumberProperty.Script" />
105
+ public GeoPointPropertyDescriptor < T > Script ( IInlineScript inlineScript ) => Assign ( inlineScript , ( a , v ) => a . Script = v ) ;
106
+
107
+ /// <inheritdoc cref="INumberProperty.Script" />
108
+ public GeoPointPropertyDescriptor < T > Script ( string source ) => Assign ( source , ( a , v ) => a . Script = new InlineScript ( source ) ) ;
109
+
110
+ /// <inheritdoc cref="INumberProperty.Script" />
111
+ public GeoPointPropertyDescriptor < T > Script ( Func < InlineScriptDescriptor , IInlineScript > selector ) => Assign ( selector , ( a , v ) => a . Script = v ? . Invoke ( new InlineScriptDescriptor ( ) ) ) ;
112
+
113
+ /// <inheritdoc cref="INumberProperty.OnScriptError" />
114
+ public GeoPointPropertyDescriptor < T > OnScriptError ( OnScriptError ? onScriptError ) => Assign ( onScriptError , ( a , v ) => a . OnScriptError = v ) ;
78
115
}
79
116
}
0 commit comments