From cb1fc7a7a1f790f6b70a38e37a3492fe0c3bf6ff Mon Sep 17 00:00:00 2001 From: Gidi Meir Morris Date: Thu, 10 Sep 2020 08:24:00 +0100 Subject: [PATCH] optimized the `is` node Co-authored-by: Brandon Kobel --- .../server/authorization/alerts_authorization_kuery.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/alerts/server/authorization/alerts_authorization_kuery.ts b/x-pack/plugins/alerts/server/authorization/alerts_authorization_kuery.ts index 83d1dfd56909e..f236ee7f3c258 100644 --- a/x-pack/plugins/alerts/server/authorization/alerts_authorization_kuery.ts +++ b/x-pack/plugins/alerts/server/authorization/alerts_authorization_kuery.ts @@ -10,7 +10,11 @@ import { KueryNode } from '../../../../../src/plugins/data/server'; import { RegistryAlertTypeWithAuth } from './alerts_authorization'; export const is = (fieldName: string, value: string | KueryNode) => - nodeTypes.function.buildNode('is', fieldName, value); + nodeTypes.function.buildNodeWithArgumentNodes('is', [ + nodeTypes.literal.buildNode(fieldName), + typeof value === 'string' ? nodeTypes.literal.buildNode(value) : value, + nodeTypes.literal.buildNode(false), + ]); export const or = ([first, ...args]: KueryNode[]): KueryNode => args.length ? nodeTypes.function.buildNode('or', [first, or(args)]) : first;