Skip to content

Commit

Permalink
Kibana should allow a min_age setting of 0ms in ILM policy phases
Browse files Browse the repository at this point in the history
  • Loading branch information
jkelastic committed Dec 19, 2019
1 parent a50d378 commit fc786cc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const MinAgeInput = props => {
onChange={async e => {
setPhaseData(PHASE_ROLLOVER_MINIMUM_AGE, e.target.value);
}}
min={1}
min={0}
/>
</ErrableFormRow>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,17 @@ export const maximumDocumentsRequiredMessage =
defaultMessage: 'Maximum documents is required.'
});


export const positiveNumbersAboveZeroErrorMessage =
i18n.translate('xpack.indexLifecycleMgmt.editPolicy.positiveNumberAboveZeroRequiredError', {
defaultMessage: 'Only numbers above 0 are allowed.'
});

export const positiveNumbersEqualAboveZeroErrorMessage =
i18n.translate('xpack.indexLifecycleMgmt.editPolicy.positiveNumberAboveZeroRequiredError', {
defaultMessage: 'Only numbers equal to or above 0 are allowed.'
});

export const validatePhase = (type, phase, errors) => {
const phaseErrors = {};

Expand Down Expand Up @@ -106,10 +112,12 @@ export const validatePhase = (type, phase, errors) => {
phaseErrors[numberedAttribute] = [positiveNumberRequiredMessage];
}
else if ((numberedAttribute === PHASE_ROLLOVER_MINIMUM_AGE ||
numberedAttribute === PHASE_PRIMARY_SHARD_COUNT) && phase[numberedAttribute] < 1) {
phaseErrors[numberedAttribute] = [positiveNumbersAboveZeroErrorMessage];
numberedAttribute === PHASE_PRIMARY_SHARD_COUNT) && phase[numberedAttribute] < 0) {
phaseErrors[numberedAttribute] = [positiveNumbersEqualAboveZeroErrorMessage];
}

}

}
if (phase[PHASE_ROLLOVER_ENABLED]) {
if (
Expand Down Expand Up @@ -153,6 +161,7 @@ export const validatePhase = (type, phase, errors) => {
}

if (phase[PHASE_FORCE_MERGE_ENABLED]) {

if (!isNumber(phase[PHASE_FORCE_MERGE_SEGMENTS])) {
phaseErrors[PHASE_FORCE_MERGE_SEGMENTS] = [numberRequiredMessage];
}
Expand Down

0 comments on commit fc786cc

Please sign in to comment.