Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public class IndexLifecycleExplainResponse implements ToXContentObject {
private static final ParseField INDEX_FIELD = new ParseField("index");
private static final ParseField MANAGED_BY_ILM_FIELD = new ParseField("managed");
private static final ParseField POLICY_NAME_FIELD = new ParseField("policy");
private static final ParseField SKIP_FIELD = new ParseField("skip");
private static final ParseField LIFECYCLE_DATE_FIELD = new ParseField("lifecycle_date");
private static final ParseField PHASE_FIELD = new ParseField("phase");
private static final ParseField ACTION_FIELD = new ParseField("action");
Expand All @@ -57,22 +56,20 @@ public class IndexLifecycleExplainResponse implements ToXContentObject {
(String) a[0],
(boolean) a[1],
(String) a[2],
(boolean) (a[3] == null ? false: a[3]),
(long) (a[4] == null ? -1L: a[4]),
(long) (a[3] == null ? -1L: a[3]),
(String) a[4],
(String) a[5],
(String) a[6],
(String) a[7],
(String) a[8],
(long) (a[8] == null ? -1L: a[8]),
(long) (a[9] == null ? -1L: a[9]),
(long) (a[10] == null ? -1L: a[10]),
(long) (a[11] == null ? -1L: a[11]),
(BytesReference) a[12],
(PhaseExecutionInfo) a[13]));
(BytesReference) a[11],
(PhaseExecutionInfo) a[12]));
static {
PARSER.declareString(ConstructingObjectParser.constructorArg(), INDEX_FIELD);
PARSER.declareBoolean(ConstructingObjectParser.constructorArg(), MANAGED_BY_ILM_FIELD);
PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), POLICY_NAME_FIELD);
PARSER.declareBoolean(ConstructingObjectParser.optionalConstructorArg(), SKIP_FIELD);
PARSER.declareLong(ConstructingObjectParser.optionalConstructorArg(), LIFECYCLE_DATE_FIELD);
PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), PHASE_FIELD);
PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), ACTION_FIELD);
Expand Down Expand Up @@ -100,24 +97,23 @@ public class IndexLifecycleExplainResponse implements ToXContentObject {
private final long phaseTime;
private final long actionTime;
private final long stepTime;
private final boolean skip;
private final boolean managedByILM;
private final BytesReference stepInfo;
private final PhaseExecutionInfo phaseExecutionInfo;

public static IndexLifecycleExplainResponse newManagedIndexResponse(String index, String policyName, boolean skip, long lifecycleDate,
public static IndexLifecycleExplainResponse newManagedIndexResponse(String index, String policyName, long lifecycleDate,
String phase, String action, String step, String failedStep,
long phaseTime, long actionTime, long stepTime,
BytesReference stepInfo, PhaseExecutionInfo phaseExecutionInfo) {
return new IndexLifecycleExplainResponse(index, true, policyName, skip, lifecycleDate, phase, action, step, failedStep, phaseTime,
return new IndexLifecycleExplainResponse(index, true, policyName, lifecycleDate, phase, action, step, failedStep, phaseTime,
actionTime, stepTime, stepInfo, phaseExecutionInfo);
}

public static IndexLifecycleExplainResponse newUnmanagedIndexResponse(String index) {
return new IndexLifecycleExplainResponse(index, false, null, false, -1L, null, null, null, null, -1L, -1L, -1L, null, null);
return new IndexLifecycleExplainResponse(index, false, null, -1L, null, null, null, null, -1L, -1L, -1L, null, null);
}

private IndexLifecycleExplainResponse(String index, boolean managedByILM, String policyName, boolean skip, long lifecycleDate,
private IndexLifecycleExplainResponse(String index, boolean managedByILM, String policyName, long lifecycleDate,
String phase, String action, String step, String failedStep, long phaseTime, long actionTime,
long stepTime, BytesReference stepInfo, PhaseExecutionInfo phaseExecutionInfo) {
if (managedByILM) {
Expand All @@ -134,7 +130,6 @@ private IndexLifecycleExplainResponse(String index, boolean managedByILM, String
this.index = index;
this.policyName = policyName;
this.managedByILM = managedByILM;
this.skip = skip;
this.lifecycleDate = lifecycleDate;
this.phase = phase;
this.action = action;
Expand All @@ -159,10 +154,6 @@ public String getPolicyName() {
return policyName;
}

public boolean skip() {
return skip;
}

public long getLifecycleDate() {
return lifecycleDate;
}
Expand Down Expand Up @@ -210,7 +201,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
builder.field(MANAGED_BY_ILM_FIELD.getPreferredName(), managedByILM);
if (managedByILM) {
builder.field(POLICY_NAME_FIELD.getPreferredName(), policyName);
builder.field(SKIP_FIELD.getPreferredName(), skip);
if (builder.humanReadable()) {
builder.field(LIFECYCLE_DATE_FIELD.getPreferredName(), new DateTime(lifecycleDate, ISOChronology.getInstanceUTC()));
} else {
Expand Down Expand Up @@ -250,7 +240,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws

@Override
public int hashCode() {
return Objects.hash(index, managedByILM, policyName, skip, lifecycleDate, phase, action, step, failedStep, phaseTime, actionTime,
return Objects.hash(index, managedByILM, policyName, lifecycleDate, phase, action, step, failedStep, phaseTime, actionTime,
stepTime, stepInfo, phaseExecutionInfo);
}

Expand All @@ -266,7 +256,6 @@ public boolean equals(Object obj) {
return Objects.equals(index, other.index) &&
Objects.equals(managedByILM, other.managedByILM) &&
Objects.equals(policyName, other.policyName) &&
Objects.equals(skip, other.skip) &&
Objects.equals(lifecycleDate, other.lifecycleDate) &&
Objects.equals(phase, other.phase) &&
Objects.equals(action, other.action) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private static IndexLifecycleExplainResponse randomUnmanagedIndexExplainResponse
}

private static IndexLifecycleExplainResponse randomManagedIndexExplainResponse() {
return IndexLifecycleExplainResponse.newManagedIndexResponse(randomAlphaOfLength(10), randomAlphaOfLength(10), randomBoolean(),
return IndexLifecycleExplainResponse.newManagedIndexResponse(randomAlphaOfLength(10), randomAlphaOfLength(10),
randomNonNegativeLong(), randomAlphaOfLength(10), randomAlphaOfLength(10), randomAlphaOfLength(10),
randomBoolean() ? null : randomAlphaOfLength(10), randomNonNegativeLong(), randomNonNegativeLong(), randomNonNegativeLong(),
randomBoolean() ? null : new BytesArray(new RandomStepInfo(() -> randomAlphaOfLength(10)).toString()),
Expand Down
33 changes: 14 additions & 19 deletions x-pack/docs/en/ilm/apis/explain.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,13 @@ When the index is first taken over by ILM you will see a response like the follo
"index": "my_index",
"managed": true, <1>
"policy": "my_policy", <2>
"skip": false, <3>
"lifecycle_date": 1538475653281, <4>
"phase": "new", <5>
"phase_time": 1538475653317, <6>
"action": "complete", <7>
"action_time": 1538475653317, <8>
"step": "complete", <9>
"step_time": 1538475653317 <10>
"lifecycle_date": 1538475653281, <3>
"phase": "new", <4>
"phase_time": 1538475653317, <5>
"action": "complete", <6>
"action_time": 1538475653317, <7>
"step": "complete", <8>
"step_time": 1538475653317 <9>
}
}
}
Expand All @@ -121,14 +120,13 @@ When the index is first taken over by ILM you will see a response like the follo
<1> Shows if the index is being managed by ILM. If the index is not managed by
ILM the other fields will not be shown
<2> The name of the policy which ILM is using for this index
<3> Shows whether ILM execution for the index is currently set to be skipped
<4> The timestamp used for the `minimum_age`
<5> The current phase
<6> The timestamp for when the index entered the current phase
<7> The current action
<8> The timestamp for when the index entered the current action
<9> The current step
<10> The timestamp for when the index entered the current step
<3> The timestamp used for the `minimum_age`
<4> The current phase
<5> The timestamp for when the index entered the current phase
<6> The current action
<7> The timestamp for when the index entered the current action
<8> The current step
<9> The timestamp for when the index entered the current step

When the policy is running on the index the response will contain a
`phase_execution` object that describes the exact phase that is being run.
Expand All @@ -143,7 +141,6 @@ phase definition has been completely executed.
"index": "test-000069",
"managed": true,
"policy": "my_lifecycle3",
"skip": false,
"lifecycle_date": "2018-10-15T13:45:21.981Z",
"phase": "hot",
"phase_time": "2018-10-15T13:45:22.577Z",
Expand Down Expand Up @@ -190,7 +187,6 @@ If the policy is waiting for a step to complete for the index, the response will
"index": "test-000020",
"managed": true,
"policy": "my_lifecycle3",
"skip": false,
"lifecycle_date": "2018-10-15T13:20:28.042Z",
"phase": "warm",
"phase_time": "2018-10-15T13:20:28.428Z",
Expand Down Expand Up @@ -249,7 +245,6 @@ that occurred in `step_info`.
"index": "test-000056",
"managed": true,
"policy": "my_lifecycle3",
"skip": false,
"lifecycle_date": "2018-10-15T13:38:26.209Z",
"phase": "hot",
"phase_time": "2018-10-15T13:38:26.706Z",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public class IndexLifecycleExplainResponse implements ToXContentObject, Writeabl
private static final ParseField INDEX_FIELD = new ParseField("index");
private static final ParseField MANAGED_BY_ILM_FIELD = new ParseField("managed");
private static final ParseField POLICY_NAME_FIELD = new ParseField("policy");
private static final ParseField SKIP_FIELD = new ParseField("skip");
private static final ParseField LIFECYCLE_DATE_FIELD = new ParseField("lifecycle_date");
private static final ParseField PHASE_FIELD = new ParseField("phase");
private static final ParseField ACTION_FIELD = new ParseField("action");
Expand All @@ -47,22 +46,20 @@ public class IndexLifecycleExplainResponse implements ToXContentObject, Writeabl
(String) a[0],
(boolean) a[1],
(String) a[2],
(boolean) (a[3] == null ? false: a[3]),
(Long) (a[4]),
(Long) (a[3]),
(String) a[4],
(String) a[5],
(String) a[6],
(String) a[7],
(String) a[8],
(Long) (a[8]),
(Long) (a[9]),
(Long) (a[10]),
(Long) (a[11]),
(BytesReference) a[12],
(PhaseExecutionInfo) a[13]));
(BytesReference) a[11],
(PhaseExecutionInfo) a[12]));
static {
PARSER.declareString(ConstructingObjectParser.constructorArg(), INDEX_FIELD);
PARSER.declareBoolean(ConstructingObjectParser.constructorArg(), MANAGED_BY_ILM_FIELD);
PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), POLICY_NAME_FIELD);
PARSER.declareBoolean(ConstructingObjectParser.optionalConstructorArg(), SKIP_FIELD);
PARSER.declareLong(ConstructingObjectParser.optionalConstructorArg(), LIFECYCLE_DATE_FIELD);
PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), PHASE_FIELD);
PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), ACTION_FIELD);
Expand Down Expand Up @@ -90,23 +87,22 @@ public class IndexLifecycleExplainResponse implements ToXContentObject, Writeabl
private final Long phaseTime;
private final Long actionTime;
private final Long stepTime;
private final boolean skip;
private final boolean managedByILM;
private final BytesReference stepInfo;
private final PhaseExecutionInfo phaseExecutionInfo;

public static IndexLifecycleExplainResponse newManagedIndexResponse(String index, String policyName, boolean skip, Long lifecycleDate,
public static IndexLifecycleExplainResponse newManagedIndexResponse(String index, String policyName, Long lifecycleDate,
String phase, String action, String step, String failedStep, Long phaseTime, Long actionTime, Long stepTime,
BytesReference stepInfo, PhaseExecutionInfo phaseExecutionInfo) {
return new IndexLifecycleExplainResponse(index, true, policyName, skip, lifecycleDate, phase, action, step, failedStep, phaseTime,
return new IndexLifecycleExplainResponse(index, true, policyName, lifecycleDate, phase, action, step, failedStep, phaseTime,
actionTime, stepTime, stepInfo, phaseExecutionInfo);
}

public static IndexLifecycleExplainResponse newUnmanagedIndexResponse(String index) {
return new IndexLifecycleExplainResponse(index, false, null, false, null, null, null, null, null, null, null, null, null, null);
return new IndexLifecycleExplainResponse(index, false, null, null, null, null, null, null, null, null, null, null, null);
}

private IndexLifecycleExplainResponse(String index, boolean managedByILM, String policyName, boolean skip, Long lifecycleDate,
private IndexLifecycleExplainResponse(String index, boolean managedByILM, String policyName, Long lifecycleDate,
String phase, String action, String step, String failedStep, Long phaseTime, Long actionTime,
Long stepTime, BytesReference stepInfo, PhaseExecutionInfo phaseExecutionInfo) {
if (managedByILM) {
Expand All @@ -123,7 +119,6 @@ private IndexLifecycleExplainResponse(String index, boolean managedByILM, String
this.index = index;
this.policyName = policyName;
this.managedByILM = managedByILM;
this.skip = skip;
this.lifecycleDate = lifecycleDate;
this.phase = phase;
this.action = action;
Expand All @@ -141,7 +136,6 @@ public IndexLifecycleExplainResponse(StreamInput in) throws IOException {
managedByILM = in.readBoolean();
if (managedByILM) {
policyName = in.readString();
skip = in.readBoolean();
lifecycleDate = in.readOptionalLong();
phase = in.readOptionalString();
action = in.readOptionalString();
Expand All @@ -154,7 +148,6 @@ public IndexLifecycleExplainResponse(StreamInput in) throws IOException {
phaseExecutionInfo = in.readOptionalWriteable(PhaseExecutionInfo::new);
} else {
policyName = null;
skip = false;
lifecycleDate = null;
phase = null;
action = null;
Expand All @@ -174,7 +167,6 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(managedByILM);
if (managedByILM) {
out.writeString(policyName);
out.writeBoolean(skip);
out.writeOptionalLong(lifecycleDate);
out.writeOptionalString(phase);
out.writeOptionalString(action);
Expand All @@ -200,10 +192,6 @@ public String getPolicyName() {
return policyName;
}

public boolean skip() {
return skip;
}

public Long getLifecycleDate() {
return lifecycleDate;
}
Expand Down Expand Up @@ -251,7 +239,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
builder.field(MANAGED_BY_ILM_FIELD.getPreferredName(), managedByILM);
if (managedByILM) {
builder.field(POLICY_NAME_FIELD.getPreferredName(), policyName);
builder.field(SKIP_FIELD.getPreferredName(), skip);
if (builder.humanReadable()) {
builder.field(LIFECYCLE_DATE_FIELD.getPreferredName(), new DateTime(lifecycleDate, ISOChronology.getInstanceUTC()));
} else {
Expand Down Expand Up @@ -291,7 +278,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws

@Override
public int hashCode() {
return Objects.hash(index, managedByILM, policyName, skip, lifecycleDate, phase, action, step, failedStep, phaseTime, actionTime,
return Objects.hash(index, managedByILM, policyName, lifecycleDate, phase, action, step, failedStep, phaseTime, actionTime,
stepTime, stepInfo, phaseExecutionInfo);
}

Expand All @@ -307,7 +294,6 @@ public boolean equals(Object obj) {
return Objects.equals(index, other.index) &&
Objects.equals(managedByILM, other.managedByILM) &&
Objects.equals(policyName, other.policyName) &&
Objects.equals(skip, other.skip) &&
Objects.equals(lifecycleDate, other.lifecycleDate) &&
Objects.equals(phase, other.phase) &&
Objects.equals(action, other.action) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@
public class LifecycleSettings {
public static final String LIFECYCLE_POLL_INTERVAL = "indices.lifecycle.poll_interval";
public static final String LIFECYCLE_NAME = "index.lifecycle.name";
public static final String LIFECYCLE_SKIP = "index.lifecycle.skip";

public static final Setting<TimeValue> LIFECYCLE_POLL_INTERVAL_SETTING = Setting.positiveTimeSetting(LIFECYCLE_POLL_INTERVAL,
TimeValue.timeValueMinutes(10), Setting.Property.Dynamic, Setting.Property.NodeScope);
public static final Setting<String> LIFECYCLE_NAME_SETTING = Setting.simpleString(LIFECYCLE_NAME,
Setting.Property.Dynamic, Setting.Property.IndexScope);
public static final Setting<Boolean> LIFECYCLE_SKIP_SETTING = Setting.boolSetting(LIFECYCLE_SKIP, false,
Setting.Property.Dynamic, Setting.Property.IndexScope);
}
Loading