rename ILM Phase "minimum_age" to "min_age" (#35058)

closes #34927.
This commit is contained in:
Tal Levy 2018-10-30 12:54:02 -07:00 committed by GitHub
parent 6ecb8ff344
commit f5323cd86e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 82 additions and 82 deletions

View File

@ -40,7 +40,7 @@ import java.util.stream.Collectors;
*/
public class Phase implements ToXContentObject {
static final ParseField MINIMUM_AGE = new ParseField("minimum_age");
static final ParseField MIN_AGE = new ParseField("min_age");
static final ParseField ACTIONS_FIELD = new ParseField("actions");
@SuppressWarnings("unchecked")
@ -49,7 +49,7 @@ public class Phase implements ToXContentObject {
.collect(Collectors.toMap(LifecycleAction::getName, Function.identity()))));
static {
PARSER.declareField(ConstructingObjectParser.optionalConstructorArg(),
(p, c) -> TimeValue.parseTimeValue(p.text(), MINIMUM_AGE.getPreferredName()), MINIMUM_AGE, ValueType.VALUE);
(p, c) -> TimeValue.parseTimeValue(p.text(), MIN_AGE.getPreferredName()), MIN_AGE, ValueType.VALUE);
PARSER.declareNamedObjects(ConstructingObjectParser.constructorArg(),
(p, c, n) -> p.namedObject(LifecycleAction.class, n, null), v -> {
throw new IllegalArgumentException("ordered " + ACTIONS_FIELD.getPreferredName() + " are not supported");
@ -111,7 +111,7 @@ public class Phase implements ToXContentObject {
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.field(MINIMUM_AGE.getPreferredName(), minimumAge.getStringRep());
builder.field(MIN_AGE.getPreferredName(), minimumAge.getStringRep());
builder.field(ACTIONS_FIELD.getPreferredName(), actions);
builder.endObject();
return builder;

View File

@ -48,7 +48,7 @@ PUT _ilm/my_policy
"policy": {
"phases": {
"warm": {
"minimum_age": "10d",
"min_age": "10d",
"actions": {
"forcemerge": {
"max_num_segments": 1
@ -56,7 +56,7 @@ PUT _ilm/my_policy
}
},
"delete": {
"minimum_age": "30d",
"min_age": "30d",
"actions": {
"delete": {}
}

View File

@ -52,7 +52,7 @@ PUT _ilm/my_policy
"policy": {
"phases": {
"warm": {
"minimum_age": "10d",
"min_age": "10d",
"actions": {
"forcemerge": {
"max_num_segments": 1
@ -60,7 +60,7 @@ PUT _ilm/my_policy
}
},
"delete": {
"minimum_age": "30d",
"min_age": "30d",
"actions": {
"delete": {}
}
@ -120,7 +120,7 @@ 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> The timestamp used for the `minimum_age`
<3> The timestamp used for the `min_age`
<4> The current phase
<5> The timestamp for when the index entered the current phase
<6> The current action
@ -151,7 +151,7 @@ phase definition has been completely executed.
"phase_execution": { <1>
"policy": "my_lifecycle3", <2>
"phase_definition": { <3>
"minimum_age": "0ms",
"min_age": "0ms",
"actions": {
"rollover": {
"max_age": "30s"
@ -203,7 +203,7 @@ If the policy is waiting for a step to complete for the index, the response will
"phase_execution": {
"policy": "my_lifecycle3",
"phase_definition": {
"minimum_age": "0ms",
"min_age": "0ms",
"actions": {
"allocate": {
"number_of_replicas": 2,
@ -262,7 +262,7 @@ that occurred in `step_info`.
"phase_execution": {
"policy": "my_lifecycle3",
"phase_definition": {
"minimum_age": "0ms",
"min_age": "0ms",
"actions": {
"rollover": {
"max_age": "30s"

View File

@ -51,7 +51,7 @@ PUT _ilm/my_policy
"policy": {
"phases": {
"warm": {
"minimum_age": "10d",
"min_age": "10d",
"actions": {
"forcemerge": {
"max_num_segments": 1
@ -59,7 +59,7 @@ PUT _ilm/my_policy
}
},
"delete": {
"minimum_age": "30d",
"min_age": "30d",
"actions": {
"delete": {}
}
@ -91,7 +91,7 @@ If the request does not encounter errors, you receive the following result:
"policy": {
"phases": {
"warm": {
"minimum_age": "10d",
"min_age": "10d",
"actions": {
"forcemerge": {
"max_num_segments": 1
@ -99,7 +99,7 @@ If the request does not encounter errors, you receive the following result:
}
},
"delete": {
"minimum_age": "30d",
"min_age": "30d",
"actions": {
"delete": {}
}

View File

@ -55,7 +55,7 @@ PUT _ilm/my_policy
"policy": {
"phases": {
"warm": {
"minimum_age": "10d",
"min_age": "10d",
"actions": {
"forcemerge": {
"max_num_segments": 1
@ -63,7 +63,7 @@ PUT _ilm/my_policy
}
},
"delete": {
"minimum_age": "30d",
"min_age": "30d",
"actions": {
"delete": {}
}

View File

@ -51,7 +51,7 @@ PUT _ilm/my_policy
"policy": {
"phases": {
"warm": {
"minimum_age": "10d",
"min_age": "10d",
"actions": {
"forcemerge": {
"max_num_segments": 1
@ -59,7 +59,7 @@ PUT _ilm/my_policy
}
},
"delete": {
"minimum_age": "30d",
"min_age": "30d",
"actions": {
"delete": {}
}

View File

@ -49,7 +49,7 @@ PUT _ilm/my_policy
"policy": {
"phases": {
"warm": {
"minimum_age": "10d",
"min_age": "10d",
"actions": {
"forcemerge": {
"max_num_segments": 1
@ -57,7 +57,7 @@ PUT _ilm/my_policy
}
},
"delete": {
"minimum_age": "30d",
"min_age": "30d",
"actions": {
"delete": {}
}

View File

@ -45,7 +45,7 @@ PUT _ilm/my_policy
"policy": {
"phases": {
"warm": {
"minimum_age": "10d",
"min_age": "10d",
"actions": {
"forcemerge": {
"max_num_segments": 1
@ -53,7 +53,7 @@ PUT _ilm/my_policy
}
},
"delete": {
"minimum_age": "30d",
"min_age": "30d",
"actions": {
"delete": {}
}

View File

@ -47,7 +47,7 @@ PUT _ilm/my_policy
"policy": {
"phases": {
"warm": {
"minimum_age": "10d",
"min_age": "10d",
"actions": {
"forcemerge": {
"max_num_segments": 1
@ -55,7 +55,7 @@ PUT _ilm/my_policy
}
},
"delete": {
"minimum_age": "30d",
"min_age": "30d",
"actions": {
"delete": {}
}

View File

@ -22,7 +22,7 @@ PUT _ilm/my_policy
}
},
"delete": {
"minimum_age": "30d",
"min_age": "30d",
"actions": {
"delete": {} <2>
}

View File

@ -22,7 +22,7 @@ PUT _ilm/my_policy
"policy": {
"phases": {
"warm": {
"minimum_age": "10d",
"min_age": "10d",
"actions": {
"forcemerge": {
"max_num_segments": 1
@ -30,7 +30,7 @@ PUT _ilm/my_policy
}
},
"delete": {
"minimum_age": "30d",
"min_age": "30d",
"actions": {
"delete": {}
}

View File

@ -33,7 +33,7 @@ PUT _ilm/my_policy
}
},
"delete": {
"minimum_age": "30d",
"min_age": "30d",
"actions": {
"delete": {}
}
@ -65,7 +65,7 @@ PUT _ilm/my_policy
}
},
"delete": {
"minimum_age": "10d", <1>
"min_age": "10d", <1>
"actions": {
"delete": {}
}
@ -76,7 +76,7 @@ PUT _ilm/my_policy
------------------------
// CONSOLE
// TEST[continued]
<1> update `minimum_age` to 10 days
<1> update `min_age` to 10 days
//////////
[source,js]
@ -99,7 +99,7 @@ with its version bumped to 2.
"policy": {
"phases": {
"hot": {
"minimum_age": "0ms",
"min_age": "0ms",
"actions": {
"rollover": {
"max_size": "25gb"
@ -107,7 +107,7 @@ with its version bumped to 2.
}
},
"delete": {
"minimum_age": "10d",
"min_age": "10d",
"actions": {
"delete": {}
}
@ -148,7 +148,7 @@ PUT _ilm/my_executing_policy
}
},
"delete": {
"minimum_age": "10d",
"min_age": "10d",
"actions": {
"delete": {}
}
@ -203,7 +203,7 @@ GET my_index/_ilm/explain
"modified_date_in_millis": 1538475653317,
"version": 1,
"phase_definition": {
"minimum_age": "0ms",
"min_age": "0ms",
"actions": {
"rollover": {
"max_docs": 1
@ -231,7 +231,7 @@ PUT _ilm/my_executing_policy
"policy": {
"phases": {
"warm": {
"minimum_age": "1d",
"min_age": "1d",
"actions": {
"forcemerge": {
"max_num_segments": 1
@ -239,7 +239,7 @@ PUT _ilm/my_executing_policy
}
},
"delete": {
"minimum_age": "10d",
"min_age": "10d",
"actions": {
"delete": {}
}
@ -283,7 +283,7 @@ GET my_index/_ilm/explain
"modified_date_in_millis": 1538475653317,
"version": 1,
"phase_definition": {
"minimum_age": "0ms",
"min_age": "0ms",
"actions": {
"rollover": {
"max_docs": 1
@ -339,7 +339,7 @@ GET my_index/_ilm/explain
"modified_date_in_millis": 1538475653317,
"version": 2, <1>
"phase_definition": {
"minimum_age": "1d",
"min_age": "1d",
"actions": {
"forcemerge": {
"max_num_segments": 1
@ -383,7 +383,7 @@ PUT _ilm/my_policy
}
},
"delete": {
"minimum_age": "10d",
"min_age": "10d",
"actions": {
"delete": {}
}
@ -397,7 +397,7 @@ PUT _ilm/my_other_policy
"policy": {
"phases": {
"delete": {
"minimum_age": "1d",
"min_age": "1d",
"actions": {
"delete": {}
}

View File

@ -41,7 +41,7 @@ when the index size reaches 25GB. The old index is subsequently deleted after
NOTE: Once an index rolls over, {ilm} uses the timestamp of the rollover
operation rather than the index creation time to evaluate when to move the
index to the next phase. For indices that have rolled over, the `minimum_age`
index to the next phase. For indices that have rolled over, the `min_age`
criteria specified for a phase is relative to the rollover time for indices. In
this example, that means the index will be deleted 30 days after rollover, not
30 days from when the index was created.
@ -60,7 +60,7 @@ PUT /_ilm/my_policy
}
},
"delete": {
"minimum_age": "30d",
"min_age": "30d",
"actions": {
"delete": {}
}

View File

@ -59,7 +59,7 @@ public class IndexLifecycleFeatureSetUsage extends XPackFeatureSet.Usage {
builder.field("policy_stats", policyStats);
}
}
public List<PolicyStats> getPolicyStats() {
return policyStats;
}
@ -170,25 +170,25 @@ public class IndexLifecycleFeatureSetUsage extends XPackFeatureSet.Usage {
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.field(Phase.MINIMUM_AGE.getPreferredName(), minimumAge.getMillis());
builder.field(Phase.MIN_AGE.getPreferredName(), minimumAge.getMillis());
builder.field(Phase.ACTIONS_FIELD.getPreferredName(), actionNames);
builder.endObject();
return builder;
}
public String[] getActionNames() {
return actionNames;
}
public TimeValue getAfter() {
return minimumAge;
}
@Override
public int hashCode() {
return Objects.hash(Arrays.hashCode(actionNames), minimumAge);
}
@Override
public boolean equals(Object obj) {
if (obj == null) {

View File

@ -31,7 +31,7 @@ import java.util.stream.Collectors;
*/
public class Phase implements ToXContentObject, Writeable {
public static final ParseField MINIMUM_AGE = new ParseField("minimum_age");
public static final ParseField MIN_AGE = new ParseField("min_age");
public static final ParseField ACTIONS_FIELD = new ParseField("actions");
@SuppressWarnings("unchecked")
@ -40,7 +40,7 @@ public class Phase implements ToXContentObject, Writeable {
.collect(Collectors.toMap(LifecycleAction::getWriteableName, Function.identity()))));
static {
PARSER.declareField(ConstructingObjectParser.optionalConstructorArg(),
(p, c) -> TimeValue.parseTimeValue(p.text(), MINIMUM_AGE.getPreferredName()), MINIMUM_AGE, ValueType.VALUE);
(p, c) -> TimeValue.parseTimeValue(p.text(), MIN_AGE.getPreferredName()), MIN_AGE, ValueType.VALUE);
PARSER.declareNamedObjects(ConstructingObjectParser.constructorArg(),
(p, c, n) -> p.namedObject(LifecycleAction.class, n, null), v -> {
throw new IllegalArgumentException("ordered " + ACTIONS_FIELD.getPreferredName() + " are not supported");
@ -128,7 +128,7 @@ public class Phase implements ToXContentObject, Writeable {
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.field(MINIMUM_AGE.getPreferredName(), minimumAge.getStringRep());
builder.field(MIN_AGE.getPreferredName(), minimumAge.getStringRep());
builder.field(ACTIONS_FIELD.getPreferredName(), actions);
builder.endObject();
return builder;

View File

@ -24,7 +24,7 @@ setup:
"policy": {
"phases": {
"warm": {
"minimum_age": "10s",
"min_age": "10s",
"actions": {
"forcemerge": {
"max_num_segments": 10000
@ -32,7 +32,7 @@ setup:
}
},
"delete": {
"minimum_age": "30s",
"min_age": "30s",
"actions": {
"delete": {}
}
@ -46,8 +46,8 @@ setup:
policy: "my_timeseries_lifecycle"
- match: { my_timeseries_lifecycle.version: 1 }
- is_true: my_timeseries_lifecycle.modified_date
- match: { my_timeseries_lifecycle.policy.phases.warm.minimum_age: "10s" }
- match: { my_timeseries_lifecycle.policy.phases.delete.minimum_age: "30s" }
- match: { my_timeseries_lifecycle.policy.phases.warm.min_age: "10s" }
- match: { my_timeseries_lifecycle.policy.phases.delete.min_age: "30s" }
- do:
ilm.delete_lifecycle:
@ -68,7 +68,7 @@ setup:
"policy": {
"phases": {
"warm": {
"minimum_age": "10s",
"min_age": "10s",
"actions": {
"forcemerge": {
"max_num_segments": 10000
@ -76,7 +76,7 @@ setup:
}
},
"delete": {
"minimum_age": "30s",
"min_age": "30s",
"actions": {
"delete": {}
}
@ -90,8 +90,8 @@ setup:
policy: "my_timeseries_lifecycle"
- match: { my_timeseries_lifecycle.version: 1 }
- is_true: my_timeseries_lifecycle.modified_date
- match: { my_timeseries_lifecycle.policy.phases.warm.minimum_age: "10s" }
- match: { my_timeseries_lifecycle.policy.phases.delete.minimum_age: "30s" }
- match: { my_timeseries_lifecycle.policy.phases.warm.min_age: "10s" }
- match: { my_timeseries_lifecycle.policy.phases.delete.min_age: "30s" }
- do:
@ -116,7 +116,7 @@ setup:
"policy": {
"phases": {
"warm": {
"minimum_age": "300s",
"min_age": "300s",
"actions": {
"forcemerge": {
"max_num_segments": 10000
@ -124,7 +124,7 @@ setup:
}
},
"delete": {
"minimum_age": "600s",
"min_age": "600s",
"actions": {
"delete": {}
}
@ -138,8 +138,8 @@ setup:
policy: "my_timeseries_lifecycle"
- match: { my_timeseries_lifecycle.version: 2 }
- is_true: my_timeseries_lifecycle.modified_date
- match: { my_timeseries_lifecycle.policy.phases.warm.minimum_age: "300s" }
- match: { my_timeseries_lifecycle.policy.phases.delete.minimum_age: "600s" }
- match: { my_timeseries_lifecycle.policy.phases.warm.min_age: "300s" }
- match: { my_timeseries_lifecycle.policy.phases.delete.min_age: "600s" }
- do:
indices.delete:
@ -167,7 +167,7 @@ setup:
"policy": {
"phases": {
"warm": {
"minimum_age": "10s",
"min_age": "10s",
"actions": {
"forcemerge": {
"max_num_segments": 10000
@ -175,7 +175,7 @@ setup:
}
},
"delete": {
"minimum_age": "30s",
"min_age": "30s",
"actions": {
"delete": {}
}
@ -187,8 +187,8 @@ setup:
- do:
ilm.get_lifecycle:
policy: "my_timeseries_lifecycle"
- match: { my_timeseries_lifecycle.policy.phases.warm.minimum_age: "10s" }
- match: { my_timeseries_lifecycle.policy.phases.delete.minimum_age: "30s" }
- match: { my_timeseries_lifecycle.policy.phases.warm.min_age: "10s" }
- match: { my_timeseries_lifecycle.policy.phases.delete.min_age: "30s" }
- do:
indices.create:

View File

@ -11,7 +11,7 @@ setup:
"policy": {
"phases": {
"warm": {
"minimum_age": "1000s",
"min_age": "1000s",
"actions": {
"forcemerge": {
"max_num_segments": 10000
@ -19,7 +19,7 @@ setup:
}
},
"hot": {
"minimum_age": "1000s",
"min_age": "1000s",
"actions": { }
}
}

View File

@ -12,7 +12,7 @@ setup:
"policy": {
"phases": {
"warm": {
"minimum_age": "1000s",
"min_age": "1000s",
"actions": {
"forcemerge": {
"max_num_segments": 10000
@ -20,7 +20,7 @@ setup:
}
},
"hot": {
"minimum_age": "1000s",
"min_age": "1000s",
"actions": { }
}
}

View File

@ -11,7 +11,7 @@ setup:
"policy": {
"phases": {
"warm": {
"minimum_age": "1000s",
"min_age": "1000s",
"actions": {
"forcemerge": {
"max_num_segments": 10000
@ -19,7 +19,7 @@ setup:
}
},
"hot": {
"minimum_age": "1000s",
"min_age": "1000s",
"actions": { }
}
}
@ -225,11 +225,11 @@ teardown:
"policy": {
"phases": {
"hot": {
"minimum_age": "1000s",
"min_age": "1000s",
"actions": {}
},
"warm": {
"minimum_age": "2000s",
"min_age": "2000s",
"actions": {
"forcemerge": {
"max_num_segments": 10000

View File

@ -18,7 +18,7 @@ setup:
"policy": {
"phases": {
"warm": {
"minimum_age": "10s",
"min_age": "10s",
"actions": {
"forcemerge": {
"max_num_segments": 10000
@ -26,7 +26,7 @@ setup:
}
},
"delete": {
"minimum_age": "30s",
"min_age": "30s",
"actions": {
"delete": {}
}

View File

@ -11,7 +11,7 @@ setup:
"policy": {
"phases": {
"warm": {
"minimum_age": "1000s",
"min_age": "1000s",
"actions": {
"forcemerge": {
"max_num_segments": 10000
@ -19,7 +19,7 @@ setup:
}
},
"hot": {
"minimum_age": "1000s",
"min_age": "1000s",
"actions": { }
}
}
@ -38,7 +38,7 @@ setup:
"policy": {
"phases": {
"warm": {
"minimum_age": "1000s",
"min_age": "1000s",
"actions": {
"forcemerge": {
"max_num_segments": 10000
@ -46,7 +46,7 @@ setup:
}
},
"hot": {
"minimum_age": "1000s",
"min_age": "1000s",
"actions": { }
}
}