Skip to content

Commit

Permalink
Inject namedWriteableRegistry during ser/deser of SearchMonitorAction (
Browse files Browse the repository at this point in the history
…#1382)

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
  • Loading branch information
ohltyler committed Jan 18, 2024
1 parent bea2e68 commit ffc183f
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import org.opensearch.commons.alerting.model.Workflow
import org.opensearch.commons.authuser.User
import org.opensearch.commons.utils.recreateObject
import org.opensearch.core.action.ActionListener
import org.opensearch.core.common.io.stream.NamedWriteableRegistry
import org.opensearch.index.query.BoolQueryBuilder
import org.opensearch.index.query.ExistsQueryBuilder
import org.opensearch.index.query.MatchQueryBuilder
Expand All @@ -41,7 +42,8 @@ class TransportSearchMonitorAction @Inject constructor(
val settings: Settings,
val client: Client,
clusterService: ClusterService,
actionFilters: ActionFilters
actionFilters: ActionFilters,
val namedWriteableRegistry: NamedWriteableRegistry
) : HandledTransportAction<ActionRequest, SearchResponse>(
AlertingActions.SEARCH_MONITORS_ACTION_NAME, transportService, actionFilters, ::SearchMonitorRequest
),
Expand All @@ -54,7 +56,7 @@ class TransportSearchMonitorAction @Inject constructor(

override fun doExecute(task: Task, request: ActionRequest, actionListener: ActionListener<SearchResponse>) {
val transformedRequest = request as? SearchMonitorRequest
?: recreateObject(request) {
?: recreateObject(request, namedWriteableRegistry) {
SearchMonitorRequest(it)
}

Expand Down

0 comments on commit ffc183f

Please sign in to comment.