From 42f1c9fc5e061c1449717f3a6fb2aade50d8a97b Mon Sep 17 00:00:00 2001 From: Xavier Mouligneau <189600+XavierM@users.noreply.github.com> Date: Tue, 4 Feb 2020 13:29:18 -0500 Subject: [PATCH] fix open close signal on detail page (#56757) --- .../pages/detection_engine/components/signals/index.tsx | 4 +++- .../detection_engine/routes/__mocks__/request_responses.ts | 2 +- .../routes/signals/open_close_signals_route.ts | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/x-pack/legacy/plugins/siem/public/pages/detection_engine/components/signals/index.tsx b/x-pack/legacy/plugins/siem/public/pages/detection_engine/components/signals/index.tsx index e65adcf3a6920..7eb8e07ada762 100644 --- a/x-pack/legacy/plugins/siem/public/pages/detection_engine/components/signals/index.tsx +++ b/x-pack/legacy/plugins/siem/public/pages/detection_engine/components/signals/index.tsx @@ -129,7 +129,9 @@ const SignalsTableComponent: React.FC = ({ dataProviders: [], indexPattern: indexPatterns, browserFields, - filters: globalFilters, + filters: isEmpty(defaultFilters) + ? globalFilters + : [...(defaultFilters ?? []), ...globalFilters], kqlQuery: globalQuery, kqlMode: globalQuery.language, start: from, diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/__mocks__/request_responses.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/__mocks__/request_responses.ts index e33a9ab92f45b..65e1a79b67bf4 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/__mocks__/request_responses.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/__mocks__/request_responses.ts @@ -84,7 +84,7 @@ export const typicalSetStatusSignalByIdsPayload = (): Partial => ({ - query: { range: { '@timestamp': { gte: 'now-2M', lte: 'now/M' } } }, + query: { bool: { filter: { range: { '@timestamp': { gte: 'now-2M', lte: 'now/M' } } } } }, status: 'closed', }); diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/signals/open_close_signals_route.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/signals/open_close_signals_route.ts index 7c49a1942ee91..4755869c3d908 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/signals/open_close_signals_route.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/routes/signals/open_close_signals_route.ts @@ -33,7 +33,11 @@ export const setSignalsStatusRouteDef = (server: ServerFacade): Hapi.ServerRoute queryObject = { ids: { values: signalIds } }; } if (query) { - queryObject = query; + queryObject = { + bool: { + filter: query, + }, + }; } try { return callWithRequest(request, 'updateByQuery', {