Skip to content

Commit

Permalink
address the pr comments
Browse files Browse the repository at this point in the history
Signed-off-by: Riya Saxena <[email protected]>
  • Loading branch information
riysaxen-amzn committed Mar 13, 2024
1 parent cbeac2c commit 0ac03b5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,12 @@
import org.opensearch.tasks.Task;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.TransportService;


import static org.opensearch.securityanalytics.util.DetectorUtils.DETECTOR_TYPE_PATH;
import static org.opensearch.securityanalytics.util.DetectorUtils.MAX_DETECTORS_SEARCH_SIZE;
import static org.opensearch.securityanalytics.util.DetectorUtils.NO_DETECTORS_FOUND;
import static org.opensearch.securityanalytics.util.DetectorUtils.NO_DETECTORS_FOUND_FOR_PROVIDED_TYPE;

public class TransportGetFindingsAction extends HandledTransportAction<GetFindingsRequest, GetFindingsResponse> implements SecureTransportAction {

private final TransportSearchDetectorAction transportSearchDetectorAction;

private final NamedXContentRegistry xContentRegistry;
Expand Down Expand Up @@ -181,6 +179,7 @@ private static SearchRequest getSearchDetectorsRequest(GetFindingsRequest findin
else {
MatchAllQueryBuilder queryBuilder = QueryBuilders.matchAllQuery();
searchSourceBuilder.query(queryBuilder);
searchSourceBuilder.size(MAX_DETECTORS_SEARCH_SIZE); // Set the size to 10000
}
searchSourceBuilder.fetchSource(true);
SearchRequest searchRequest = new SearchRequest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class DetectorUtils {
public static final String DETECTOR_ID_FIELD = "detector_id";
public static final String NO_DETECTORS_FOUND = "No detectors found ";
public static final String NO_DETECTORS_FOUND_FOR_PROVIDED_TYPE = "No detectors found for provided type";
public static final int MAX_DETECTORS_SEARCH_SIZE = 10000;

public static SearchResponse getEmptySearchResponse() {
return new SearchResponse(new InternalSearchResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@
import java.util.Map;
import java.util.stream.Collectors;

import static org.opensearch.securityanalytics.TestHelpers.*;
import static org.opensearch.securityanalytics.TestHelpers.netFlowMappings;
import static org.opensearch.securityanalytics.TestHelpers.randomDetectorType;
import static org.opensearch.securityanalytics.TestHelpers.randomDetectorWithTriggers;
import static org.opensearch.securityanalytics.TestHelpers.randomDoc;
import static org.opensearch.securityanalytics.TestHelpers.randomIndex;
import static org.opensearch.securityanalytics.TestHelpers.windowsIndexMapping;

public class SecureFindingRestApiIT extends SecurityAnalyticsRestTestCase {

Expand Down

0 comments on commit 0ac03b5

Please sign in to comment.