Skip to content

Commit

Permalink
[Cases] Adding comments indicating which fields are not indexed (elas…
Browse files Browse the repository at this point in the history
…tic#152763)

This PR adds comments to the various mapping files that had fields
removed as part of removing fields that should not be indexed.

This PR removed the fields from being mapped:
elastic#151511

This serves to indicate which fields are stored in elasticsearch even
though they are not mapped. Once we have resolved this issue:
elastic#152756 we can remove these
comments.
  • Loading branch information
jonathan-buttner authored and bmorelli25 committed Mar 10, 2023
1 parent 71ddd47 commit 91a4096
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 0 deletions.
97 changes: 97 additions & 0 deletions x-pack/plugins/cases/server/saved_object_types/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import { CASE_COMMENT_SAVED_OBJECT } from '../../common/constants';
import type { CreateCommentsMigrationsDeps } from './migrations';
import { createCommentsMigrations } from './migrations';

/**
* The comments in the mapping indicate the additional properties that are stored in Elasticsearch but are not indexed.
* Remove these comments when https://github.com/elastic/kibana/issues/152756 is resolved.
*/

export const createCaseCommentSavedObjectType = ({
migrationDeps,
}: {
Expand All @@ -33,22 +38,68 @@ export const createCaseCommentSavedObjectType = ({
},
actions: {
properties: {
/*
targets: {
properties: {
hostname: { type: 'keyword' },
endpointId: { type: 'keyword' },
}
}
*/
type: { type: 'keyword' },
},
},
alertId: {
type: 'keyword',
},
/*
index: {
type: 'keyword',
}
*/
created_at: {
type: 'date',
},
created_by: {
properties: {
/*
full_name: {
type: 'keyword',
}
email: {
type: 'keyword',
}
profile_uid: {
type: 'keyword',
}
*/
username: {
type: 'keyword',
},
},
},
/*
externalReferenceId: {
type: 'keyword',
},
externalReferenceStorage: {
dynamic: false,
properties: {
// externalReferenceStorage.type
type: {
type: 'keyword',
},
},
},
externalReferenceMetadata: {
dynamic: false,
properties: {},
},
persistableStateAttachmentState: {
dynamic: false,
properties: {},
},
*/
externalReferenceAttachmentTypeId: {
type: 'keyword',
},
Expand All @@ -58,9 +109,55 @@ export const createCaseCommentSavedObjectType = ({
pushed_at: {
type: 'date',
},
/*
pushed_by: {
properties: {
username: {
type: 'keyword',
},
full_name: {
type: 'keyword',
},
email: {
type: 'keyword',
},
profile_uid: {
type: 'keyword',
},
},
},
rule: {
properties: {
id: {
type: 'keyword',
},
name: {
type: 'keyword',
},
},
},
*/
updated_at: {
type: 'date',
},
/*
updated_by: {
properties: {
username: {
type: 'keyword',
},
full_name: {
type: 'keyword',
},
email: {
type: 'keyword',
},
profile_uid: {
type: 'keyword',
},
},
},
*/
},
},
migrations: () => createCommentsMigrations(migrationDeps),
Expand Down
64 changes: 64 additions & 0 deletions x-pack/plugins/cases/server/saved_object_types/configure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import type { SavedObjectsType } from '@kbn/core/server';
import { CASE_CONFIGURE_SAVED_OBJECT } from '../../common/constants';
import { configureMigrations } from './migrations';

/**
* The comments in the mapping indicate the additional properties that are stored in Elasticsearch but are not indexed.
* Remove these comments when https://github.com/elastic/kibana/issues/152756 is resolved.
*/

export const caseConfigureSavedObjectType: SavedObjectsType = {
name: CASE_CONFIGURE_SAVED_OBJECT,
hidden: true,
Expand All @@ -20,12 +25,71 @@ export const caseConfigureSavedObjectType: SavedObjectsType = {
created_at: {
type: 'date',
},
/*
created_by: {
properties: {
email: {
type: 'keyword',
},
username: {
type: 'keyword',
},
full_name: {
type: 'keyword',
},
profile_uid: {
type: 'keyword',
},
},
},
connector: {
properties: {
name: {
type: 'text',
},
type: {
type: 'keyword',
},
fields: {
properties: {
key: {
type: 'text',
},
value: {
type: 'text',
},
},
},
},
},
*/
closure_type: {
type: 'keyword',
},
owner: {
type: 'keyword',
},
/*
updated_at: {
type: 'date',
},
updated_by: {
properties: {
email: {
type: 'keyword',
},
username: {
type: 'keyword',
},
full_name: {
type: 'keyword',
},
profile_uid: {
type: 'keyword',
},
},
},
*/
},
},
migrations: configureMigrations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import type { SavedObjectsType } from '@kbn/core/server';
import { CASE_CONNECTOR_MAPPINGS_SAVED_OBJECT } from '../../common/constants';
import { connectorMappingsMigrations } from './migrations';

/**
* The comments in the mapping indicate the additional properties that are stored in Elasticsearch but are not indexed.
* Remove these comments when https://github.com/elastic/kibana/issues/152756 is resolved.
*/

export const caseConnectorMappingsSavedObjectType: SavedObjectsType = {
name: CASE_CONNECTOR_MAPPINGS_SAVED_OBJECT,
hidden: true,
Expand All @@ -17,6 +22,21 @@ export const caseConnectorMappingsSavedObjectType: SavedObjectsType = {
mappings: {
dynamic: false,
properties: {
/*
mappings: {
properties: {
source: {
type: 'keyword',
},
target: {
type: 'keyword',
},
action_type: {
type: 'keyword',
},
},
},
*/
owner: {
type: 'keyword',
},
Expand Down
16 changes: 16 additions & 0 deletions x-pack/plugins/cases/server/saved_object_types/user_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import { CASE_USER_ACTION_SAVED_OBJECT } from '../../common/constants';
import type { UserActionsMigrationsDeps } from './migrations/user_actions';
import { createUserActionsMigrations } from './migrations/user_actions';

/**
* The comments in the mapping indicate the additional properties that are stored in Elasticsearch but are not indexed.
* Remove these comments when https://github.com/elastic/kibana/issues/152756 is resolved.
*/

export const createCaseUserActionSavedObjectType = (
migrationDeps: UserActionsMigrationsDeps
): SavedObjectsType => ({
Expand All @@ -28,6 +33,17 @@ export const createCaseUserActionSavedObjectType = (
},
created_by: {
properties: {
/*
email: {
type: 'keyword',
},
full_name: {
type: 'keyword',
},
profile_uid: {
type: 'keyword',
},
*/
username: {
type: 'keyword',
},
Expand Down

0 comments on commit 91a4096

Please sign in to comment.