Skip to content

Commit 7a6fe86

Browse files
committed
Add age_in_millis to ILM Explain Response
1 parent 7d62ea6 commit 7a6fe86

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/IndexLifecycleExplainResponse.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public class IndexLifecycleExplainResponse implements ToXContentObject, Writeabl
5151
private static final ParseField PREVIOUS_STEP_INFO_FIELD = new ParseField("previous_step_info");
5252
private static final ParseField PHASE_EXECUTION_INFO = new ParseField("phase_execution");
5353
private static final ParseField AGE_FIELD = new ParseField("age");
54+
private static final ParseField AGE_IN_MILLIS_FIELD = new ParseField("age_in_millis");
5455
private static final ParseField TIME_SINCE_INDEX_CREATION_FIELD = new ParseField("time_since_index_creation");
5556
private static final ParseField REPOSITORY_NAME = new ParseField("repository_name");
5657
private static final ParseField SHRINK_INDEX_NAME = new ParseField("shrink_index_name");
@@ -528,6 +529,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
528529
lifecycleDate
529530
);
530531
builder.field(AGE_FIELD.getPreferredName(), getAge(nowSupplier).toHumanReadableString(2));
532+
builder.field(AGE_IN_MILLIS_FIELD.getPreferredName(), getAge(nowSupplier).getMillis());
531533
}
532534
if (phase != null) {
533535
builder.field(PHASE_FIELD.getPreferredName(), phase);

x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/ExplainLifecycleIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ public void testExplainIndicesWildcard() throws Exception {
207207
assertThat(explainIndexWithMissingPolicy.get("action"), is(nullValue()));
208208
assertThat(explainIndexWithMissingPolicy.get("step"), is(ErrorStep.NAME));
209209
assertThat(explainIndexWithMissingPolicy.get("age"), is(nullValue()));
210+
assertThat(explainIndexWithMissingPolicy.get("age_in_millis"), is(nullValue()));
210211
assertThat(explainIndexWithMissingPolicy.get("failed_step"), is(nullValue()));
211212
Map<String, Object> stepInfo = (Map<String, Object>) explainIndexWithMissingPolicy.get("step_info");
212213
assertThat(stepInfo, is(notNullValue()));
@@ -343,6 +344,7 @@ private void assertManagedIndex(Map<String, Object> explainIndexMap) {
343344
assertThat(explainIndexMap.get("step"), is("complete"));
344345
assertThat(explainIndexMap.get("phase_time_millis"), is(notNullValue()));
345346
assertThat(explainIndexMap.get("age"), is(notNullValue()));
347+
assertThat(explainIndexMap.get("age_in_millis"), is(notNullValue()));
346348
assertThat(explainIndexMap.get("phase_execution"), is(notNullValue()));
347349
assertThat(explainIndexMap.get("failed_step"), is(nullValue()));
348350
assertThat(explainIndexMap.get("step_info"), is(nullValue()));

0 commit comments

Comments
 (0)