From 34b82cc1e21f3857a1d34fb3f65504c296c44b65 Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Wed, 19 Jan 2022 10:54:03 -0500 Subject: [PATCH] fix: omit elasticsearch field for policy update API (#121412) (#123368) 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 Co-authored-by: Mark Hopkin --- .../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; };