Skip to content

Commit e564b48

Browse files
authored
Add human readable version of modified date for snapshot lifecycle policy (#41035)
* Add human readable version of modified date for snapshot lifecycle policy This small change changes it from: ``` ... "modified_date": 1554843903242, ... ``` To ``` ... "modified_date" : "2019-04-09T21:05:03.242Z", "modified_date_millis" : 1554843903242, ... ``` Including the `"modified_date"` field when the `?human` field is used. Relates to #38461 * Fix test
1 parent d4fab06 commit e564b48

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/snapshotlifecycle/SnapshotLifecyclePolicyItem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public boolean equals(Object obj) {
113113
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
114114
builder.startObject(policy.getId());
115115
builder.field("version", version);
116-
builder.field("modified_date", modifiedDate);
116+
builder.timeField("modified_date_millis", "modified_date", modifiedDate);
117117
builder.field("policy", policy);
118118
if (lastSuccess != null) {
119119
builder.field("last_success", lastSuccess);

x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/snapshotlifecycle/SnapshotLifecycleIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void testFullPolicySnapshot() throws Exception {
9393
Map<String, Object> lastSuccessObject = (Map<String, Object>) policyMetadataMap.get("last_success");
9494
assertNotNull(lastSuccessObject);
9595
Long lastSuccess = (Long) lastSuccessObject.get("time");
96-
Long modifiedDate = (Long) policyMetadataMap.get("modified_date");
96+
Long modifiedDate = (Long) policyMetadataMap.get("modified_date_millis");
9797
assertNotNull(lastSuccess);
9898
assertNotNull(modifiedDate);
9999
assertThat(lastSuccess, greaterThan(modifiedDate));
@@ -133,7 +133,7 @@ public void testPolicyFailure() throws Exception {
133133
assertNotNull(lastFailureObject);
134134

135135
Long lastFailure = (Long) lastFailureObject.get("time");
136-
Long modifiedDate = (Long) policyMetadataMap.get("modified_date");
136+
Long modifiedDate = (Long) policyMetadataMap.get("modified_date_millis");
137137
assertNotNull(lastFailure);
138138
assertNotNull(modifiedDate);
139139
assertThat(lastFailure, greaterThan(modifiedDate));

0 commit comments

Comments
 (0)