diff --git a/src/Nest/Mapping/Types/Specialized/Ip/IpAttribute.cs b/src/Nest/Mapping/Types/Specialized/Ip/IpAttribute.cs
index 0b3331f9959..9e66a3f7bb5 100644
--- a/src/Nest/Mapping/Types/Specialized/Ip/IpAttribute.cs
+++ b/src/Nest/Mapping/Types/Specialized/Ip/IpAttribute.cs
@@ -29,9 +29,18 @@ public string NullValue
set => Self.NullValue = value;
}
+ public bool IgnoreMalformed
+ {
+ get => Self.IgnoreMalformed.GetValueOrDefault();
+ set => Self.IgnoreMalformed = value;
+ }
+
double? IIpProperty.Boost { get; set; }
bool? IIpProperty.Index { get; set; }
string IIpProperty.NullValue { get; set; }
private IIpProperty Self => this;
+ bool? IIpProperty.IgnoreMalformed { get; set; }
+ IInlineScript IIpProperty.Script { get; set; }
+ OnScriptError? IIpProperty.OnScriptError { get; set; }
}
}
diff --git a/src/Nest/Mapping/Types/Specialized/Ip/IpProperty.cs b/src/Nest/Mapping/Types/Specialized/Ip/IpProperty.cs
index bd1095c77ff..2e77e67649f 100644
--- a/src/Nest/Mapping/Types/Specialized/Ip/IpProperty.cs
+++ b/src/Nest/Mapping/Types/Specialized/Ip/IpProperty.cs
@@ -24,6 +24,29 @@ public interface IIpProperty : IDocValuesProperty
[DataMember(Name ="null_value")]
string NullValue { get; set; }
+
+ ///
+ /// If true, malformed IP addresses are ignored. If false (default), malformed IP addresses throw an exception and reject the whole document.
+ /// Note that this cannot be set if the script parameter is used.
+ ///
+ [DataMember(Name = "ignore_malformed")]
+ bool? IgnoreMalformed { 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. Scripts can only be configured on long and double field types.
+ ///
+ [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; }
}
///
@@ -35,6 +58,15 @@ public IpProperty() : base(FieldType.Ip) { }
public double? Boost { get; set; }
public bool? Index { get; set; }
public string NullValue { get; set; }
+
+ ///
+ public bool? IgnoreMalformed { get; set; }
+
+ ///
+ public IInlineScript Script { get; set; }
+
+ ///
+ public OnScriptError? OnScriptError { get; set; }
}
///
@@ -48,6 +80,9 @@ public IpPropertyDescriptor() : base(FieldType.Ip) { }
double? IIpProperty.Boost { get; set; }
bool? IIpProperty.Index { get; set; }
string IIpProperty.NullValue { get; set; }
+ bool? IIpProperty.IgnoreMalformed { get; set; }
+ IInlineScript IIpProperty.Script { get; set; }
+ OnScriptError? IIpProperty.OnScriptError { get; set; }
public IpPropertyDescriptor Index(bool? index = true) => Assign(index, (a, v) => a.Index = v);
@@ -55,5 +90,19 @@ public IpPropertyDescriptor() : base(FieldType.Ip) { }
public IpPropertyDescriptor Boost(double? boost) => Assign(boost, (a, v) => a.Boost = v);
public IpPropertyDescriptor NullValue(string nullValue) => Assign(nullValue, (a, v) => a.NullValue = v);
+
+ public IpPropertyDescriptor IgnoreMalformed(bool? ignoreMalformed = true) => Assign(ignoreMalformed, (a, v) => a.IgnoreMalformed = v);
+
+ ///
+ public IpPropertyDescriptor Script(IInlineScript inlineScript) => Assign(inlineScript, (a, v) => a.Script = v);
+
+ ///
+ public IpPropertyDescriptor Script(string source) => Assign(source, (a, v) => a.Script = new InlineScript(source));
+
+ ///
+ public IpPropertyDescriptor Script(Func selector) => Assign(selector, (a, v) => a.Script = v?.Invoke(new InlineScriptDescriptor()));
+
+ ///
+ public IpPropertyDescriptor OnScriptError(OnScriptError? onScriptError) => Assign(onScriptError, (a, v) => a.OnScriptError = v);
}
}