Skip to content

Commit a525bf6

Browse files
committed
fix #1105 add default and ignore_missing to timestamp mappings
1 parent 50b1194 commit a525bf6

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/Nest/Domain/Mapping/SpecialFields/TimestampFieldMapping.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ public interface ITimestampFieldMapping : ISpecialField
1616

1717
[JsonProperty("format")]
1818
string Format { get; set; }
19+
20+
[JsonProperty("default")]
21+
string Default { get; set; }
22+
23+
[JsonProperty("ignore_missing")]
24+
bool? IgnoreMissing { get; set; }
1925
}
2026

2127
public class TimestampFieldMapping : ITimestampFieldMapping
@@ -25,6 +31,8 @@ public class TimestampFieldMapping : ITimestampFieldMapping
2531
public PropertyPathMarker Path { get; set; }
2632

2733
public string Format { get; set; }
34+
public string Default { get; set; }
35+
public bool? IgnoreMissing { get; set; }
2836
}
2937

3038

@@ -37,6 +45,8 @@ public class TimestampFieldMappingDescriptor<T> : ITimestampFieldMapping
3745
PropertyPathMarker ITimestampFieldMapping.Path { get; set;}
3846

3947
string ITimestampFieldMapping.Format { get; set; }
48+
string ITimestampFieldMapping.Default { get; set; }
49+
bool? ITimestampFieldMapping.IgnoreMissing { get; set; }
4050

4151
public TimestampFieldMappingDescriptor<T> Enabled(bool enabled = true)
4252
{
@@ -54,12 +64,25 @@ public TimestampFieldMappingDescriptor<T> Path(Expression<Func<T, object>> objec
5464
Self.Path = objectPath;
5565
return this;
5666
}
67+
5768
public TimestampFieldMappingDescriptor<T> Format(string format)
5869
{
5970
Self.Format = format;
6071
return this;
6172
}
6273

74+
public TimestampFieldMappingDescriptor<T> Default(string defaultValue)
75+
{
76+
Self.Default = defaultValue;
77+
return this;
78+
}
79+
80+
public TimestampFieldMappingDescriptor<T> IgnoreMissing(bool ignoreMissing = true)
81+
{
82+
Self.IgnoreMissing = ignoreMissing;
83+
return this;
84+
}
85+
6386

6487
}
6588
}

0 commit comments

Comments
 (0)