diff --git a/x-pack/plugins/index_lifecycle_management/public/application/store/selectors/policies.js b/x-pack/plugins/index_lifecycle_management/public/application/store/selectors/policies.js index 32c6d93383c22..f0a8e4d81ebe3 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/store/selectors/policies.js +++ b/x-pack/plugins/index_lifecycle_management/public/application/store/selectors/policies.js @@ -193,8 +193,15 @@ const phaseFromES = (phase, phaseName, defaultEmptyPolicy) => { } if (actions.set_priority) { - policy[PHASE_INDEX_PRIORITY] = actions.set_priority.priority; + const { priority } = actions.set_priority; + + if (priority) { + policy[PHASE_INDEX_PRIORITY] = priority; + } else { + policy[PHASE_INDEX_PRIORITY] = ''; + } } + if (actions.wait_for_snapshot) { policy[PHASE_WAIT_FOR_SNAPSHOT_POLICY] = actions.wait_for_snapshot.policy; } @@ -311,6 +318,10 @@ export const phaseToES = (phase, originalEsPhase) => { esPhase.actions.set_priority = { priority: phase[PHASE_INDEX_PRIORITY], }; + } else if (phase[PHASE_INDEX_PRIORITY] === '') { + esPhase.actions.set_priority = { + priority: null, + }; } if (phase[PHASE_WAIT_FOR_SNAPSHOT_POLICY]) { diff --git a/x-pack/plugins/index_lifecycle_management/server/routes/api/policies/register_create_route.ts b/x-pack/plugins/index_lifecycle_management/server/routes/api/policies/register_create_route.ts index 7bf3f96e2b2ef..a35255b3f65ad 100644 --- a/x-pack/plugins/index_lifecycle_management/server/routes/api/policies/register_create_route.ts +++ b/x-pack/plugins/index_lifecycle_management/server/routes/api/policies/register_create_route.ts @@ -30,7 +30,7 @@ const minAgeSchema = schema.maybe(schema.string()); const setPrioritySchema = schema.maybe( schema.object({ - priority: schema.number(), + priority: schema.nullable(schema.number()), }) );