Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Surya Sashank Nistala <snistala@amazon.com>
  • Loading branch information
eirsep committed Mar 5, 2024
1 parent 40a9bec commit 1848d8c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void getCorrelationAlerts(ActionListener<CorrelationAlertsList> listener,
String alertState) {
try {
if (false == correlationAlertsIndexExists()) {
listener.onResponse(new CorrelationAlertsList(Collections.emptyList(), 0L));
listener.onResponse(new CorrelationAlertsList(Collections.emptyList(), 0));
} else {
FieldSortBuilder sortBuilder = SortBuilders
.fieldSort(table.getSortString())
Expand Down Expand Up @@ -79,12 +79,13 @@ public void getCorrelationAlerts(ActionListener<CorrelationAlertsList> listener,
client.search(searchRequest, ActionListener.wrap(
searchResponse -> {
if (0 == searchResponse.getHits().getHits().length) {
listener.onResponse(new CorrelationAlertsList(Collections.emptyList(), 0L));
listener.onResponse(new CorrelationAlertsList(Collections.emptyList(), 0));
} else {
listener.onResponse(
new CorrelationAlertsList(
parseCorrelationAlerts(searchResponse),
searchResponse.getHits().getTotalHits().value)
searchResponse.getHits() != null && searchResponse.getHits().getTotalHits() != null ?
(int) searchResponse.getHits().getTotalHits().value : 0)
);
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
public class CorrelationAlertsList {

private final List<CorrelationAlert> correlationAlertList;
private final Long totalAlerts;
private final Integer totalAlerts;

public CorrelationAlertsList(List<CorrelationAlert> correlationAlertList, long totalAlerts) {
public CorrelationAlertsList(List<CorrelationAlert> correlationAlertList, Integer totalAlerts) {
this.correlationAlertList = correlationAlertList;
this.totalAlerts = totalAlerts;
}
Expand All @@ -26,7 +26,7 @@ public List<CorrelationAlert> getCorrelationAlertList() {
return correlationAlertList;
}

public Long getTotalAlerts() {
public Integer getTotalAlerts() {
return totalAlerts;
}

Expand Down
17 changes: 3 additions & 14 deletions src/main/resources/mappings/correlation_alert_mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@
"type": "text"
},
"correlated_finding_ids": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
"type": "keyword"
},
"id": {
"type": "keyword"
Expand All @@ -45,14 +40,8 @@
"correlation_id": {
"type": "keyword"
},
"correlation_rule_name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
"correlation_rule_names": {
"type": "keyword"
},
"user": {
"properties": {
Expand Down

0 comments on commit 1848d8c

Please sign in to comment.