diff --git a/src/plugins/data/common/es_query/kuery/node_types/types.ts b/src/plugins/data/common/es_query/kuery/node_types/types.ts index 6d3019e75d483..894bd1812f084 100644 --- a/src/plugins/data/common/es_query/kuery/node_types/types.ts +++ b/src/plugins/data/common/es_query/kuery/node_types/types.ts @@ -76,6 +76,7 @@ export interface NamedArgTypeBuildNode { } interface WildcardType { + wildcardSymbol: string; buildNode: (value: string) => WildcardTypeBuildNode | KueryNode; test: (node: any, string: string) => boolean; toElasticsearchQuery: (node: any) => string; diff --git a/x-pack/plugins/ingest_manager/server/services/agents/actions.ts b/x-pack/plugins/ingest_manager/server/services/agents/actions.ts index 8519714334986..254c2c8b21e32 100644 --- a/x-pack/plugins/ingest_manager/server/services/agents/actions.ts +++ b/x-pack/plugins/ingest_manager/server/services/agents/actions.ts @@ -74,18 +74,19 @@ export async function getAgentActionsForCheckin( const filter = nodeTypes.function.buildNode('and', [ nodeTypes.function.buildNode( 'not', - nodeTypes.function.buildNode( - 'is', - `${AGENT_ACTION_SAVED_OBJECT_TYPE}.attributes.sent_at`, - '*' - ) - ), - nodeTypes.function.buildNode( - 'is', - `${AGENT_ACTION_SAVED_OBJECT_TYPE}.attributes.agent_id`, - agentId + nodeTypes.function.buildNodeWithArgumentNodes('is', [ + nodeTypes.literal.buildNode(`${AGENT_ACTION_SAVED_OBJECT_TYPE}.attributes.sent_at`), + nodeTypes.wildcard.buildNode(nodeTypes.wildcard.wildcardSymbol), + nodeTypes.literal.buildNode(false), + ]) ), + nodeTypes.function.buildNodeWithArgumentNodes('is', [ + nodeTypes.literal.buildNode(`${AGENT_ACTION_SAVED_OBJECT_TYPE}.attributes.agent_id`), + nodeTypes.literal.buildNode(agentId), + nodeTypes.literal.buildNode(false), + ]), ]); + const res = await soClient.find({ type: AGENT_ACTION_SAVED_OBJECT_TYPE, filter, @@ -176,11 +177,11 @@ export async function getNewActionsSince(soClient: SavedObjectsClientContract, t const filter = nodeTypes.function.buildNode('and', [ nodeTypes.function.buildNode( 'not', - nodeTypes.function.buildNode( - 'is', - `${AGENT_ACTION_SAVED_OBJECT_TYPE}.attributes.sent_at`, - '*' - ) + nodeTypes.function.buildNodeWithArgumentNodes('is', [ + nodeTypes.literal.buildNode(`${AGENT_ACTION_SAVED_OBJECT_TYPE}.attributes.sent_at`), + nodeTypes.wildcard.buildNode(nodeTypes.wildcard.wildcardSymbol), + nodeTypes.literal.buildNode(false), + ]) ), nodeTypes.function.buildNode( 'range',