Skip to content

Commit 453eb74

Browse files
committed
Merge pull request #1537 from KodrAus/develop
add store to timestamp field mapping #1533
2 parents 5d0839d + 07472c1 commit 453eb74

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

Diff for: src/Nest/Domain/Mapping/SpecialFields/TimestampFieldMapping.cs

+13-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public interface ITimestampFieldMapping : ISpecialField
2222

2323
[JsonProperty("ignore_missing")]
2424
bool? IgnoreMissing { get; set; }
25+
26+
[JsonProperty("store")]
27+
bool? Store { get; set; }
2528
}
2629

2730
public class TimestampFieldMapping : ITimestampFieldMapping
@@ -33,6 +36,7 @@ public class TimestampFieldMapping : ITimestampFieldMapping
3336
public string Format { get; set; }
3437
public string Default { get; set; }
3538
public bool? IgnoreMissing { get; set; }
39+
public bool? Store { get; set; }
3640
}
3741

3842

@@ -47,12 +51,20 @@ public class TimestampFieldMappingDescriptor<T> : ITimestampFieldMapping
4751
string ITimestampFieldMapping.Format { get; set; }
4852
string ITimestampFieldMapping.Default { get; set; }
4953
bool? ITimestampFieldMapping.IgnoreMissing { get; set; }
54+
bool? ITimestampFieldMapping.Store { get; set; }
5055

5156
public TimestampFieldMappingDescriptor<T> Enabled(bool enabled = true)
5257
{
5358
Self.Enabled = enabled;
5459
return this;
5560
}
61+
62+
public TimestampFieldMappingDescriptor<T> Store(bool store = true)
63+
{
64+
Self.Store = store;
65+
return this;
66+
}
67+
5668
public TimestampFieldMappingDescriptor<T> Path(string path)
5769
{
5870
Self.Path = path;
@@ -85,4 +97,4 @@ public TimestampFieldMappingDescriptor<T> IgnoreMissing(bool ignoreMissing = tru
8597

8698

8799
}
88-
}
100+
}

Diff for: src/Tests/Nest.Tests.Unit/Core/Map/TimestampField/TimestampFieldTests.cs

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public void TimestampFieldUsingString()
2525
.TimestampField(a => a
2626
.Path("my_difficult_field_name")
2727
.Enabled()
28+
.Store()
2829
)
2930
);
3031
this.JsonEquals(result.ConnectionStatus.Request, MethodInfo.GetCurrentMethod());

Diff for: src/Tests/Nest.Tests.Unit/Core/Map/TimestampField/TimestampFieldUsingString.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"elasticsearchprojects": {
33
"_timestamp": {
44
"enabled": true,
5-
"path": "my_difficult_field_name"
5+
"path": "my_difficult_field_name",
6+
"store": true
67
}
78
}
89
}

0 commit comments

Comments
 (0)