From 381321716889a8187952cb7a06bf8f753253e5f8 Mon Sep 17 00:00:00 2001 From: Riya Saxena Date: Mon, 11 Mar 2024 16:14:45 -0700 Subject: [PATCH] solution to fix integ tests Signed-off-by: Riya Saxena --- .../alerting/resthandler/RestGetFindingsAction.kt | 6 +----- .../alerting/transport/TransportGetFindingsAction.kt | 8 ++++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetFindingsAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetFindingsAction.kt index 1270e3cab..75607a701 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetFindingsAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetFindingsAction.kt @@ -45,8 +45,6 @@ class RestGetFindingsAction : BaseRestHandler() { val size = request.paramAsInt("size", 20) val startIndex = request.paramAsInt("startIndex", 0) val searchString = request.param("searchString", "") - val severity: String? = request.param("severity", "ALL") - val detectionType: String? = request.param("detectionType", "rules") val table = Table( sortOrder, @@ -59,9 +57,7 @@ class RestGetFindingsAction : BaseRestHandler() { val getFindingsSearchRequest = GetFindingsRequest( findingID, - table, - severity, - detectionType + table ) return RestChannelConsumer { channel -> diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetFindingsAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetFindingsAction.kt index 0357889aa..c9b6c8458 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetFindingsAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetFindingsAction.kt @@ -82,8 +82,6 @@ class TransportGetFindingsSearchAction @Inject constructor( val getFindingsRequest = request as? GetFindingsRequest ?: recreateObject(request) { GetFindingsRequest(it) } val tableProp = getFindingsRequest.table - val severity = getFindingsRequest.severity - val detectionType = getFindingsRequest.detectionType val searchString = tableProp.searchString val sortBuilder = SortBuilders @@ -125,7 +123,8 @@ class TransportGetFindingsSearchAction @Inject constructor( queryBuilder.filter(timeRangeQuery) } - if (!detectionType.isNullOrBlank()) { + if (!getFindingsRequest.detectionType.isNullOrBlank()) { + val detectionType = getFindingsRequest.detectionType val nestedQueryBuilder = QueryBuilders.nestedQuery( "queries", when { @@ -161,7 +160,8 @@ class TransportGetFindingsSearchAction @Inject constructor( .minimumShouldMatch(1) } - if (!severity.isNullOrBlank()) { + if (!getFindingsRequest.severity.isNullOrBlank()) { + val severity = getFindingsRequest.severity queryBuilder .must( QueryBuilders.nestedQuery(