Skip to content

Commit 366ea31

Browse files
committed
Addressing PR comments.
1 parent 0b9eb35 commit 366ea31

File tree

4 files changed

+9
-38
lines changed

4 files changed

+9
-38
lines changed

x-pack/platform/plugins/shared/cases/server/cases_analytics/activity_index/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { ALERTING_CASES_SAVED_OBJECT_INDEX } from '@kbn/core-saved-objects-serve
1111

1212
export const CAI_ACTIVITY_INDEX_NAME = '.internal.cases-activity';
1313

14-
export const CAI_ACTIVITY_INDEX_VERSION = 2;
14+
export const CAI_ACTIVITY_INDEX_VERSION = 1;
1515

1616
export const CAI_ACTIVITY_SOURCE_QUERY: QueryDslQueryContainer = {
1717
term: {

x-pack/platform/plugins/shared/cases/server/cases_analytics/activity_index/mappings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const CAI_ACTIVITY_INDEX_MAPPINGS: MappingTypeMapping = {
1717
type: 'keyword',
1818
},
1919
action: {
20-
type: 'text',
20+
type: 'keyword',
2121
},
2222
type: {
2323
type: 'keyword',

x-pack/platform/plugins/shared/cases/server/cases_analytics/activity_index/painless_scripts.ts

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,6 @@ export const CAI_ACTIVITY_INDEX_SCRIPT_ID = `cai_activity_script_${CAI_ACTIVITY_
1212
export const CAI_ACTIVITY_INDEX_SCRIPT: StoredScript = {
1313
lang: 'painless',
1414
source: `
15-
String statusDecoder(def x) {
16-
if (x == 0) {
17-
return "open";
18-
}
19-
if (x == 10) {
20-
return "in-progress";
21-
}
22-
if (x == 20) {
23-
return "closed";
24-
}
25-
return "";
26-
}
27-
28-
String severityDecoder(def x) {
29-
if (x == 0) {
30-
return "low"
31-
}
32-
if (x == 10) {
33-
return "medium"
34-
}
35-
if (x == 20) {
36-
return "high"
37-
}
38-
if (x == 30) {
39-
return "critical"
40-
}
41-
return ""
42-
}
43-
4415
def source = [:];
4516
source.putAll(ctx._source);
4617
ctx._source.clear();
@@ -61,22 +32,22 @@ export const CAI_ACTIVITY_INDEX_SCRIPT: StoredScript = {
6132
ctx._source.created_by.email = source["cases-user-actions"].created_by.email;
6233
}
6334
64-
if (source["cases-user-actions"].type != "create_case" && source["cases-user-actions"].payload != null) {
35+
if (source["cases-user-actions"].payload != null) {
6536
ctx._source.payload = new HashMap();
6637
67-
if (source["cases-user-actions"].payload.severity != null) {
38+
if (source["cases-user-actions"].type == "severity" && source["cases-user-actions"].payload.severity != null) {
6839
ctx._source.payload.severity = source["cases-user-actions"].payload.severity;
6940
}
7041
71-
if (source["cases-user-actions"].payload.category != null) {
42+
if (source["cases-user-actions"].type == "category" && source["cases-user-actions"].payload.category != null) {
7243
ctx._source.payload.category = source["cases-user-actions"].payload.category;
7344
}
7445
75-
if (source["cases-user-actions"].payload.status != null) {
46+
if (source["cases-user-actions"].type == "status" && source["cases-user-actions"].payload.status != null) {
7647
ctx._source.payload.status = source["cases-user-actions"].payload.status;
7748
}
7849
79-
if (source["cases-user-actions"].payload.tags != null) {
50+
if (source["cases-user-actions"].type == "tags" && source["cases-user-actions"].payload.tags != null) {
8051
ctx._source.payload.tags = source["cases-user-actions"].payload.tags;
8152
}
8253
}

x-pack/platform/test/plugin_api_integration/test_suites/task_manager/check_registered_task_types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ export default function ({ getService }: FtrProviderContext) {
141141
'alerts_invalidate_api_keys',
142142
'apm-source-map-migration-task',
143143
'apm-telemetry-task',
144+
'cai:cases_analytics_index_backfill',
145+
'cai:cases_analytics_index_synchronization',
144146
'cases-telemetry-task',
145-
'cases:analytics_index_backfill',
146-
'cases:analytics_index_synchronization',
147147
'cloud_security_posture-stats_task',
148148
'dashboard_telemetry',
149149
'endpoint:complete-external-response-actions',

0 commit comments

Comments
 (0)