Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup saved objects mappings #153070

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/plugins/data/server/saved_objects/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ export const querySavedObjectType: SavedObjectsType = {
},
},
mappings: {
dynamic: false,
properties: {
title: { type: 'text' },
description: { type: 'text' },
query: {
properties: { language: { type: 'keyword' }, query: { type: 'keyword', index: false } },
},
// query: {
// properties: { language: { type: 'keyword' }, query: { type: 'keyword', index: false } },
// },
filters: {
dynamic: false,
properties: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,23 @@ export interface FileChunkDocument {
*/
data: string;

/**
* Blob ID field that tags a set of blobs as belonging to the same file.
*/
bid: string;
// /**
// * Blob ID field that tags a set of blobs as belonging to the same file.
// */
// bid: string;

/**
* Whether this is the last chunk in a sequence.
*/
last?: boolean;
// /**
// * Whether this is the last chunk in a sequence.
// */
// last?: boolean;
}

export const mappings: MappingTypeMapping = {
dynamic: false,
properties: {
dynamic: false,
data: { type: 'binary' }, // Binary fields are automatically marked as not searchable by ES
bid: { type: 'keyword', index: false },
last: { type: 'boolean', index: false },
// bid: { type: 'keyword', index: false },
// last: { type: 'boolean', index: false },
} as Record<keyof FileChunkDocument, MappingProperty>, // Ensure that our ES types and TS types stay somewhat in sync
} as const;
29 changes: 15 additions & 14 deletions src/plugins/saved_search/server/saved_objects/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,41 +33,42 @@ export function getSavedSearchObjectType(
},
},
mappings: {
dynamic: false,
properties: {
columns: { type: 'keyword', index: false, doc_values: false },
// columns: { type: 'keyword', index: false, doc_values: false },
description: { type: 'text' },
viewMode: { type: 'keyword', index: false, doc_values: false },
hideChart: { type: 'boolean', index: false, doc_values: false },
isTextBasedQuery: { type: 'boolean', index: false, doc_values: false },
usesAdHocDataView: { type: 'boolean', index: false, doc_values: false },
hideAggregatedPreview: { type: 'boolean', index: false, doc_values: false },
hits: { type: 'integer', index: false, doc_values: false },
// viewMode: { type: 'keyword', index: false, doc_values: false },
// hideChart: { type: 'boolean', index: false, doc_values: false },
// isTextBasedQuery: { type: 'boolean', index: false, doc_values: false },
// usesAdHocDataView: { type: 'boolean', index: false, doc_values: false },
// hideAggregatedPreview: { type: 'boolean', index: false, doc_values: false },
// hits: { type: 'integer', index: false, doc_values: false },
kibanaSavedObjectMeta: {
properties: {
searchSourceJSON: { type: 'text', index: false },
},
},
sort: { type: 'keyword', index: false, doc_values: false },
// sort: { type: 'keyword', index: false, doc_values: false },
title: { type: 'text' },
grid: { dynamic: false, properties: {} },
version: { type: 'integer' },
rowHeight: { type: 'text' },
timeRestore: { type: 'boolean', index: false, doc_values: false },
// timeRestore: { type: 'boolean', index: false, doc_values: false },
timeRange: {
dynamic: false,
properties: {
from: { type: 'keyword', index: false, doc_values: false },
to: { type: 'keyword', index: false, doc_values: false },
// from: { type: 'keyword', index: false, doc_values: false },
// to: { type: 'keyword', index: false, doc_values: false },
},
},
refreshInterval: {
dynamic: false,
properties: {
pause: { type: 'boolean', index: false, doc_values: false },
value: { type: 'integer', index: false, doc_values: false },
// pause: { type: 'boolean', index: false, doc_values: false },
// value: { type: 'integer', index: false, doc_values: false },
},
},
rowsPerPage: { type: 'integer', index: false, doc_values: false },
// rowsPerPage: { type: 'integer', index: false, doc_values: false },
breakdownField: { type: 'text' },
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const registerUrlServiceSavedObjectType = (
},
},
mappings: {
dynamic: false,
properties: {
slug: {
type: 'text',
Expand Down Expand Up @@ -67,11 +68,11 @@ export const registerUrlServiceSavedObjectType = (
},
},
},
// Information needed to load and execute a locator.
locatorJSON: {
type: 'text',
index: false,
},
// // Information needed to load and execute a locator.
// locatorJSON: {
// type: 'text',
// index: false,
// },
},
},
migrations: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,19 @@ export const getVisualizationSavedObjectType = (
},
},
mappings: {
dynamic: false,
properties: {
description: { type: 'text' },
kibanaSavedObjectMeta: {
properties: { searchSourceJSON: { type: 'text', index: false } },
properties: {
// searchSourceJSON: { type: 'text', index: false }
},
},
savedSearchRefName: { type: 'keyword', index: false, doc_values: false },
// savedSearchRefName: { type: 'keyword', index: false, doc_values: false },
title: { type: 'text' },
uiStateJSON: { type: 'text', index: false },
// uiStateJSON: { type: 'text', index: false },
version: { type: 'integer' },
visState: { type: 'text', index: false },
// visState: { type: 'text', index: false },
},
},
migrations: () => getAllMigrations(getSearchSourceMigrations()),
Expand Down
25 changes: 13 additions & 12 deletions x-pack/plugins/alerting/server/saved_objects/mappings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { SavedObjectsTypeMappingDefinition } from '@kbn/core/server';

export const alertMappings: SavedObjectsTypeMappingDefinition = {
dynamic: false,
properties: {
enabled: {
type: 'boolean',
Expand Down Expand Up @@ -59,18 +60,18 @@ export const alertMappings: SavedObjectsTypeMappingDefinition = {
},
frequency: {
properties: {
summary: {
index: false,
type: 'boolean',
},
notifyWhen: {
index: false,
type: 'keyword',
},
throttle: {
index: false,
type: 'keyword',
},
// summary: {
// index: false,
// type: 'boolean',
// },
// notifyWhen: {
// index: false,
// type: 'keyword',
// },
// throttle: {
// index: false,
// type: 'keyword',
// },
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,38 @@
import { SavedObjectsTypeMappingDefinition } from '@kbn/core/server';

export const rulesSettingsMappings: SavedObjectsTypeMappingDefinition = {
dynamic: false,
properties: {
flapping: {
properties: {
enabled: {
type: 'boolean',
index: false,
},
lookBackWindow: {
type: 'long',
index: false,
},
statusChangeThreshold: {
type: 'long',
index: false,
},
createdBy: {
type: 'keyword',
index: false,
},
updatedBy: {
type: 'keyword',
index: false,
},
createdAt: {
type: 'date',
index: false,
},
updatedAt: {
type: 'date',
index: false,
},
// enabled: {
// type: 'boolean',
// index: false,
// },
// lookBackWindow: {
// type: 'long',
// index: false,
// },
// statusChangeThreshold: {
// type: 'long',
// index: false,
// },
// createdBy: {
// type: 'keyword',
// index: false,
// },
// updatedBy: {
// type: 'keyword',
// index: false,
// },
// createdAt: {
// type: 'date',
// index: false,
// },
// updatedAt: {
// type: 'date',
// index: false,
// },
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ export const apmServerSettings: SavedObjectsType = {
hidden: false,
namespaceType: 'agnostic',
mappings: {
dynamic: false,
properties: {
schemaJson: {
type: 'text',
index: false,
},
// schemaJson: {
// type: 'text',
// index: false,
// },
},
},
management: {
Expand Down
31 changes: 16 additions & 15 deletions x-pack/plugins/fleet/server/saved_objects/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const getSavedObjectTypes = (): { [key: string]: SavedObjectsType } => ({
mappings: {
properties: {
fleet_server_hosts: { type: 'keyword' },
has_seen_add_data_notice: { type: 'boolean', index: false },
// has_seen_add_data_notice: { type: 'boolean', index: false },
prerelease_integrations_enabled: { type: 'boolean' },
},
},
Expand Down Expand Up @@ -106,7 +106,7 @@ const getSavedObjectTypes = (): { [key: string]: SavedObjectsType } => ({
updated_at: { type: 'date' },
updated_by: { type: 'keyword' },
revision: { type: 'integer' },
monitoring_enabled: { type: 'keyword', index: false },
// monitoring_enabled: { type: 'keyword', index: false },
is_preconfigured: { type: 'keyword' },
data_output_id: { type: 'keyword' },
monitoring_output_id: { type: 'keyword' },
Expand Down Expand Up @@ -136,17 +136,17 @@ const getSavedObjectTypes = (): { [key: string]: SavedObjectsType } => ({
},
mappings: {
properties: {
output_id: { type: 'keyword', index: false },
// output_id: { type: 'keyword', index: false },
name: { type: 'keyword' },
type: { type: 'keyword' },
is_default: { type: 'boolean' },
is_default_monitoring: { type: 'boolean' },
hosts: { type: 'keyword' },
ca_sha256: { type: 'keyword', index: false },
ca_trusted_fingerprint: { type: 'keyword', index: false },
// ca_sha256: { type: 'keyword', index: false },
// ca_trusted_fingerprint: { type: 'keyword', index: false },
config: { type: 'flattened' },
config_yaml: { type: 'text' },
is_preconfigured: { type: 'boolean', index: false },
// is_preconfigured: { type: 'boolean', index: false },
ssl: { type: 'binary' },
proxy_id: { type: 'keyword' },
shipper: {
Expand Down Expand Up @@ -222,11 +222,12 @@ const getSavedObjectTypes = (): { [key: string]: SavedObjectsType } => ({
importableAndExportable: false,
},
mappings: {
dynamic: false,
properties: {
name: { type: 'keyword' },
version: { type: 'keyword' },
internal: { type: 'boolean' },
keep_policies_up_to_date: { type: 'boolean', index: false },
// keep_policies_up_to_date: { type: 'boolean', index: false },
es_index_patterns: {
dynamic: false,
properties: {},
Expand Down Expand Up @@ -295,7 +296,7 @@ const getSavedObjectTypes = (): { [key: string]: SavedObjectsType } => ({
install_source: { type: 'keyword' },
asset_path: { type: 'keyword' },
media_type: { type: 'keyword' },
data_utf8: { type: 'text', index: false },
// data_utf8: { type: 'text', index: false },
data_base64: { type: 'binary' },
},
},
Expand All @@ -322,7 +323,7 @@ const getSavedObjectTypes = (): { [key: string]: SavedObjectsType } => ({
},
mappings: {
properties: {
source_id: { type: 'keyword', index: false },
// source_id: { type: 'keyword', index: false },
name: { type: 'keyword' },
is_default: { type: 'boolean' },
host: { type: 'keyword' },
Expand All @@ -340,7 +341,7 @@ const getSavedObjectTypes = (): { [key: string]: SavedObjectsType } => ({
properties: {
name: { type: 'keyword' },
is_default: { type: 'boolean' },
host_urls: { type: 'keyword', index: false },
// host_urls: { type: 'keyword', index: false },
is_preconfigured: { type: 'boolean' },
proxy_id: { type: 'keyword' },
},
Expand All @@ -356,11 +357,11 @@ const getSavedObjectTypes = (): { [key: string]: SavedObjectsType } => ({
mappings: {
properties: {
name: { type: 'keyword' },
url: { type: 'keyword', index: false },
proxy_headers: { type: 'text', index: false },
certificate_authorities: { type: 'keyword', index: false },
certificate: { type: 'keyword', index: false },
certificate_key: { type: 'keyword', index: false },
// url: { type: 'keyword', index: false },
// proxy_headers: { type: 'text', index: false },
// certificate_authorities: { type: 'keyword', index: false },
// certificate: { type: 'keyword', index: false },
// certificate_key: { type: 'keyword', index: false },
is_preconfigured: { type: 'boolean' },
},
},
Expand Down
Loading