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 a3aef8679817d..23b6b5298752d 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 @@ -192,7 +192,9 @@ const phaseFromES = (phase, phaseName, defaultEmptyPolicy) => { } if (actions.set_priority) { - policy[PHASE_INDEX_PRIORITY] = actions.set_priority.priority; + const { priority } = actions.set_priority; + + policy[PHASE_INDEX_PRIORITY] = priority ?? ''; } } return policy; @@ -307,6 +309,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, + }; } return esPhase; }; 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 aac92f3e41a2d..c7ef1acff2fc0 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()), }) );