diff --git a/src/Nest/Mapping/Types/Geo/GeoPoint/GeoPointAttribute.cs b/src/Nest/Mapping/Types/Geo/GeoPoint/GeoPointAttribute.cs
index 577c4f11f8d..556e24ac432 100644
--- a/src/Nest/Mapping/Types/Geo/GeoPoint/GeoPointAttribute.cs
+++ b/src/Nest/Mapping/Types/Geo/GeoPoint/GeoPointAttribute.cs
@@ -22,9 +22,23 @@ public bool IgnoreZValue
set => Self.IgnoreZValue = value;
}
+ public IInlineScript Script
+ {
+ get => Self.Script;
+ set => Self.Script = value;
+ }
+
+ public OnScriptError OnScriptError
+ {
+ get => Self.OnScriptError.GetValueOrDefault();
+ set => Self.OnScriptError = value;
+ }
+
bool? IGeoPointProperty.IgnoreMalformed { get; set; }
bool? IGeoPointProperty.IgnoreZValue { get; set; }
GeoLocation IGeoPointProperty.NullValue { get; set; }
+ IInlineScript IGeoPointProperty.Script { get; set; }
+ OnScriptError? IGeoPointProperty.OnScriptError { get; set; }
private IGeoPointProperty Self => this;
}
}
diff --git a/src/Nest/Mapping/Types/Geo/GeoPoint/GeoPointProperty.cs b/src/Nest/Mapping/Types/Geo/GeoPoint/GeoPointProperty.cs
index 44d083a3283..cd99582fc58 100644
--- a/src/Nest/Mapping/Types/Geo/GeoPoint/GeoPointProperty.cs
+++ b/src/Nest/Mapping/Types/Geo/GeoPoint/GeoPointProperty.cs
@@ -2,6 +2,7 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
+using System;
using System.Diagnostics;
using System.Runtime.Serialization;
using Elasticsearch.Net.Utf8Json;
@@ -37,6 +38,22 @@ public interface IGeoPointProperty : IDocValuesProperty
///
[DataMember(Name ="null_value")]
GeoLocation NullValue { get; set; }
+
+ ///
+ /// If this parameter is set, then the field will index values generated by this script, rather than reading the values directly from
+ /// 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
+ /// in the same format as their runtime equivalent, and should emit points as a pair of (lat, lon) double values.
+ ///
+ [DataMember(Name = "script")]
+ IInlineScript Script { get; set; }
+
+ ///
+ /// Defines what to do if the script defined by the `script` parameter throws an error at indexing time.Accepts `reject` (default), which
+ /// will cause the entire document to be rejected, and `ignore`, which will register the field in the document's ignored metadata field and
+ /// continue indexing.This parameter can only be set if the `script` field is also set.
+ ///
+ [DataMember(Name = "on_script_error")]
+ OnScriptError? OnScriptError { get; set; }
}
///
@@ -53,6 +70,12 @@ public GeoPointProperty() : base(FieldType.GeoPoint) { }
///
public GeoLocation NullValue { get; set; }
+
+ ///
+ public IInlineScript Script { get; set; }
+
+ ///
+ public OnScriptError? OnScriptError { get; set; }
}
///
@@ -66,6 +89,8 @@ public GeoPointPropertyDescriptor() : base(FieldType.GeoPoint) { }
bool? IGeoPointProperty.IgnoreMalformed { get; set; }
bool? IGeoPointProperty.IgnoreZValue { get; set; }
GeoLocation IGeoPointProperty.NullValue { get; set; }
+ IInlineScript IGeoPointProperty.Script { get; set; }
+ OnScriptError? IGeoPointProperty.OnScriptError { get; set; }
///
public GeoPointPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) => Assign(ignoreMalformed, (a, v) => a.IgnoreMalformed = v);
@@ -75,5 +100,17 @@ public GeoPointPropertyDescriptor() : base(FieldType.GeoPoint) { }
///
public GeoPointPropertyDescriptor NullValue(GeoLocation defaultValue) => Assign(defaultValue, (a, v) => a.NullValue = v);
+
+ ///
+ public GeoPointPropertyDescriptor Script(IInlineScript inlineScript) => Assign(inlineScript, (a, v) => a.Script = v);
+
+ ///
+ public GeoPointPropertyDescriptor Script(string source) => Assign(source, (a, v) => a.Script = new InlineScript(source));
+
+ ///
+ public GeoPointPropertyDescriptor Script(Func selector) => Assign(selector, (a, v) => a.Script = v?.Invoke(new InlineScriptDescriptor()));
+
+ ///
+ public GeoPointPropertyDescriptor OnScriptError(OnScriptError? onScriptError) => Assign(onScriptError, (a, v) => a.OnScriptError = v);
}
}