Skip to content

Commit

Permalink
Update TransportGetFindingsSearchAction.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
Annie Lee committed Mar 30, 2022
1 parent 4c8f68f commit 77590ba
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package org.opensearch.alerting.transport

import org.apache.logging.log4j.LogManager
import org.opensearch.action.ActionListener
import org.opensearch.action.get.MultiGetRequest
import org.opensearch.action.get.MultiGetResponse
import org.opensearch.action.search.SearchRequest
import org.opensearch.action.search.SearchResponse
import org.opensearch.action.support.ActionFilters
Expand Down Expand Up @@ -136,10 +138,10 @@ class TransportGetFindingsSearchAction @Inject constructor(
val finding = Finding.parse(xcp, id)
val documentIds = finding.relatedDocId.split(",").toTypedArray()
// Add getRequests to mget request
documentIds.values.forEach {
documentIds.forEach {
// TODO: check if we want to add individual get document request, or use documentIds array for a single finding related_docs
docId ->
mgetMetadataReq.add(MultiGetRequest.Item(sourceIndex, docId))
mgetRequest.add(MultiGetRequest.Item(finding.index, docId))
}
}
searchDocument(mgetRequest, totalFindingCount, actionListener)
Expand All @@ -154,7 +156,7 @@ class TransportGetFindingsSearchAction @Inject constructor(

fun searchDocument(
mgetRequest: MultiGetRequest,
totalFindingCount: Int,
totalFindingCount: Int?,
actionListener: ActionListener<GetFindingsSearchResponse>
): FindingDocument? {
client.multiGet(
Expand Down

0 comments on commit 77590ba

Please sign in to comment.