From 4b9ec3239d62e696c889f34b7228dfa86b806fa3 Mon Sep 17 00:00:00 2001 From: Mark Hopkin Date: Thu, 16 Dec 2021 15:45:43 +0000 Subject: [PATCH] fix: omit elasticsearch field for policy update API (#121412) Although this field is returned in the GET response, we do not allow it to be set through the policy update API, so it must be omitted first. Originally fixed in #119131. Co-authored-by: ogupte Co-authored-by: ogupte --- .../sections/agent_policy/edit_package_policy_page/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx index 0255d913a753b..8e5260ea84b33 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx @@ -389,7 +389,8 @@ export const EditPackagePolicyForm = memo<{ const [formState, setFormState] = useState('INVALID'); const savePackagePolicy = async () => { setFormState('LOADING'); - const result = await sendUpdatePackagePolicy(packagePolicyId, packagePolicy); + const { elasticsearch, ...restPackagePolicy } = packagePolicy; // ignore 'elasticsearch' property since it fails route validation + const result = await sendUpdatePackagePolicy(packagePolicyId, restPackagePolicy); setFormState('SUBMITTED'); return result; };