File tree Expand file tree Collapse file tree 13 files changed +148
-7
lines changed
x-pack/platform/plugins/shared/cases/server Expand file tree Collapse file tree 13 files changed +148
-7
lines changed Original file line number Diff line number Diff line change 88import type { MappingTypeMapping } from '@elastic/elasticsearch/lib/api/types' ;
99
1010export const CAI_CASES_INDEX_MAPPINGS : MappingTypeMapping = {
11- dynamic : false ,
11+ dynamic : true ,
12+ dynamic_templates : [
13+ {
14+ as_keyword : {
15+ match_pattern : 'regex' ,
16+ match : '.*_as_keyword' ,
17+ mapping : {
18+ type : 'keyword' ,
19+ ignore_above : 256 ,
20+ } ,
21+ } ,
22+ } ,
23+ {
24+ as_integer : {
25+ match_pattern : 'regex' ,
26+ match : '.*_as_integer' ,
27+ mapping : {
28+ type : 'integer' ,
29+ } ,
30+ } ,
31+ } ,
32+ {
33+ as_date : {
34+ match_pattern : 'regex' ,
35+ match : '.*_as_date' ,
36+ mapping : {
37+ type : 'date' ,
38+ } ,
39+ } ,
40+ } ,
41+ ] ,
1242 properties : {
1343 '@timestamp' : {
1444 type : 'date' ,
@@ -133,6 +163,10 @@ export const CAI_CASES_INDEX_MAPPINGS: MappingTypeMapping = {
133163 } ,
134164 } ,
135165 } ,
166+ fields : {
167+ type : 'object' ,
168+ dynamic : true ,
169+ } ,
136170 observables : {
137171 properties : {
138172 type : {
Original file line number Diff line number Diff line change @@ -125,6 +125,14 @@ export const CAI_CASES_INDEX_SCRIPT: StoredScript = {
125125 }
126126 }
127127
128+ ctx._source.fields = new HashMap();
129+ if (source.cases.fields != null) {
130+ for (item in source.cases.fields) {
131+ ctx._source.fields[item] = source.cases.fields[item];
132+ }
133+ }
134+
135+
128136 ctx._source.observables = [];
129137 if (source.cases.observables != null) {
130138 for (item in source.cases.observables) {
Original file line number Diff line number Diff line change @@ -79,9 +79,9 @@ export async function scheduleCAISchedulerTask({
7979 id : CAI_SCHEDULER_TASK_ID ,
8080 taskType : ANALYTICS_SCHEDULER_TASK_TYPE ,
8181 params : { } ,
82- runAt : new Date ( Date . now ( ) + 60 * 1000 ) ,
82+ runAt : new Date ( Date . now ( ) + 60 * 1 ) ,
8383 schedule : {
84- interval : '1h ' ,
84+ interval : '1m ' ,
8585 } ,
8686 state : { } ,
8787 } ) ;
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import type { Owner } from '../../../../common/constants/types';
1919import type { CasesServerStartDependencies } from '../../../types' ;
2020import { AnalyticsIndexSynchronizationTaskFactory } from './synchronization_task_factory' ;
2121
22- const SCHEDULE : IntervalSchedule = { interval : '5m ' } ;
22+ const SCHEDULE : IntervalSchedule = { interval : '1m ' } ;
2323
2424export function registerCAISynchronizationTask ( {
2525 taskManager,
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ export interface CasePersistedAttributes {
3737 connector : ConnectorPersisted ;
3838 description : string ;
3939 duration : number | null ;
40+ fields : Record < string , unknown > ;
4041 external_service : ExternalServicePersisted | null ;
4142 owner : string ;
4243 settings : { syncAlerts : boolean ; extractObservables ?: boolean } ;
Original file line number Diff line number Diff line change @@ -50,8 +50,8 @@ export const ConfigSchema = schema.object({
5050 analytics : schema . object ( {
5151 index : schema . object ( {
5252 enabled : offeringBasedSchema ( {
53- serverless : schema . boolean ( { defaultValue : false } ) ,
54- traditional : schema . boolean ( { defaultValue : false } ) ,
53+ serverless : schema . boolean ( { defaultValue : true } ) ,
54+ traditional : schema . boolean ( { defaultValue : true } ) ,
5555 } ) ,
5656 } ) ,
5757 } ) ,
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import {
2626 modelVersion6 ,
2727 modelVersion7 ,
2828 modelVersion8 ,
29+ modelVersion9 ,
2930} from './model_versions' ;
3031import { handleImport } from '../import_export/import' ;
3132
@@ -38,6 +39,36 @@ export const createCaseSavedObjectType = (
3839 hidden : true ,
3940 namespaceType : 'multiple-isolated' ,
4041 convertToMultiNamespaceTypeVersion : '8.0.0' ,
42+ dynamic_templates : [
43+ {
44+ as_keyword : {
45+ match_pattern : 'regex' ,
46+ match : '.*_as_keyword' ,
47+ mapping : {
48+ type : 'keyword' ,
49+ ignore_above : 256 ,
50+ } ,
51+ } ,
52+ } ,
53+ {
54+ as_integer : {
55+ match_pattern : 'regex' ,
56+ match : '.*_as_integer' ,
57+ mapping : {
58+ type : 'integer' ,
59+ } ,
60+ } ,
61+ } ,
62+ {
63+ as_date : {
64+ match_pattern : 'regex' ,
65+ match : '.*_as_date' ,
66+ mapping : {
67+ type : 'date' ,
68+ } ,
69+ } ,
70+ } ,
71+ ] ,
4172 mappings : {
4273 dynamic : false ,
4374 properties : {
@@ -271,6 +302,11 @@ export const createCaseSavedObjectType = (
271302 } ,
272303 } ,
273304 } ,
305+ fields : {
306+ // @ts -expect-error - only protected by the typescript type
307+ dynamic : true ,
308+ type : 'object' ,
309+ } ,
274310 } ,
275311 } ,
276312 migrations : caseMigrations ,
@@ -283,6 +319,7 @@ export const createCaseSavedObjectType = (
283319 6 : modelVersion6 ,
284320 7 : modelVersion7 ,
285321 8 : modelVersion8 ,
322+ 9 : modelVersion9 ,
286323 } ,
287324 management : {
288325 importableAndExportable : true ,
Original file line number Diff line number Diff line change @@ -13,3 +13,4 @@ export { modelVersion5 } from './model_version_5';
1313export { modelVersion6 } from './model_version_6' ;
1414export { modelVersion7 } from './model_version_7' ;
1515export { modelVersion8 } from './model_version_8' ;
16+ export { modelVersion9 } from './model_version_9' ;
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+ * or more contributor license agreements. Licensed under the Elastic License
4+ * 2.0; you may not use this file except in compliance with the Elastic License
5+ * 2.0.
6+ */
7+
8+ import type { SavedObjectsModelVersion } from '@kbn/core-saved-objects-server' ;
9+ import { casesSchemaV9 } from '../schemas' ;
10+
11+ export const modelVersion9 : SavedObjectsModelVersion = {
12+ changes : [
13+ {
14+ type : 'mappings_addition' ,
15+ addedMappings : {
16+ fields : {
17+ // @ts -expect-error
18+ dynamic : true ,
19+ type : 'object' ,
20+ } ,
21+ } ,
22+ } ,
23+ ] ,
24+ schemas : {
25+ forwardCompatibility : casesSchemaV9 . extends ( { } , { unknowns : 'ignore' } ) ,
26+ } ,
27+ } ;
Original file line number Diff line number Diff line change @@ -15,3 +15,4 @@ export { casesSchema as casesSchemaV5 } from './v5';
1515export { casesSchema as casesSchemaV6 } from './v6' ;
1616export { casesSchema as casesSchemaV7 } from './v7' ;
1717export { casesSchema as casesSchemaV8 } from './v8' ;
18+ export { casesSchema as casesSchemaV9 } from './v9' ;
You can’t perform that action at this time.
0 commit comments